About computing covariances between two fixed effects with 4 and 5 levels respectively.
Dear Thierry, Thank you so much for your comment. In fact, it was the first step of the analysis: Mol<- glmmTMB(Observations ~ CAP * Condition + (1|ID), data=mDATA, ziformula=~ 1, family=nbinom1) I aimed to investigate the differences between the CAPs (CAP: c1, c2, c3, c4), across 5 conditions (Condition: base, neu, pneu, aff, paff). For this purpose, implemented the Anova function (glmmTMB), and the emmeans package for assessing the interactions. Another question to answer is how related (i.e., Pearson coefficients for normally distributed and independent data) are those CAPs to each other, across conditions (Condition: neu, pneu, aff, paff), being from the same individuals (N=20). In the previous email, you were right when pointing my confusion between fixed and random effects. So, I went on solving my problem, and I found two alternative solutions: 1) Taking the previous model: Mol<- glmmTMB(Observations ~ CAP * Condition + (1|ID), data=mDATA, ziformula=~ 1, family=nbinom1) We can compute the corr/cov (vcov(Mol)$cond) I assume that the output covariance structure is autoregresive (AR1).(Question aside: Is there any way to change the structure when using his function?) 2) Following the previously cited vignette: https://cran.r-project.org/web/packages/glmmTMB/vignettes/covstruct.html I found the following alternative: fit.us <- glmmTMB(Observations ~ us(CAP * Condition + 0 | group), data=mDATA) Where the"group "variable" is just a 1 in every row of the data, and "us" corresponds to the"heterogeneous unstructured" covariance structure. Regardless of the method, I obtain a correlation values (-1 to 1), of the covariances of the random effect (ID). Therefore, my questions to solve are: 1) Would it be right to interpret the output "correlation" values as the evaluation of the relationship between the factors "CAP" and "Condition" (fixed effects), based on the number of counts reported in "Observations" (random effect)? 2) I do not manage to obtain the cov/corr values from the intercept. For instance, if the intercept values corresponds to"CAP:c1, Condition: base" how can I obtain the corr/cov values corresponding to the regressors from itself? e.g.: CAP:c1, Condition: base" - CAP:c1, Condition: neu" CAP:c1, Condition: base" - CAP:c1, Condition: pneu" CAP:c1, Condition: base" - CAP:c1, Condition: aff" CAP:c1, Condition: base" - CAP:c1, Condition: paff" Thank you so much in advance for any comment. Julian Gaviria Neurology and Imaging of cognition lab (Labnic) University of Geneva. Campus Biotech. 9 Chemin des Mines, 1202 Geneva, CH Tel: +41 22 379 0380 Email: Julian.GaviriaLopez at unige.ch
From: Thierry Onkelinx <thierry.onkelinx at inbo.be>
Sent: Friday, October 25, 2019 10:30:47 AM
To: Julian Gaviria Lopez
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] About computing covariances between two fixed effects with 4 and 5 levels respectively.
Sent: Friday, October 25, 2019 10:30:47 AM
To: Julian Gaviria Lopez
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] About computing covariances between two fixed effects with 4 and 5 levels respectively.
Dear Julian, The described covariance structures relate to a _random_ effect. You are looking for _fixed_ effect covariances. You are probably looking for a model like glmmTMB(Observations ~ CAP * Condition + (1|ID), data=sdf, ziformula=~1) I'd also recommend to contact a local statistician about your problem. Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance thierry.onkelinx at inbo.be<mailto:thierry.onkelinx at inbo.be> Havenlaan 88 bus 73, 1000 Brussel www.inbo.be<http://www.inbo.be> /////////////////////////////////////////////////////////////////////////////////////////// To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey /////////////////////////////////////////////////////////////////////////////////////////// [https://inbo-website-prd-532750756126.s3-eu-west-1.amazonaws.com/inbologoleeuw_nl.png]<https://www.inbo.be> Op do 24 okt. 2019 om 15:05 schreef Julian Gaviria Lopez <Julian.GaviriaLopez at unige.ch<mailto:Julian.GaviriaLopez at unige.ch>>: Hello, I want to assess the correlation of 4 kinds of brain activation patterns (CAP: c1, c2, c3, c4) from 20 subjects, across 5 different conditions (Condition: base, neu, pneu, aff, paff). In total, the count data contains 380 observations, and has the next structure: ID Observations CAP Condition 1 6 c1 base ... ... ... ... 20 0 c1 base ... ... ... ... 1 3 c4 base ... ... ... ... 20 0 c4 base 1 4 c1 neu ... ... ... ... 20 2 c1 neu ... ... ... ... 1 0 c4 neu ... ... ... ... 20 5 c4 neu ... ... ... ... 20 0 c4 paff I am trying to compute the covariance structures proposed by Kasper Kristensen: https://cran.r-project.org/web/packages/glmmTMB/vignettes/covstruct.html When I compute the unstructured covariance: > fit.us<http://fit.us> <- glmmTMB(Observations ~ us(CAP + 0 | Condition), data=sdf, ziformula=~1) I obtain the following result: > VarCorr(fit.us<http://fit.us>) Conditional model: Groups Name Std.Dev. Corr Condition c1 0.86527 c2 0.34487 0.116 c3 0.16450 -0.951 0.164 c4 0.36269 0.414 -0.719 -0.545 Residual 1.98011 As you might appreciate, the results are either wrong or uncompleted, since the right output would yield a 5x4 cov matrix, expressing the correlation of the CAPs (c1, c2, c3, c4) across all the conditions (base, neu, pneu, aff, paff). One rapid solution is to compute the cov matrix per condition. However, apart of being penalized by model deficiency (I guess), the problem is still present, since the question to answer is how the brain activation patterns (CAP) are correlated across all conditions (e.g. correlation between "CAP c1 - Condition aff", and "CAP c4 - Condition paff"). Thanks in advance for any comment on this regard. Best, Julian Gaviria Neurology and Imaging of cognition lab (Labnic) University of Geneva. Campus Biotech. 9 Chemin des Mines, 1202 Geneva, CH Tel: +41 22 379 0380 Email: Julian.GaviriaLopez at unige.ch<mailto:Julian.GaviriaLopez at unige.ch> [[alternative HTML version deleted]] _______________________________________________ R-sig-mixed-models at r-project.org<mailto:R-sig-mixed-models at r-project.org> mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models