1/31/2024 0 Comments Runix matrix symetrical![]() This basically means that Reinhold is fine with rejecting the assumption (that I made above) that the factor levels should be treated equally. He wants to be able to interpret $\Sigma$ and he wants its entries to correspond to c1 and c2. Reinhold says that in his applied work he prefers (1+c1+c2 || subject) over (1+A+B+C || subject) because he chose c1 and c2 as some meaningful contrasts. I had an email exchange with Reinhold Kliegl about this answer. I don't see a reason to necessarily prefer sum contrasts for the random effects, so I think, if one wants to, one can safely use (1+A+B+C || Worker) even if the fixed part uses sum contrasts. The recommendation to use the sum contrasts makes sense for the fixed effects (in the presence of interactions). Rune's critique of m2 still applies: this random effect structure does not treat A, B, and C on the same footing The $\Sigma$ in m2 defined using contr.sum will have the same form as in (1+A+B || Worker) above, but again, with the different interpretation of the entries. the maximal model will still fit an unconstrained $\Sigma$, but the interpretation of its entries is going to be different (variances and covariances of the grand mean and deviations of A and B from the grand mean). I feel that this does not affect anything that I wrote above. Indeed, it is often recommended to use sum contrasts ( contr.sum), especially when there are interactions in the model. A note on sum is asking about sum contrasts. $$\Sigma=\begin \otimes \Sigma + \sigma^2 I,$$ where $m$ is the number of repetitions per Worker/Machine combination (in this dataset $m=3$) and $\sigma^2$ is residual variance. Such a covariance matrix has 6 parameters: These $\mu_i$ are random vectors with mean zero $(0,0,0)$ and some $3\times 3$ covariance matrix $\Sigma$. On top of that each Worker $i$ deviates from this $\mu$ by some "random" three-dimensional vector $\mu_i$. The fixed effects define the mean score for each Machine there are three Machines so it is a three-dimensional vector $\mu$. Which fits $3\times 3$ covariance matrix of the random effects. The maximal mixed model is thus lmer(score ~ 1 + Machine + (0 + Machine | Worker), d) It has several Workers, each repeatedly tested on all of the three Machines. I will consider the same Machines data set. SUMMARY: What is the most appropriate zero-correlation model, depends on the data. Update: there is an ongoing discussion regarding this and related questions on the R-sig-mixed-models mailing list. How should one specify a mixed model without correlation parameters for factors and what are the differences between m2 and m3?Īlso, is there a preferred model for model comparison with m4 (which is discussed here)? m4 <- lmer(score ~ 1 + Machine + (1 | Worker) + (1 | Worker:Machine), d) M3b <- lmer(score ~ 1 + Machine + (1 | Worker) + (0 + A | Worker) + (0 + B | Worker) + (0 + C | Worker), d) M3a <- lmer(score ~ 1 + Machine + (1 + A + B + C || Worker), d) M2b <- lmer(score ~ 1 + Machine + (1 | Worker) + (0 + c1 | Worker) + (0 + c2 | Worker), d) M2a <- lmer(score ~ 1 + Machine + (1 + c1 + c2 || Worker), d) M1 <- lmer(score ~ 1 + Machine + (1 + Machine | Worker), d) m2a and m2b are two equivalent models representing m2 m3a and m3b represent m3, respectively. In what follows I provide an example using the Machines data set. M3 <- lmer(y ~ 1 + factor + (1 + A + B + C || group), data) Mm0 <- model.matrix(~ 0 + factor, data) # This does NOT depend on the contrasts ![]() Mm1 <- model.matrix(~ 1 + factor, data) # This depends on the contrasts m1 <- lmer(y ~ 1 + factor + (1 + factor | group), data) Instead he suggests m3 ( among others) as an appropriate model. Until recently I thought m2, where c1 and c2 are the two contrasts defined for the factor, would be the correct way to specify such a zero-correlation parameter model.īut Rune Haubo Bojesen Christensen pointed out that this model does not make sense to him. ![]() When one wants to specify a lmer model including variance components but no correlation parameters, as opposed to m1, for a categorical predictor (factor) with levels "A", "B", and "C" one has to convert the factors to numeric covariates or use lme4::dummy().
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |