[R-meta] Problems using rma.mh

Gerta Ruecker ruecker @end|ng |rom |mb|@un|-|re|burg@de
Fri Jun 12 11:15:19 CEST 2020


Dear David,

Your code defines a data set called dat, but not dat2007. But this 
doesn't seem to be the problem (I can't locate). Maybe the double zero 
is the problem?

You could try the meta package:

library(metafor)
dat2007 <- dat.nielweise2007
library(meta)
m1 <- metabin(ai, n1i, ci, n2i, data = dat2007)
m2 <- metabin(ai, n1i, ci, n2i, data=dat2007[dat2007$ai==0,])
m1
m2

Best,

Gerta


Am 12.06.2020 um 11:01 schrieb David Fisher:
> Dear metafor community,
>
> I am a Stata user with only limited knowledge of R.  I am trying to
> validate some Stata code by comparing with output from metafor; in
> particular, sparse data/zero cells using Mantel-Haenszel methods.
>
> My reference is Wolfgang's page
> "http://www.metafor-project.org/doku.php/tips:comp_mh_different_software".
> If I type:
>
> library(metafor)
> dat <- dat.nielweise2007
> rma.mh(measure="OR", ai=ai, n1i=n1i, ci=ci, n2i=n2i, data=dat)
>
> ...then I successfully obtain the output shown on the webpage.
> However, if I alter the command in (seemingly) any way, I get the
> following error:
>
> Error in sprintf(format, names(x)) :
>    invalid format '%NA'; use format %s for character objects
>
> For instance, if I limit the dataset to studies with zero events in
> the treatment arm:
>
> rma.mh(measure="OR", ai=ai, n1i=n1i, ci=ci, n2i=n2i,
> data=dat2007[which(dat2007$ai==0),])
>
> ...and similarly if I attempt to use another data frame, or import
> from Stata using "read.dta".  Furthermore, I do not appear to have the
> same issue if I use another model.  For instance, the following runs
> with no problem:
>
> rma(measure="OR", ai=ai, n1i=n1i, ci=ci, n2i=n2i,
> data=dat2007[which(dat2007$ai==0),])
>
> I am using a fresh install of R 4.0.1 and of the metafor package.
>
> Could someone point me in the right direction?
>
> Many thanks,
>
> David.
>
> _______________________________________________
> R-sig-meta-analysis mailing list
> R-sig-meta-analysis using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis

-- 

Dr. rer. nat. Gerta Rücker, Dipl.-Math.

Institute of Medical Biometry and Statistics,
Faculty of Medicine and Medical Center - University of Freiburg

Stefan-Meier-Str. 26, D-79104 Freiburg, Germany

Phone:    +49/761/203-6673
Fax:      +49/761/203-6680
Mail:     ruecker using imbi.uni-freiburg.de
Homepage: https://www.uniklinik-freiburg.de/imbi.html



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