[R-meta] Questions metafor random slope
Viechtbauer, Wolfgang (NP)
wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Thu Nov 21 12:39:05 CET 2024
The equivalent syntax to this:
meta meregress y x || region: x || trial:, essevariable(se)
would be:
rma.mv(y, V=se^2, mods = ~ x, random = list(~ x | region, ~ 1 | interaction(region, trial), struct="GEN", data=dat)
or you could create the 'trial within region' variable first with:
dat$trial.in.region <- paste0(dat$region, ".", dat$trial)
rma.mv(y, V=se^2, mods = ~ x, random = list(~ x | region, ~ 1 | trial.in.region, struct="GEN", data=dat)
or if 'trial within region' is unique for every row of the dataset anyway, then:
dat$id <- 1:nrow(dat)
rma.mv(y, V=se^2, mods = ~ x, random = list(~ x | region, ~ 1 | id, struct="GEN", data=dat)
would do.
Best,
Wolfgang
> -----Original Message-----
> From: Mathias Weis Damkjær <mwdamkjaer using health.sdu.dk>
> Sent: Thursday, November 21, 2024 12:30
> To: Viechtbauer, Wolfgang (NP) <wolfgang.viechtbauer using maastrichtuniversity.nl>; R
> Special Interest Group for Meta-Analysis <r-sig-meta-analysis using r-project.org>
> Subject: Sv: Questions metafor random slope
>
> Dear Wolfgang,
>
> Thanks again for the reply. It is indeed combining the results from multiple
> meta-analyses, although I acknowledge not all may find this
> Evidence on the influence of study characteristics have, however, been provided
> this way. In frequentist statistics see Siersma (multilevel models)
> https://doi.org/10.1002/sim.2752 and by Sterne et al. (two-step) models
> https://doi.org/10.1002/sim.1184.
>
> Final question, I was wondering if somehow it was possible to get rid - in a
> meaningful way of course - the "extra" random-intercept at the meta-analysis-
> level?
>
> In STATA it seems to be possible to get the desired structure: (source:
> https://www.stata.com/manuals/metametameregress.pdf)
> * Perform a three-level meta-analysis of effect-size y with random intercepts by
> region and by trial nested within region
> o meta meregress y || region: || trial:, essevariable(se)
> * As above, but perform a three-level meta-regression on moderator x, add a
> random slope on x at the region level:
> o meta meregress y x || region: x || trial:, essevariable(se)
> I.e., the study characteristic is allowed to vary across meta-analyses, and it
> accounts for the "cluster-effect" of trials nested within meta-analysis by
> having random-intercepts at these levels, and estimate the between-trial and
> between-meta-analysis variation.
>
> I am not sure what the equivalent model specification in the metafor-package is.
> The above STATA model only have one random-intercept at the meta-analysis
> level.
>
> Mathias
> ________________________________________
> Fra: Viechtbauer, Wolfgang (NP)
> <mailto:wolfgang.viechtbauer using maastrichtuniversity.nl>
> Sendt: 20. november 2024 16:59
> Til: Mathias Weis Damkjær <mailto:mwdamkjaer using health.sdu.dk>; R Special Interest
> Group for Meta-Analysis <mailto:r-sig-meta-analysis using r-project.org>
> Emne: RE: Questions metafor random slope
>
> I think that your interpretations are correct. I am just a bit confused by you
> speaking of a 'meta-analysis level' as this sounds as if you are combining the
> results from multiple meta-analyses in your analysis, but I guess this is what
> you are doing.
>
> Best,
> Wolfgang
>
> > -----Original Message-----
> > From: Mathias Weis Damkjær <mailto:mwdamkjaer using health.sdu.dk>
> > Sent: Monday, November 11, 2024 21:19
> > To: Viechtbauer, Wolfgang (NP)
> <mailto:wolfgang.viechtbauer using maastrichtuniversity.nl>; R
> > Special Interest Group for Meta-Analysis <mailto:r-sig-meta-analysis using r-
> project.org>
> > Subject: Re: Questions metafor random slope
> >
> > Thank you so much for replying, Wolfgang.
> >
> > So, just to make sure I get it right (and other readers as well :)):
> >
> > ma_id = meta-analyses level
> > trial_id = study level,
> >
> > res <- rma.mv(yi, vi, mods = ~ moderator, random = list(~ moderator | ma_id, ~
> 1
> > | ma_id / trial_id), struct="GEN", data=d)
> >
> > This would give the following:
> > 1. A nested structure with random-intercepts for trial_id (studies) nested
> > within (meta-analyses), and this will estimate the nested variation / cluster-
> > effect.
> > 2. And a random slope for moderator at ma_id (meta-analysis) level and random-
> > intercept for meta-analysis. This will allow moderator's effect to vary across
> > meta-analyses, and will estimate variation of factor at the ma_id (meta-
> > analysis) level.
> > 'id' in the previous reply would be meta-analysis level, yes, but that would
> > give me answer pct. two, right, i.e., variation of the moderator at the ma_id
> > (meta-analysis) level?
> >
> > Of course this would be a complex model, so it requires a big dataset
> >
> > Thank you once again!
> >
> > Mathias
> >
> > PhD-student
> > ________________________________________
> > From: Viechtbauer, Wolfgang (NP)
> > <mailto:wolfgang.viechtbauer using maastrichtuniversity.nl>
> > Sent: Monday, November 11, 2024 4:20:46 PM
> > To: R Special Interest Group for Meta-Analysis <mailto:r-sig-meta-analysis using r-
> > project.org>
> > Cc: Mathias Weis Damkjær <mailto:mwdamkjaer using health.sdu.dk>
> > Subject: RE: Questions metafor random slope
> >
> > Dear Mathias,
> >
> > See below for my responses.
> >
> > Best,
> > Wolfgang
> >
> > > -----Original Message-----
> > > From: R-sig-meta-analysis <mailto:r-sig-meta-analysis-bounces using r-project.org>
> > On Behalf
> > > Of Mathias Weis Damkjær via R-sig-meta-analysis
> > > Sent: Friday, November 8, 2024 15:50
> > > To: mailto:r-sig-meta-analysis using r-project.org
> > > Cc: Mathias Weis Damkjær <mailto:mwdamkjaer using health.sdu.dk>
> > > Subject: [R-meta] Questions metafor random slope
> > >
> > > Hello everyone,
> > >
> > > I have a few questions about a more complicated model specification in
> > metafor.
> > > I have also created a stackoverflow thread with no replies yet here:
> > > https://stackoverflow.com/questions/79165730/random-slopes-and-intercepts-
> in-
> > > the-metafor-package-model-specification-and-out
> > >
> > > I have read the e-mail correspondence: https://stat.ethz.ch/pipermail/r-sig-
> > > meta-analysis/2019-August/001650.html with interest.
> > >
> > > However, I do have some questions.
> > >
> > > 1. Question 1:
> > >
> > > The model specification:
> > >
> > > * res <- rma.mv(logOR, logOR.var, mods = ~ CF1_Women..IMP, random =
> list(~
> > > CF1_Women..IMP | id, ~ 1 | row), struct="GEN", data=d)
> > >
> > > Adds a multilevel structure AND random slopes for the covariate within meta-
> > > analyses.
> > >
> > > I was wondering why one should not specify the model with: ~ 1 | id/row as
> the
> > > last element in the list of random-effects? That is the notation for
> instance
> > in
> > > the lme4 package.
> >
> > This would add a random intercept at the level of 'id' twice, once via '~
> > CF1_Women..IMP | id' and once via '~ 1 | id/row'. Note that the latter is a
> > shortcut for '~ 1 | id' and '~ 1 | row %in% id' just like in lme4. So I
> suspect
> > that this model would be overparameterized. But you can always try it out with
> > your data and profile the variance components with profile() to see if they
> are
> > identifiable.
> >
> > > 1. Question 2:
> > >
> > > The tau2 estimates (variance components) from this model:
> > >
> > > Variance Components:
> > >
> > > estim sqrt nlvls fixed factor
> > >
> > > sigma^2 X X X no trial_id
> > >
> > > outer factor: id (nlvls = X)
> > > inner term: ~factor (nlvls = X)
> > >
> > > estim sqrt fixed rho: intr c_SP
> > > intrcpt X X no - X
> > > factor X X no no -
> > >
> > > Sigma2 is for trial_level.
> > >
> > > Is it correct that intrcpt is for the meta-analyses level?
> >
> > I can't answer that question, since I don't know what you mean by 'meta-
> analyses
> > level'. The variance corresponding to 'intrcpt' is the estimated variance of
> the
> > intercepts at the 'id' level. Maybe that helps?
> >
> > > Thanks in advance!
> > >
> > > Best,
> > > Mathias, Phd. Student
More information about the R-sig-meta-analysis
mailing list