[R-meta] Random slopes in rma.mv

Francisco Tapia |r@nc|@co@n|ne| @end|ng |rom hotm@||@com
Tue May 25 18:47:16 CEST 2021

Glad I could help Norman.

Have a great week,


From: Norman DAURELLE<mailto:norman.daurelle using agroparistech.fr>
Sent: Tuesday, May 25, 2021 3:23 AM
To: Wolfgang Viechtbauer, SP<mailto:wolfgang.viechtbauer using maastrichtuniversity.nl>
Cc: Francisco Tapia<mailto:francisco.ninel using hotmail.com>; r-sig-meta-analysis<mailto:r-sig-meta-analysis using r-project.org>
Subject: Re: [R-meta] Random slopes in rma.mv

Dear metanalysis community,

Francisco Tapia, Wolfgang Viechtbauer,

thanks for this exchange ! I do not always read everything, but this thread caught my eye and I'm very glad I didn't miss it.

So once again, thank you very much because it explains things I may not have been able to phrase as clearly.

Norman Daurelle.

De: "Wolfgang Viechtbauer, SP" <wolfgang.viechtbauer using maastrichtuniversity.nl>
À: "Francisco Tapia" <francisco.ninel using hotmail.com>, "r-sig-meta-analysis" <r-sig-meta-analysis using r-project.org>
Envoyé: Dimanche 23 Mai 2021 21:37:11
Objet: Re: [R-meta] Random slopes in rma.mv

Yes, -1 and +0 accomplish the same thing.

The || syntax does not currently work, but I recently added struct="GDIAG" to accomplish the same thing. I will probably try to implement || though and if this works then remove struct="GDIAG".


>-----Original Message-----
>From: Francisco Tapia [mailto:francisco.ninel using hotmail.com]
>Sent: Sunday, 23 May, 2021 21:25
>To: Viechtbauer, Wolfgang (SP); r-sig-meta-analysis using r-project.org
>Subject: RE: Random slopes in rma.mv
>I thought adding 0 accounted for uncorrelated random intercept and slopes -> (~ X
>+ 0 | ID2), equivalently (~ X || ID2). From what you tell me, 0 and -1 would be
>analogous then.
>Regarding the last question, it was purely exploratory. I'll be applying profile()
>to test it out.
>Thanks Wolfgang!
>From: Viechtbauer, Wolfgang (SP)
>Sent: Sunday, May 23, 2021 3:11 PM
>To: Francisco Tapia; r-sig-meta-analysis using r-project.org
>Subject: RE: Random slopes in rma.mv
>>-----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
>>>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
>>you have the 'devel' version installed).
>>>  2.  If I create another random effect to add random slopes to ID2, for
>>>(~ 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
>>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
>>>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

R-sig-meta-analysis mailing list
R-sig-meta-analysis using r-project.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20210525/4938e401/attachment-0001.html>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: F1871E87A60B4DB786364B8DF07CDFD2.png
Type: image/png
Size: 132 bytes
Desc: F1871E87A60B4DB786364B8DF07CDFD2.png
URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20210525/4938e401/attachment-0001.png>

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