Reputation: 291
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
Upvotes: 1
Views: 1260
Reputation: 3395
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.
Upvotes: 3