Differences between results from meta and metafor packages in R

拈花ヽ惹草 提交于 2019-12-12 04:30:50

问题


I am doing a meta analysis using R and I decided that I wanted to confirm that two widely used R packages (meta and metafor) produce the same results (I've pasted my code below). Unfortunately, they're not quite the same and I'm trying to figure out why because using one package indicates there is a significant overall effect and the other doesn't. Does anyone have any experience with these packages to know why?

The caveat here is that I work in a field that very much cares about p-values (just to anticipate some responses that may be geared towards "they're close enough" or "ignore the p-values anyways").

Thanks everyone

#Load Libraries
library(meta)
library(metafor)

#Insert effect sizes and sample sizes
es.r<- c(-.14,-.01,-.10,.14,.28,.17,.75,.53)
n <- c(55,46,53,52,105,101,46,48)

# transform to fisher's z
es.r.z <- r2z(es.r)

#Calculate Variance ES
es.r.z.v <-(1/(n-3))

#Calculate Standard Errors ES
r.z.se <-sqrt(es.r.z.v)

#Fixed-effect and Random-effects meta-analysis
#Once with meta package, once with metafor package

meta1<-metagen(es.r.z, r.z.se)
meta2<-rma(es.r.z, r.z.se)

#Show results from both packages
meta1
meta2

回答1:


Your syntax for rma() is not correct. The second argument of the rma() function is for specifying the sampling variances, not the standard errors. Also, metagen() uses the DL estimator by default, while rma() uses the REML estimator. So, you should use:

meta2<-rma(es.r.z, r.z.se^2, method="DL")

Or you can use the sei argument with:

meta2<-rma(es.r.z, sei=r.z.se, method="DL")

Then the results are identical.



来源:https://stackoverflow.com/questions/41962137/differences-between-results-from-meta-and-metafor-packages-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!