[R-meta] Meta-analysis controlling for a moderator

Viechtbauer, Wolfgang (SP) wolfg@ng@viechtb@uer @ending from m@@@trichtuniver@ity@nl
Mon Jul 9 18:41:14 CEST 2018

Dear Caroline,

First of all, thank you for putting your question in the context of a reproducible example.

Consider what the model with 'mods = ~ ablat' means. In essence, it says that the average effect is a function of 'ablat'. So, there is no longer 'the' average effect -- it depends on 'ablat'. Therefore, one could argue that your goal cannot be achieved. One can only test whether the average effect is significantly different from zero for a particular value of 'ablat'. For example:

anova(res, L = c(1, 20))

tests whether the average effect is significantly different from 0 at 20 degrees.

A concept you may have come across is the idea of a 'marginal mean'. In the context of the present example, this would be the predicted average effect when setting the predictor equal to its average. So, in essence:

anova(res, L = c(1, mean(dat$ablat)))

Some might see this as the estimated average effect when controlling for the predictor. I am personally not too crazy about this interpretation, because it is really the estimated average effect at 33.46 degrees (the average) and conceptually no different than a prediction at 20 or 40 degrees. In other words, one cannot 'control away' the influence of 'ablat'. At least, I hope this is some food for thought.


-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Caroline Hoyniak
Sent: Monday, 09 July, 2018 17:24
To: r-sig-meta-analysis using r-project.org
Subject: [R-meta] Meta-analysis controlling for a moderator

I’d like to test whether the overall effect size is significantly different
from zero when controlling for a moderator. For a minimal working example,
I am using the dataset provided with the metafor package, which contains 13
effect size estimates and corresponding sampling variances of the effect of
BCG vaccination on the prevention of tuberculosis.  Here are the steps I

R>#Load package and dataset
R> library("metafor")
R> data("dat.bcg", package = "metafor")

1) Once these 13 effect sizes were converted to the same metric,

 R> #Calculate effect sizes on common metric
R> dat <- escalc(measure = "RR", ai = tpos, bi = tneg, ci = cpos, di =
cneg, data = dat.bcg, append = TRUE)

2) I fitted a fixed-effects model examining the magnitude of the effect of
vaccination on prevention of tuberculosis (with yi = observed outcomes and
vi = sampling variance), and finding a significant average effect size
estimate with a substantial amount of heterogeneity:

R> # Fit fixed-effect model
R> res <- rma(yi, vi, data = dat, method="FE")

3) I then moved on to a moderator analysis. Using the following code, I
examined if a continuous variable (ablat, representing the absolute
latitude of the study location) significantly moderated the average effect
size estimate of the effect of vaccination on the prevention of

R> # Examine continuous moderator (ablat)
R> res <- rma(yi, vi, mods = ~ ablat, data = dat, method = "REML")

I am further interested if the average effect size estimate remains
significant (i.e., whether the effect size is different from zero) when
controlling for this continuous moderator (ablat).  In other words, I’m
interested in whether there remains an effect of vaccination on the
prevention of tuberculosis when controlling for the covariate (i.e.,
examining whether vaccination is still effective when controlling for study
location). Is this possible? Any help would be appreciated.


Caroline Hoyniak
Doctoral Candidate, Clinical Science
Bates Social Development Lab
Indiana University - Bloomington

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