[R-meta] meta-analysis of data summarised as means and SD
Dr. Guido Schwarzer
gu|do@@chw@rzer @end|ng |rom un|k||n|k-|re|burg@de
Thu Feb 1 14:42:11 CET 2024
Dear Mark,
As this might be of interest to others, I reply to your DM via r-sig-meta.
In order to consider two instead of one factor in metamean(), you could use interaction() to generate a new variable combining two factors (see also full R code below):
dat$agecat.sex <- interaction(dat$agecat, dat$sex)
A more general way is to use meta-regression (either using metareg() in R package meta or rma() in R package metafor which is called by metareg()):
metareg(metamean(...), age + sex + age * sex)
This regression model with two main effects and the interaction produces exactly the same results as a subgroup analysis using the variable agecat.sex if a common heterogeneity variance is assumed within subgroups.
The advantage of the meta-regression is that you can easily add additional factors to the model.
Best wishes,
Guido
P.S. Full R script:
library("meta")
set.seed(1904)
#
dat <- data.frame(n = rep(100, 20), mean = sample(1:6, 20, replace = TRUE),
sd = rep(1, 20),
age = runif(20, 40, 60),
sex = sample(c("male", "female"), 20, replace = TRUE))
dat$agecat <- factor(dat$age > 50, levels = c(FALSE, TRUE),
labels = c("<= 50 years", "> 50 years"))
#
dat$agecat.sex <- interaction(dat$agecat, dat$sex)
m <- metamean(n, mean, sd, data = dat, common = FALSE)
m
# Subgroup analyses (with different between-study variances in subgroups)
update(m, subgroup = agecat)
update(m, subgroup = sex)
#
update(m, subgroup = agecat.sex)
# Subgroup analyses assuming a common between-study variance in subgroups
update(m, subgroup = agecat, tau.common = TRUE)
metareg(m, agecat) # same result
#
update(m, subgroup = sex, tau.common = TRUE)
metareg(m, sex) # same result
#
update(m, subgroup = agecat.sex, tau.common = TRUE)
metareg(m, agecat.sex) # same result
# Meta-regression with two categorical covariates (same result)
metareg(m, agecat + sex + agecat * sex)
More information about the R-sig-meta-analysis
mailing list