R中meta和metafor软件包的结果之间的差异 [英] Differences between results from meta and metafor packages in R

查看:367
本文介绍了R中meta和metafor软件包的结果之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用R进行元分析,因此我决定要确认两个广泛使用的R包(元和metafor)产生的结果相同(我在下面粘贴了我的代码).不幸的是,它们并不完全相同,我试图找出原因,因为使用一个包表示总体效果显着,而另一个则没有.有没有人对这些软件包有任何经验知道为什么?

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?

这里需要说明的是,我在一个非常关心p值的领域工作(只是为了预期一些可能针对它们足够接近"或无论如何忽略p值"的响应).

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").

谢谢大家

#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

推荐答案

您的rma()语法不正确. rma()函数的第二个参数用于指定采样方差,而不是标准误差.另外,默认情况下,metagen()使用DL估计器,而rma()使用REML估计器.因此,您应该使用:

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")

或者您可以将sei参数用于:

Or you can use the sei argument with:

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

然后结果是相同的.

这篇关于R中meta和metafor软件包的结果之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆