9.1 Meta-regression in R
Meta-regressions can be conducted in R using the rma
function in metafor
. To show the similarity between subgroup
analysis and meta-regression
, consider the code for our regression-specified subgroup analysis again:
m_dummy <- rma(yi = d, vi = vi, mods = ~ Country, data = df)
This syntax used “country” as a dummy-coded variable. R will always do this for factor
variables. It is possible to drop the intercept and estimate the means for all groups instead by specifying ~Country-1
, and it is even possible to change the default dummy coding if you want to compare a set of groups with another set of groups: a tutorial.
Continuous variables
Imagine you want to check if the proportion of male participants is associated with effect size. The variable sex
contains this information. You can use this predictor in a meta-regression:
m_reg <- rma(yi = d,
vi = vi,
mods = ~sex,
data = df)
m_reg
##
## Mixed-Effects Model (k = 56; tau^2 estimator: REML)
##
## tau^2 (estimated amount of residual heterogeneity): 0.0544 (SE = 0.0173)
## tau (square root of estimated tau^2 value): 0.2333
## I^2 (residual heterogeneity / unaccounted variability): 66.50%
## H^2 (unaccounted variability / sampling variability): 2.98
## R^2 (amount of heterogeneity accounted for): 4.53%
##
## Test for Residual Heterogeneity:
## QE(df = 54) = 149.5878, p-val < .0001
##
## Test of Moderators (coefficient 2):
## QM(df = 1) = 2.1607, p-val = 0.1416
##
## Model Results:
##
## estimate se zval pval ci.lb ci.ub
## intrcpt 0.0648 0.1253 0.5168 0.6053 -0.1808 0.3104
## sex 0.0050 0.0034 1.4699 0.1416 -0.0017 0.0116
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
As you can see from the output, sex
was now included as a predictor, but it is not significantly associated with the effect size (\(p=.1416\)).