[R-meta] Difference between subset (in a loop) and mods in metafor rma.mv

Brendan Pearl brend@n @end|ng |rom brend@n@-b|t@@com
Fri Sep 29 12:00:07 CEST 2023


I am trying to understand the difference using the 'subset' and 'mods' options in rma.mv.

I have run two analyses using rma.mv on the same dataset that has a three level structure (articles nested within larger studies) and get different results.

In the first example I have given below, is looping over rma.mv and passing a different predictor to the subset option a univariate meta-analysis? And in the second example, is passing the predictor to the mods option running a multivariable meta-analysis?

Study <- c("A","A","B","C","C","D","E","F","F","G")
Article <- c("1","2","3","4","5","6","7","8","9","10")
Predictor <- c("x","x","x","y","y","y","x","x","y","y")
yi <- c(-.2,-.3,-.8,.5,.6,.4,-.1,-.8,.3,.8)
vi <- c(.01,.01,.01,.01,.01,.01,.01,.01,.01,.01)

dat <- data.frame(Study,Article,Predictor,yi,vi)

#FIRST EXAMPLE#Subset analyses
# gives me

#1   x OR = -0.49 [-0.84, -0.13]
#2   y    OR = 0.51 [0.31, 0.72]

df_subset <- data.frame(val=as.character(),subset_result=as.character())

for (val in unique(dat$Predictor)){

res_univariate <- rma.mv(yi=yi,
V=vi,
data=dat,
random = ~1 | Study/Article,
subset = Predictor == val,
method = "REML"
)

result <- capture.output(cat(
"OR = ",
format(round(res_univariate$beta, 2),nsmall = 2),
" [",
format(round(res_univariate$ci.lb, 2),nsmall = 2),
", ",
format(round(res_univariate$ci.ub, 2),nsmall = 2),
"]",
sep=""
)
)

df_subset[nrow(df_subset) +1,] = c(
val,
result
)

}

#SECOND EXAMPLE
#Mod analysis
#gives me:

#                      estimate   ci.lb    ci.ub

#factor(Predictor)x   -0.4825    -0.7246  -0.2404
#factor(Predictor)y    0.5807     0.3386   0.8229

df_mod <- data.frame(val=as.character(),mod_result=as.character())

res_multivariate <- rma.mv(yi=yi,
V=vi,
data=dat,
random = ~1 | Study/Article,
mods = ~ factor(Predictor)-1,
method = "REML"
)
summary(res_multivariate)
	[[alternative HTML version deleted]]



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