Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kylehamilton/09683d4b13b9c1db4d15b2b4b3ae5b51 to your computer and use it in GitHub Desktop.
Save kylehamilton/09683d4b13b9c1db4d15b2b4b3ae5b51 to your computer and use it in GitHub Desktop.
# W. Kyle Hamilton | Universtiy of California, Merced
# kylehamilton.com
library(metafor)
author <-
c("Mitja et al 2020",
"Boulware et al 2020",
"Rajasingham et al 2020",
"Abella et al 2020")
ai <- c(24,
11,
58,
4)
ci <- c(37,
9,
39,
4)
n1i <- c(958,
414,
989,
52)
n2i <- c(1042,
407,
494,
51)
dat <- data.frame(author, ai, ci, n1i, n2i)
dat <- escalc(measure="RR", ai=ai, ci=ci, n1i=n1i, n2i=n2i, data=dat)
### random-effects model
res <- rma(yi, vi, data=dat, slab=paste(author))
res
### average risk ratio with 95% CI
predict(res, transf=exp)
forest(res, atransf=exp)
reporter(res)
@kylehamilton
Copy link
Author

2 Oct 2020 | Added the automatic report generated by metafor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment