"forest"(x, vi, sei, ci.lb, ci.ub, annotate=TRUE, showweights=FALSE, xlim, alim, clim, ylim, at, steps=5, level=95, refline=0, digits=2L, width, xlab, slab, ilab, ilab.xpos, ilab.pos, subset, transf, atransf, targs, rows, efac=1, pch=15, psize, col, lty, cex, cex.lab, cex.axis, ...)
vi
or sei
, needs to be specified)vi
or sei
is specified. See Details.vi
or sei
is specified. See Details.TRUE
).FALSE
).at
argument.NA
.2L
). Can also be a vector of two integers, the first specifying the number of decimal places for the annotations, the second for the x-axis labels. When specifying an integer (e.g., 2L
), trailing zeros after the decimal mark are dropped for the x-axis labels. When specifying a numerical value (e.g., 2
), trailing zeros are retained.NA
.ilab
(must be specified if ilab
is specified).ilab
(2 means right, 4 mean left aligned). If unspecified, the default is to center the labels.transf=exp
; see also transf). If unspecified, no transformation is used.atransf=exp
; see also transf). If unspecified, no transformation is used.transf
or atransf
.points
for other options. Can also be a vector of values."solid"
by default).x
argument) together with the corresponding sampling variances (via the vi
argument) or with the corresponding standard errors (via the sei
argument). Alternatively, one can specify the observed effect sizes or outcomes together with the corresponding confidence interval bounds (via the ci.lb
and ci.ub
arguments). With the transf
argument, the observed effect sizes or outcomes and corresponding confidence interval bounds can be transformed with some suitable function. For example, when plotting log odds ratios, then one could use transf=exp
to obtain a forest plot showing the odds ratios. Alternatively, one can use the atransf
argument to transform the x-axis labels and annotations (e.g., atransf=exp
). See also transf for some transformation functions useful for meta-analyses. The examples below illustrate the use of these arguments.
By default, the studies are ordered from top to bottom (i.e., the first study in the dataset will be placed in row $k$, the second study in row $k-1$, and so on, until the last study, which is placed in the first row). The studies can be reordered with the subset
argument (by specifying a vector with indices with the desired order).
Summary estimates can also be added to the plot with the addpoly
function. See the documentation for that function for examples.
Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1--48. http://www.jstatsoft.org/v36/i03/.
forest
, forest.rma
, addpoly
### calculate log relative risks and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
### default forest plot of the observed log relative risks
forest(dat$yi, dat$vi)
### forest plot of the observed relative risks
forest(dat$yi, dat$vi, slab=paste(dat$author, dat$year, sep=", "), transf=exp,
alim=c(0,2), steps=5, xlim=c(-2.5,4), refline=1, cex=.9)
### forest plot of the observed relative risks
forest(dat$yi, dat$vi, slab=paste(dat$author, dat$year, sep=", "), atransf=exp,
at=log(c(.05,.25,1,4,20)), xlim=c(-10,8), cex=.9)
### forest plot of the observed relative risks with studies ordered by the RRs
forest(dat$yi, dat$vi, slab=paste(dat$author, dat$year, sep=", "), atransf=exp,
at=log(c(.05,.25,1,4,20)), xlim=c(-10,8), cex=.9, subset=order(dat$yi))
### see also examples for the forest.rma function
Run the code above in your browser using DataLab