Serge-Étienne Parent
2011-Jan-12 17:18 UTC
[R] Metafor vs Meta vs Spreadsheet: wrong numbers
Hello, I experimented the Metafor and Meta packages in the scope of replacing Excel for meta-analysis. I performed the first working example provided in Michael Borenstein's book "Introduction to Meta-Analysis" with Excel, Metafor and Meta. The numbers given by my spreadsheet, which I validated from Borenstein's book, conrespond quite closely to those given by Meta, but are different from those obtained using Metafor. For the fixed effect, I infer that the differences are related to numerical issues, but for the random effect, the numbers are considerably different. Unfortunately, I could not find where I made it wrong. I would be grateful if someone would have a look at my calculations. Here are the meta-analysis commands: ### USING METAFOR library(metafor) ( dat<-escalc(m1i=m1i, sd1i=sd1i, n1i=n1i, m2i=m2i, sd2i=sd2i, n2i=n2i, measure="SMD", data=metaData, append=T) ) # COMPUTE EFFECT SIZE ( res<-rma.uni(yi,vi,data=dat,method="HE", level=95) ) ### RANDOM EFFECT ( res<-rma.uni(yi,vi,data=dat,method="FE", level=95) ) ### FIXED EFFECT ### USING META ( res<-metacont(metaData[,3], metaData[,1], metaData[,2], metaData[,6], metaData[,4], metaData[,5], studlab=rownames(metaData),sm="SMD", level = 0.95, level.comb = 0.95, comb.fixed=TRUE, comb.random=TRUE, label.e="Experimental", label.c="Control", bylab=rownames(metaData)) ) The whole R script is temporarly available at http://bit.ly/eYesbZ The spreadsheet is temporarly available at http://bit.ly/fAYWPo Kind regards, S.-?. Parent, Eng., Ph.D. Department of Soils and Agrifood Engineering, Universit? Laval Canada
Viechtbauer Wolfgang (STAT)
2011-Jan-13 22:30 UTC
[R] Metafor vs Meta vs Spreadsheet: wrong numbers
Dear Serge-?tienne, Try: res <- rma.uni(yi, vi, data=dat, method="DL") for the random-effects model when using the metafor package. You used method="HE" -- this will give you a different estimator of tau^2 then the one used in the meta package. Best, -- Wolfgang Viechtbauer Department of Psychiatry and Neuropsychology School for Mental Health and Neuroscience Maastricht University, P.O. Box 616 6200 MD Maastricht, The Netherlands Tel: +31 (43) 368-5248 Fax: +31 (43) 368-8689 Web: http://www.wvbauer.com ----Original Message---- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Serge-?tienne Parent Sent: Wednesday, January 12, 2011 18:18 To: r-help at r-project.org Subject: [R] Metafor vs Meta vs Spreadsheet: wrong numbers> Hello, > > I experimented the Metafor and Meta packages in the scope of > replacing Excel for meta-analysis. I performed the first working > example provided in Michael Borenstein's book "Introduction to > Meta-Analysis" with Excel, Metafor and Meta. The numbers given by my > spreadsheet, which I validated from Borenstein's book, conrespond > quite closely to those given by Meta, but are different from those > obtained using Metafor. For the fixed effect, I infer that the > differences are related to numerical issues, but for the random > effect, the numbers are considerably different. Unfortunately, I > could not find where I made it wrong. I would be grateful if someone > would have a look at my calculations. > > Here are the meta-analysis commands: > > ### USING METAFOR > library(metafor) > ( dat<-escalc(m1i=m1i, sd1i=sd1i, n1i=n1i, m2i=m2i, sd2i=sd2i, > n2i=n2i, measure="SMD", data=metaData, append=T) ) # COMPUTE EFFECT > SIZE ( res<-rma.uni(yi,vi,data=dat,method="HE", level=95) ) ### > RANDOM EFFECT ( res<-rma.uni(yi,vi,data=dat,method="FE", level=95) ) > ### FIXED EFFECT > > ### USING META > ( res<-metacont(metaData[,3], metaData[,1], metaData[,2], > metaData[,6], metaData[,4], metaData[,5], > studlab=rownames(metaData),sm="SMD", level = 0.95, level.comb > 0.95, comb.fixed=TRUE, comb.random=TRUE, label.e="Experimental", > label.c="Control", bylab=rownames(metaData)) ) > > The whole R script is temporarly available at http://bit.ly/eYesbZ > The spreadsheet is temporarly available at http://bit.ly/fAYWPo > > Kind regards, > > S.-?. Parent, Eng., Ph.D. > Department of Soils and Agrifood Engineering, Universit? Laval Canada