I have a question about random effect in repeated measures design with 4 within-subjects factor (x1, x2, x3, x4)
What the differences between these 2 ways of defining random effects:
- Option 1.
(1 + x1 + x2 + x3 + x4 | Subject) - Option 2.
(1 + x1 | Subject) + (1 + x2 | Subject) + (1 + x3 | Subject) + (1 + x4 | Subject)
The first option fits a model where the within-subject deviations of the effects of all the variables are correlated with each other. Assuming that each of the factors has two levels, this will lead to estimating 5 variances (one for the intercept, one each for the effects of the factors) and (5*4/2 = 10) covariances/correlations.
The second option is wrong/problematic because it ends up repeating the intercept-within-Subject component four times (these will be redundant/unidentifiable). If you want the within-subject effects of the factors to be treated as independent, you can do
(1|Subject) + (0 + x1 | Subject) + (0 + x2 | Subject) + ...orglmmTMBanddiag(1 + x1 + x2 + x3 + x4 | Subject)orafex::mixed()and(1 + x1 + x2 + x3 + x4 || Subject)