[R-meta] Duplicating the results of the metabin() function
Samuel Leonard
@@mue|j|eon@rd @end|ng |rom gm@||@com
Mon Sep 30 18:40:32 CEST 2019
Hi Meta Analysts,
I'm having trouble duplicating by hand the results produced by the
metabin() function. In particular the Q statistic.
Here's a toy example:
## get metabin() for a simple example
library(meta)
test.dat <- data.frame(exposed.events = c(3, 4, 5), exposed.n = c(10, 11,
12),
unexposed.events = c(14, 7, 2), unexposed.n = c(20,
11, 7))
result <- metabin(event.e = exposed.events, n.e = exposed.n, event.c =
unexposed.events, n.c = unexposed.n, data = test.dat, method.tau = "PM", sm
= 'OR')
## calculate Q by hand
OR <- result$TE
weights.fixed <- result$w.fixed
Q <- sum(weights.fixed * (OR - result$TE.fixed)**2)
## they don't seem to match
> Q
[1] 3.963568
> result$Q
[1] 3.049176
This is confusing to me because according to the literature I've read the
I^2 statistic is calculated directly from Cochran's Q. And performing a
simple calculation on Q to obtain I^2 matches the result of the package:
## calculate I^2 by hand from the result's Q
> (result$Q - 2)/result$Q
[1] 0.3440851
> result$I2
[1] 0.3440851
I'd appreciate any insight into why my Q calculation is different than the
packages. Or any literature about what other statistic Q can refer to in
this case other than Cochran's Q.
Thank you!
Sam Leonard
[[alternative HTML version deleted]]
More information about the R-sig-meta-analysis
mailing list