Skip to content
Prev 149 / 5632 Next

[R-meta] Reproducing an R meta-analysis in STATA

Hi Alex,

Yes, this can be done with just the hat values.

data(dat.bcg, package="metafor")
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
res <- rma(yi, vi, mods = ~ ablat, data=dat)
rstandard(res)
rstandard(res)$se
as.vector(sqrt((1 - hatvalues(res)) * (dat$vi + res$tau2)))

So, you only need the hat values / leverages, not the entire hat matrix.

Best,
Wolfgang