[R-sig-ME] lmer code for multiple random slopes

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Tue Apr 13 14:31:51 CEST 2021


Yes, lmer() will split up the intercept variances into two pieces, but marginally things will be the same, at least in this particular case. But the second model is overparameterized and should not be used, so in *all* situations you should use the top model. In other words, I cannot think of a single reason why you would ever want to use the *second* formulation.

Best,
Wolfgang

>-----Original Message-----
>From: Peter R Law [mailto:prldb using protonmail.com]
>Sent: Tuesday, 13 April, 2021 4:45
>To: Peter R Law; r-sig-mixed-models using r-project.org; Viechtbauer, Wolfgang (SP)
>Subject: Re: [R-sig-ME] lmer code for multiple random slopes
>
>Hi Wolfgang:
>
>I used some simulated data to explore the two different models you described in
>your response to my query:
>
>lmer(y ~ x + (1|G1:G2) + (x|G1))
>
>versus
>
>lmer(y ~ x + (1|G1/G2) + (x|G1))
>
>For my simulated data, the latter model divides the random intercept of G1 into
>two unequal parts but otherwise the models are almost identical, even with the
>same deviance.
>
>Apart from replacing the single random intercept due to G1 in the top model by two
>random intercepts due to G1 in the bottom model, the models seem to be otherwise
>the same.
>
>If so, is there any situation in which one would consider the top model?
>
>Peter
>
>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>On Thursday, March 4, 2021 9:13 PM, Peter R Law via R-sig-mixed-models <r-sig-
>mixed-models using r-project.org> wrote:
>
>> Many thanks Wolfgang.
>>
>> Peter
>>
>> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>> On Thursday, March 4, 2021 5:45 AM, Viechtbauer, Wolfgang (SP)
>wolfgang.viechtbauer using maastrichtuniversity.nl wrote:
>>
>> > Hi Peter,
>> > In:
>> > response ~ x + (1|G2/G1) + (x|G2)?
>> > the first () term adds random intercepts for each level of G2 and random
>intercepts for each level of G1 within G2. The second () term actually stands for
>(1+x|G2), so it again adds random intercepts for each level of G2, and random
>slopes for x for each level of G2 (and allows these random intercepts and slopes
>to be correlated). So, you are in essence adding random intercepts for G2 twice;
>probably not what you intended. Maybe you want:
>> > response ~ x + (1|G2/G1) + (0+x|G2)?
>> > but this implies that the random intercepts and slopes at the G2 level are
>uncorrelated. Or you could use:
>> > response ~ x + (1|G1:G2) + (x|G2)?
>> > which gives you correlated random intercepts and slopes for G2 and also adds
>random intercepts for the various G1-G2 level combinations (i.e., random
>intercepts for each level of G1 within G2).
>> > Best,
>> > Wolfgang


More information about the R-sig-mixed-models mailing list