[R] Metafor package: Including multiple (categorical) predictors
Viechtbauer Wolfgang (STAT)
wolfgang.viechtbauer at maastrichtuniversity.nl
Fri Aug 3 10:06:11 CEST 2012
Just to follow up on that: You can use the 'btt' argument in the rma() function to specify which coefficients to include in the QM test. For example:
data(dat.bcg)
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, append=TRUE)
rma(yi, vi, mods = ~ factor(alloc) + year + ablat, data=dat, btt=c(2,3))
will give you a test of the alloc factor. Note that it does not matter which level of the factor is the reference level:
rma(yi, vi, mods = ~ relevel(factor(alloc), ref="random") + year + ablat, data=dat, btt=c(2,3))
This will give you a Wald-type test. Alternatively, you can use a likelihood ratio test (for this, you have to use method="ML"):
res1 <- rma(yi, vi, mods = ~ factor(alloc) + year + ablat, data=dat, method="ML")
res0 <- rma(yi, vi, mods = ~ + year + ablat, data=dat, method="ML")
anova(res1, res0)
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician
Department of Psychiatry and Psychology
School for Mental Health and Neuroscience
Faculty of Health, Medicine, and Life Sciences
Maastricht University, P.O. Box 616 (VIJV1)
6200 MD Maastricht, The Netherlands
+31 (43) 388-4170 | http://www.wvbauer.com
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Jeremy Miles
> Sent: Friday, August 03, 2012 04:01
> To: Bexkens, Anika
> Cc: r-help at r-project.org
> Subject: Re: [R] Metafor package: Including multiple (categorical)
> predictors
>
> The test of moderator coefficients (QM) is chi-square distributed.You
> can use the change in this value when you add a predictor to the model
> as a chi-square test, with df equal to the change in df.
>
> Jeremy
>
> On 2 August 2012 05:54, Bexkens, Anika <A.Bexkens at uva.nl> wrote:
> > Dear Metafor users,
> >
> > I'd like to test a model with 2 continuous and 2 categorical moderators
> in a meta regression. One categorical parameter has 2 levels and the other
> has 4 levels. If I understand correctly, when I include all moderators in
> the model, Metafor returns main effects of the continuous parameters and
> contrasts of each level of categorical moderators with the intercept
> (which includes the reference level of the categorical parameters).
> >
> > This makes it possible to see whether different levels of the
> categorical moderator are differentially related to effect size. I include
> multiple moderators and would like to report for each variable whether it
> is significantly moderating effect size. Is it possible to obtain an
> overall main effect of each categorical variable, instead of the contrast
> effects? Or can I only obtain this by including one categorical moderator
> at a time and reporting the omnibus moderator test?
> >
> > Many thanks,
> >
> > Anika
More information about the R-help
mailing list