[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 18:44:49 CEST 2021
See below for my responses.
>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 to
>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 ID2?
~ 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!
More information about the R-sig-meta-analysis