### copy data into 'dat' and examine data
dat <- dat.dorn2007
dat
if (FALSE) {
### load metafor package
library(metafor)
### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=x.a, n1i=n.a, ci=x.p, n2i=n.p, data=dat)
### random-effects model
res <- rma(yi, vi, data=dat, digits=2, method="DL")
res
### estimated average risk ratio
predict(res, transf=exp)
### funnel plot with study 5 highlighted in red
funnel(res, atransf=exp, at=log(c(0.1, 0.2, 0.5, 1, 2, 5, 10)),
ylim=c(0,1), steps=6, las=1, col=ifelse(id == 5, "red", "black"))
### change log risk ratio for study 5
dat$yi[5] <- -0.44
### results are now more in line with what is reported in the paper
### (although the CI in the paper is not wide enough)
res <- rma(yi, vi, data=dat, digits=2, method="DL")
predict(res, transf=exp)
### funnel plot with study 5 highlighted in red
funnel(res, atransf=exp, at=log(c(0.1, 0.2, 0.5, 1, 2, 5, 10)),
ylim=c(0,1), steps=6, las=1, col=ifelse(id == 5, "red", "black"))
}
Run the code above in your browser using DataLab