### load BCG vaccine data
data(dat.bcg)
### meta-analysis of the log relative risks using a random-effects model
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR",
slab=paste(author, year, sep=", "), method="REML")
### several forest plots illustrating the use of various arguments
forest(res)
forest(res, order=order(dat.bcg$ablat))
forest(res, transf=exp, alim=c(0,6), steps=4, xlim=c(-8,12), refline=1)
forest(res, atransf=exp, at=log(c(.05,.25,1,4,20)), xlim=c(-8,8),
order="prec", showweight=TRUE, cex=.8)
### forest plot with extra annotations
forest(res, slab=paste(dat.bcg$author, dat.bcg$year, sep=", "),
xlim=c(-16, 6), at=log(c(.05, .25, 1, 4)), atransf=exp,
ilab=cbind(dat.bcg$tpos, dat.bcg$tneg, dat.bcg$cpos, dat.bcg$cneg),
ilab.xpos=c(-9.5,-8,-6,-4.5), cex=.75)
op <- par(cex=.75, font=2)
text(c(-9.5,-8,-6,-4.5), 15, c("TB+", "TB-", "TB+", "TB-"))
text(c(-8.75,-5.25), 16, c("Vaccinated", "Control"))
text(-16, 15, "Author(s) and Year", pos=4)
text(6, 15, "Relative Risk [95% CI]", pos=2)
par(op)
### mixed-effects model with absolute latitude in the model
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, mods=ablat, data=dat.bcg,
measure="RR", method="REML", slab=paste(author, year, sep=", "))
### forest plot with observed and fitted values
forest(res, xlim=c(-9,5), order="fit", cex=.8, ilab=dat.bcg$ablat,
ilab.xpos=-4, atransf=exp, at=log(c(.05,.25,1,4)))
op <- par(font=2)
text(-9, 15, "Author(s) and Year", pos=4, cex=.8)
text( 5, 15, "Observed RR [95% CI]", pos=2, cex=.8)
text(-4, 15, "Latitude", cex=.8)
par(op)
### forest plot with subgrouping of studies
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR",
slab=paste(author, year, sep=", "), method="REML")
forest(res, slab=paste(dat.bcg$author, dat.bcg$year, sep=", "),
xlim=c(-16, 6), at=log(c(.05, .25, 1, 4)), atransf=exp,
ilab=cbind(dat.bcg$tpos, dat.bcg$tneg, dat.bcg$cpos, dat.bcg$cneg),
ilab.xpos=c(-9.5,-8,-6,-4.5), cex=.75, ylim=c(-1, 21),
order=order(dat.bcg$alloc), rows=c(1:2,5:11,14:17))
op <- par(cex=.75, font=4)
text(-16, c(18,12,3), c("Systematic Allcoation", "Random Allocation",
"Alternate Allocation"), pos=4)
par(cex=.75, font=2)
text(c(-9.5,-8,-6,-4.5), 20, c("TB+", "TB-", "TB+", "TB-"))
text(c(-8.75,-5.25), 21, c("Vaccinated", "Control"))
text(-16, 20, "Author(s) and Year", pos=4)
text(6, 20, "Relative Risk [95% CI]", pos=2)
par(op)
### see also addpoly.default function for an example where summaries
### for the three subgroups are added to such a forest plot
Run the code above in your browser using DataLab