I am using the metafor package to conduct a meta-analysis. 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 dat.bcg 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 take:

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

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

#Calculate effect sizes on common metric
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:

# Fit fixed-effect model
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 tuberculosis.

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

I am further interested if the average effect size estimate remains significant 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.


1 Answer 1


In a model with a moderator there is no average effect, only estimates for a specific value of the moderator. So you could estimate the effect of vaccination at some central value of latitude, or the equator, but not over the whole earth.

  • $\begingroup$ Thank you for your helpful response. Is there no way to "control for" this covariate, even if in another modeling approach (ideally using the metafor package or another R package)? I'd like to know if there is an average effect when controlling for this covariate, if that is possible to know. Many thanks! $\endgroup$
    – itpetersen
    Jul 8, 2018 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.