[R-meta] Random slopes in rma.mv

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Sun May 23 21:11:41 CEST 2021

>-----Original Message-----
>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On
>Behalf Of Francisco Tapia
>Sent: Sunday, 23 May, 2021 20:33
>To: r-sig-meta-analysis using r-project.org
>Subject: Re: [R-meta] Random slopes in rma.mv
>Thanks for your answers Wolfgang. I'll clarify some points:
>  1.  Indeed, the structure (~X | ID2/ID1) does not work. This point connected
>with the 2nd one, as I wanted to know how to add the random slopes just for ID2.
>  2.  Could the following structure work in the same way?
>Random = list( ~ 1 | ID2, ID1, ~ X -1 | ID2) (Using the lmer syntax)

I think you meant: list(~ 1 | ID2/ID1, ~ X -1 | ID2)

You could do that too, but this implies that the random intercepts for ID2 are assumed to be uncorrelated with the random slopes for ID2. With

list(~ 1 | interaction(ID2,ID1), ~ X | ID2)

the random intercepts and slopes are allowed to be correlated. 

>  1.  So sorry it wasn't clear enough. I meant:
>Level 1: Effect sizes.
>Level 2: ID1
>Level 3: ID2 and ID3
>Which translates to:
>ES / ID1 / (ID2 & ID3), therefore I would have the effect size Yi(jk), where the
>i-eth outcome is crossed between ID2 and ID3, both at the same level 3.

If you want to know if you could do something like random = list(~ x | ID2, ~ x | ID3), then yes, in principle that is possible. I don't know whether this makes sense in the context of your data or whether the parameters of such a model are identifiable (profile() can help to determine the latter).

>Thanks again for your answers!
>Francisco Tapia
>From: Viechtbauer, Wolfgang
>(SP)<mailto:wolfgang.viechtbauer using maastrichtuniversity.nl>
>Sent: Sunday, May 23, 2021 12:45 PM
>To: Francisco Tapia<mailto:Francisco.ninel using hotmail.com>; r-sig-meta-analysis using r-
>project.org<mailto:r-sig-meta-analysis using r-project.org>
>Subject: RE: Random slopes in rma.mv
>Dear Francisco,
>See below for my responses.
>>-----Original Message-----
>>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On
>>Behalf Of Francisco Tapia
>>Sent: Thursday, 20 May, 2021 18:29
>>To: r-sig-meta-analysis using r-project.org
>>Subject: [R-meta] Random slopes in rma.mv
>>Dear metanalysis community:
>>A couple of days ago, Wolfgang provided me the information to add random slopes
>>rma.mv, from the metafor package
>>By changing the struct to "GEN", I can now add random to my multilevel model. As
>>the documentation is not up yet, I wanted to check some things regarding syntaxis
>>of the code and the logic behind it:
>>  1.  If I have ID1 nested within ID2, my structure of random effects would be: (
>>~ 1 | ID2/ID1) for random intercepts.  If I want to add random slopes to ID2,
>>Should I do it in another random effect? For example, If I add random slopes to (
>>~ 1 | ID2/ID1), therefore -> ( ~ X | ID2/ID1), I'll be adding random slopes for
>>each level of ID1 within ID2, and for ID2 as well. Should I leave ( ~ 1 |
>>ID2/ID1) alone and create another random effect to add random slopes just for
>~ X | ID2/ID1 doesn't work anyway (you should get an error if you try, at least if
>you have the 'devel' version installed).
>>  2.  If I create another random effect to add random slopes to ID2, for example,
>>(~ X | ID2), Would I be adding another random intercept for ID2? If so, How, an
>>unnecessary intercept, can affect my model? I cannot see it very clearly
>Yes, you would be adding random intercepts for each level of ID2 twice. I would
>avoid doing so. You could do:
>random = list(~ 1 | interaction(ID2,ID1), ~ X | ID2), struct="GEN"
>to add random intercepts for each ID2-ID1 combination (i.e., for ID1 nested within
>ID2) and random intercepts and slopes for each level of ID2.
>>  3.  If I have a crossed random effect at the same level as ID2, let's say (~ 1
>>|ID3) for random intercepts. Can both of them, ID2 and ID3, have different random
>>slopes structure from each other, despite being in the same level?
>I don't understand what you mean by ID3 being 'at the same level' as ID2.
>>Thanks in advance!
>>Francisco Tapia

More information about the R-sig-meta-analysis mailing list