Draws a forest plot in the active graphics window (using grid graphics system).
# S3 method for meta
forest(
x,
sortvar,
studlab = TRUE,
layout = gs("layout"),
comb.fixed = x$comb.fixed,
comb.random = x$comb.random,
overall = x$overall,
text.fixed = NULL,
text.random = NULL,
lty.fixed = 2,
lty.random = 3,
col.fixed = "black",
col.random = "black",
prediction = x$prediction,
text.predict = NULL,
subgroup = TRUE,
print.subgroup.labels = TRUE,
bylab = x$bylab,
print.byvar = x$print.byvar,
byseparator = x$byseparator,
text.fixed.w = text.fixed,
text.random.w = text.random,
bysort = FALSE,
pooled.totals = comb.fixed  comb.random,
pooled.events = FALSE,
pooled.times = FALSE,
study.results = TRUE,
xlab = "",
xlab.pos,
smlab = NULL,
smlab.pos,
xlim = "symmetric",
allstudies = TRUE,
weight.study,
weight.subgroup,
pscale = x$pscale,
irscale = x$irscale,
irunit = x$irunit,
ref = ifelse(backtransf & is.relative.effect(x$sm), 1, 0),
lower.equi = NA,
upper.equi = NA,
lty.equi = 1,
col.equi = "blue",
fill.equi = "transparent",
leftcols = NULL,
rightcols = NULL,
leftlabs = NULL,
rightlabs = NULL,
lab.e = x$label.e,
lab.c = x$label.c,
lab.e.attach.to.col = NULL,
lab.c.attach.to.col = NULL,
label.right = x$label.right,
label.left = x$label.left,
bottom.lr = TRUE,
lab.NA = ".",
lab.NA.effect = "",
lab.NA.weight = "",
lwd = 1,
at = NULL,
label = TRUE,
type.study = "square",
type.fixed = "diamond",
type.random = type.fixed,
type.subgroup = ifelse(study.results, "diamond", "square"),
type.subgroup.fixed = type.subgroup,
type.subgroup.random = type.subgroup,
col.study = "black",
col.square = "gray",
col.square.lines = col.square,
col.inside = "white",
col.diamond = "gray",
col.diamond.fixed = col.diamond,
col.diamond.random = col.diamond,
col.diamond.lines = "black",
col.diamond.lines.fixed = col.diamond.lines,
col.diamond.lines.random = col.diamond.lines,
col.inside.fixed = col.inside,
col.inside.random = col.inside,
col.predict = "red",
col.predict.lines = "black",
col.by = "darkgray",
col.label.right = "black",
col.label.left = "black",
hetstat = print.I2  print.tau2  print.tau  print.Q  print.pval.Q  print.Rb,
overall.hetstat = x$overall.hetstat,
hetlab = "Heterogeneity: ",
resid.hetstat = overall & (is.character(hetstat)  hetstat) & !LRT,
resid.hetlab = "Residual heterogeneity: ",
print.I2 = comb.fixed  comb.random,
print.I2.ci = FALSE,
print.tau2 = comb.fixed  comb.random,
print.tau2.ci = FALSE,
print.tau = FALSE,
print.tau.ci = FALSE,
print.Q = FALSE,
print.pval.Q = comb.fixed  comb.random,
print.Rb = FALSE,
print.Rb.ci = FALSE,
text.subgroup.nohet = "not applicable",
LRT = FALSE,
test.overall = gs("test.overall"),
test.overall.fixed = comb.fixed & overall & test.overall,
test.overall.random = comb.random & overall & test.overall,
label.test.overall.fixed,
label.test.overall.random,
print.stat = TRUE,
test.subgroup,
test.subgroup.fixed,
test.subgroup.random,
print.Q.subgroup = TRUE,
label.test.subgroup.fixed,
label.test.subgroup.random,
test.effect.subgroup,
test.effect.subgroup.fixed,
test.effect.subgroup.random,
label.test.effect.subgroup.fixed,
label.test.effect.subgroup.random,
text.addline1,
text.addline2,
fontsize = 12,
fontfamily = NULL,
fs.heading = fontsize,
fs.fixed,
fs.random,
fs.predict,
fs.fixed.labels,
fs.random.labels,
fs.predict.labels,
fs.study = fontsize,
fs.study.labels = fs.study,
fs.hetstat,
fs.test.overall,
fs.test.subgroup,
fs.test.effect.subgroup,
fs.addline,
fs.axis = fontsize,
fs.smlab = fontsize,
fs.xlab = fontsize,
fs.lr = fontsize,
ff.heading = "bold",
ff.fixed,
ff.random,
ff.predict,
ff.fixed.labels,
ff.random.labels,
ff.predict.labels,
ff.study = "plain",
ff.study.labels = ff.study,
ff.hetstat,
ff.test.overall,
ff.test.subgroup,
ff.test.effect.subgroup,
ff.addline,
ff.axis = "plain",
ff.smlab = "bold",
ff.xlab = "plain",
ff.lr = "plain",
squaresize = 0.8/spacing,
plotwidth = if (layout == "JAMA") "8cm" else "6cm",
colgap = "2mm",
colgap.left = colgap,
colgap.right = colgap,
colgap.studlab = colgap.left,
colgap.forest = colgap,
colgap.forest.left = colgap.forest,
colgap.forest.right = colgap.forest,
calcwidth.pooled = (comb.fixed  comb.random) & (overall  !is.null(x$byvar)),
calcwidth.fixed = calcwidth.pooled,
calcwidth.random = calcwidth.pooled,
calcwidth.predict = FALSE,
calcwidth.hetstat = FALSE,
calcwidth.tests = FALSE,
calcwidth.subgroup = FALSE,
just = if (layout == "JAMA") "left" else "right",
just.studlab = "left",
just.addcols = "center",
just.addcols.left = just.addcols,
just.addcols.right = just.addcols,
spacing = 1,
addrow,
addrow.overall,
addrow.subgroups,
new = TRUE,
backtransf = x$backtransf,
digits = gs("digits.forest"),
digits.se = gs("digits.se"),
digits.stat = gs("digits.stat"),
digits.pval = max(gs("digits.pval")  2, 2),
digits.pval.Q = max(gs("digits.pval.Q")  2, 2),
digits.Q = gs("digits.Q"),
digits.tau2 = gs("digits.tau2"),
digits.tau = gs("digits.tau"),
digits.I2 = max(gs("digits.I2")  1, 0),
digits.weight = gs("digits.weight"),
digits.mean = digits,
digits.sd = digits.se,
digits.cor = digits,
digits.time = digits,
digits.addcols = digits,
digits.addcols.right = digits.addcols,
digits.addcols.left = digits.addcols,
scientific.pval = gs("scientific.pval"),
big.mark = gs("big.mark"),
zero.pval = if (layout == "JAMA") FALSE else gs("zero.pval"),
JAMA.pval = if (layout == "JAMA") TRUE else gs("JAMA.pval"),
col.i = col.study,
weight = weight.study,
digits.zval = digits.stat,
print.zval = print.stat,
...
)
An object of class meta
.
An optional vector used to sort the individual
studies (must be of same length as x$TE
).
A logical indicating whether study labels should be
printed in the graph. A vector with study labels can also be
provided (must be of same length as x$TE
then).
A character string specifying the layout of the forest plot (see Details).
A logical indicating whether fixed effect estimate should be plotted.
A logical indicating whether random effects estimate should be plotted.
A logical indicating whether overall summaries should be plotted. This argument is useful in a metaanalysis with subgroups if summaries should only be plotted on group level.
A character string used in the plot to label the pooled fixed effect estimate.
A character string used in the plot to label the pooled random effects estimate.
Line type (pooled fixed effect estimate).
Line type (pooled random effects estimate).
Line colour (pooled fixed effect estimate).
Line colour (pooled random effects estimate).
A logical indicating whether a prediction interval should be printed.
A character string used in the plot to label the prediction interval.
A logical indicating whether subgroup results should be shown in forest plot. This argument is useful in a metaanalysis with subgroups if summaries should not be plotted on group level.
A logical indicating whether subgroup label should be printed.
A character string with a label for the grouping variable.
A logical indicating whether the name of the grouping variable should be printed in front of the group labels.
A character string defining the separator between label and levels of grouping variable.
A character string to label the pooled fixed effect estimate within subgroups, or a character vector of same length as number of subgroups with corresponging labels.
A character string to label the pooled random effect estimate within subgroups, or a character vector of same length as number of subgroups with corresponging labels.
A logical indicating whether groups should be ordered alphabetically.
A logical indicating whether total number of observations should be given in the figure.
A logical indicating whether total number of events should be given in the figure.
A logical indicating whether total person time at risk should be given in the figure.
A logical indicating whether results for individual studies should be shown in the figure (useful to only plot subgroup results).
A label for the xaxis.
A numeric specifying the center of the label on the xaxis.
A label for the summary measurex (printed at top of figure).
A numeric specifying the center of the label for the summary measure.
The x limits (min,max) of the plot, or the character "s" to produce symmetric forest plots.
A logical indicating whether studies with inestimable treatment effects should be plotted.
A character string indicating weighting used to
determine size of squares or diamonds (argument
type.study
) to plot individual study results. One of
missing, "same"
, "fixed"
, or "random"
, can
be abbreviated. Plot symbols have the same size for all studies
or represent study weights from fixed effect or random effects
model.
A character string indicating weighting used
to determine size of squares or diamonds (argument
type.subgroup
) to plot subgroup results. One of missing,
"same"
, or "weight"
, can be abbreviated. Plot
symbols have the same size for all subgroup results or represent
subgroup weights from fixed effect or random effects model.
A numeric giving scaling factor for printing of
single event probabilities or risk differences, i.e. if argument
sm
is equal to "PLOGIT"
, "PLN"
,
"PRAW"
, "PAS"
, "PFT"
, or "RD"
.
A numeric defining a scaling factor for printing of
single incidence rates or incidence rate differences, i.e. if
argument sm
is equal to "IR"
, "IRLN"
,
"IRS"
, "IRFT"
, or "IRD"
.
A character specifying the time unit used to calculate rates, e.g., personyears.
A numerical giving the reference value to be plotted as
a line in the forest plot. No reference line is plotted if
argument ref
is equal to NA
.
A numerical giving the lower limit of equivalence
to be plotted as a line in the forest plot. No line is plotted if
argument lower.equi
is equal to NA
.
A numerical giving the upper limit of equivalence
to be plotted as a line in the forest plot. No line is plotted if
argument upper.equi
is equal to NA
.
Line type (limits of equivalence).
Line colour (limits of equivalence).
Colour of area between limits of equivalence.
A character vector specifying (additional) columns to be plotted on the left side of the forest plot or a logical value (see Details).
A character vector specifying (additional) columns to be plotted on the right side of the forest plot or a logical value (see Details).
A character vector specifying labels for (additional) columns on left side of the forest plot (see Details).
A character vector specifying labels for (additional) columns on right side of the forest plot (see Details).
Label to be used for experimental group in table heading.
Label to be used for control group in table heading.
A character specifying the column name
where label lab.e
should be attached to in table heading.
A character specifying the column name
where label lab.c
should be attached to in table heading.
Graph label on right side of forest plot.
Graph label on left side of forest plot.
A logical indicating whether labels on right and left side should be printed at bottom or top of forest plot.
A character string to label missing values.
A character string to label missing values in individual treatment estimates and confidence intervals.
A character string to label missing weights.
The line width, see par
.
The points at which tickmarks are to be drawn, see
grid.xaxis
.
A logical value indicating whether to draw the labels
on the tick marks, or an expression or character vector which
specify the labels to use. See grid.xaxis
.
A character string or vector specifying how to plot treatment effects and confidence intervals for individual studies (see Details).
A character string specifying how to plot treatment effect and confidence interval for fixed effect metaanalysis (see Details).
A character string specifying how to plot treatment effect and confidence interval for random effects metaanalysis (see Details).
A character string specifying how to plot treatment effect and confidence interval for subgroup results (see Details).
A character string specifying how to plot treatment effect and confidence interval for subgroup results (fixed effect model).
A character string specifying how to plot treatment effect and confidence interval for subgroup results (random effects model).
The colour for individual study results and confidence limits.
The colour for squares reflecting study's weight in the metaanalysis.
The colour for the outer lines of squares reflecting study's weight in the metaanalysis.
The colour for individual study results and confidence limits if confidence limits are completely within squares.
The colour of diamonds representing the results for fixed effect and random effects models.
The colour of diamonds for fixed effect estimates.
The colour of diamonds for random effects estimates.
The colour of the outer lines of diamonds representing the results for fixed effect and random effects models.
The colour of the outer lines of diamond for fixed effect estimate.
The colour of the outer lines of diamond for random effects estimate.
The colour for result of fixed effect metaanalysis if confidence limit lies completely within square.
The colour for result of random effects metaanalysis if confidence limit lies completely within square.
Background colour of prediction interval.
Colour of outer lines of prediction interval.
The colour to print information on subgroups.
The colour for label on right side of null effect.
The colour for label on left side of null effect.
Either a logical value indicating whether to print results for heterogeneity measures at all or a character string (see Details).
A logical value indicating whether to print heterogeneity measures for overall treatment comparisons. This argument is useful in a metaanalysis with subgroups if heterogeneity statistics should only be printed on subgroup level.
Label printed in front of results for heterogeneity measures.
A logical value indicating whether to print measures of residual heterogeneity in a metaanalysis with subgroups.
Label printed in front of results for residual heterogeneity measures.
A logical value indicating whether to print the value of the Isquared statistic.
A logical value indicating whether to print the confidence interval of the Isquared statistic.
A logical value indicating whether to print the value of the betweenstudy variance \(\tau^2\).
A logical value indicating whether to print the confidence interval of \(\tau^2\).
A logical value indicating whether to print \(\tau\), the square root of the betweenstudy variance \(\tau^2\).
A logical value indicating whether to print the confidence interval of \(\tau\).
A logical value indicating whether to print the value of the heterogeneity statistic Q.
A logical value indicating whether to print the pvalue of the heterogeneity statistic Q.
A logical value indicating whether to print the value of the Isquared statistic.
A logical value indicating whether to print the confidence interval of the Isquared statistic.
A logical value or character string which is printed to indicate subgroups with less than two studies contributing to metaanalysis (and thus without heterogeneity). If FALSE, heterogeneity statistics are printed (with NAs).
A logical value indicating whether to report LikelihoodRatio or Waldtype test of heterogeneity for generalized linear mixed models.
A logical value indicating whether to print results of test for overall effect.
A logical value indicating whether to print results of test for overall effect (based on fixed effect model).
A logical value indicating whether to print results of test for overall effect (based on random effects model).
Label printed in front of results of test for overall effect (based on fixed effect model).
Label printed in front of results of test for overall effect (based on random effects model).
A logical value indicating whether z or tvalue for test of treatment effect should be printed.
A logical value indicating whether to print results of test for subgroup differences.
A logical value indicating whether to print results of test for subgroup differences (based on fixed effect model).
A logical value indicating whether to print results of test for subgroup differences (based on random effects model).
A logical value indicating whether to print the value of the heterogeneity statistic Q (test for subgroup differences).
Label printed in front of results of test for subgroup differences (based on fixed effect model).
Label printed in front of results of test for subgroup differences (based on random effects model).
A logical value indicating whether to print results of test for effect in subgroups.
A logical value indicating whether to print results of test for effect in subgroups (based on fixed effect model).
A logical value indicating whether to print results of test for effect in subgroups (based on random effects model).
Label printed in front of results of test for effect in subgroups (based on fixed effect model).
Label printed in front of results of test for effect in subgroups (based on random effects model).
Text for first additional line (below metaanalysis results).
Text for second additional line (below metaanalysis results).
The size of text (in points), see
gpar
.
The font family, see gpar
.
The size of text for column headings, see
gpar
.
The size of text for results of fixed effect model,
see gpar
.
The size of text for results of random effects
model, see gpar
.
The size of text for results of prediction
interval, see gpar
.
The size of text for label of fixed effect
model, see gpar
.
The size of text for label of random
effects model, see gpar
.
The size of text for label of prediction
interval, see gpar
.
The size of text for results of individual studies,
see gpar
.
The size of text for labels of individual
studies, see gpar
.
The size of text for heterogeneity measures, see
gpar
.
The size of text of test for overall effect,
see gpar
.
The size of text of test of subgroup
differences, see gpar
.
The size of text of test of effect
in subgroups, see gpar
.
The size of text for additional lines, see
gpar
.
The size of text on xaxis, see gpar
.
The size of text of label for summary measure, see
gpar
.
The size of text of label on xaxis, see
gpar
.
The size of text of label on left and right side of
forest plot, see gpar
.
The fontface for column headings, see
gpar
.
The fontface of text for results of fixed effect
model, see gpar
.
The fontface of text for results of random effects
model, see gpar
.
The fontface of text for results of prediction
interval, see gpar
.
The fontface of text for label of fixed
effect model, see gpar
.
The fontface of text for label of random
effects model, see gpar
.
The fontface of text for label of
prediction interval, see gpar
.
The fontface of text for results of individual
studies, see gpar
.
The fontface of text for labels of
individual studies, see gpar
.
The fontface of text for heterogeneity measures,
see gpar
.
The fontface of text of test for overall
effect, see gpar
.
The fontface of text for test of subgroup
differences, see gpar
.
The fontface of text for test of
effect in subgroups, see gpar
.
The fontface of text for additional lines, see
gpar
.
The fontface of text on xaxis, see
gpar
.
The fontface of text of label for summary measure,
see gpar
.
The fontface of text of label on xaxis, see
gpar
.
The fontface of text of label on left and right side
of forest plot, see gpar
.
A numeric used to increase or decrease the size of squares in the forest plot.
Either a character string, e.g., "8cm", "60mm", or
"3inch", or a unit
object specifying width of
the forest plot.
Either a character string or a
unit
object specifying gap between columns
printed on left and right side of forest plot.
Either a character string or a
unit
object specifying gap between columns
printed on left side of forest plot.
Either a character string or a
unit
object specifying gap between columns
printed on right side of forest plot.
Either a character string or a
unit
object specifying gap between column
with study labels and subsequent column.
Either a character string or a
unit
object specifying gap between column
adjacent to forest plot and the forest plot.
Either a character string or a
unit
object specifying gap between column on
the left side of forest plot and the forest plot.
Either a character string or a
unit
object specifying gap between column on
the right side of forest plot and the forest plot.
A logical indicating whether text for fixed effect and random effects model should be considered to calculate width of the column with study labels.
A logical indicating whether text given in
arguments text.fixed
and text.fixed.w
should be
considered to calculate width of the column with study labels.
A logical indicating whether text given in
arguments text.random
and text.random.w
should be
considered to calculate width of the column with study labels.
A logical indicating whether text given in
argument text.predict
should be considered to calculate
width of the column with study labels.
A logical indicating whether text for heterogeneity statistics should be considered to calculate width of the column with study labels.
A logical indicating whether text for tests of overall effect or subgroup differences should be considered to calculate width of the column with study labels.
A logical indicating whether text with subgroup labels should be considered to calculate width of the column with study labels.
Justification of text in all columns but columns with study labels and additional variables (possible values: "left", "right", "center").
Justification of text for study labels (possible values: "left", "right", "center").
Justification of text for additional columns (possible values: "left", "right", "center").
Justification of text for additional columns on left side of forest plot (possible values: "left", "right", "center"). Can be of same length as number of additional columns on left side of forest plot.
Justification of text for additional columns on right side of forest plot (possible values: "left", "right", "center"). Can be of same length as number of additional columns on right side of forest plot.
A numeric determining line spacing in a forest plot.
A logical value indicating whether an empty row is printed above and below study results.
A logical value indicating whether an empty row is printed above overall metaanalysis results.
A logical value indicating whether an empty row is printed between results for subgroups.
A logical value indicating whether a new figure should be printed in an existing graphics window.
A logical indicating whether results should be
back transformed in forest plots. If backtransf = TRUE
,
results for sm = "OR"
are presented as odds ratios rather
than log odds ratios and results for sm = "ZCOR"
are
presented as correlations rather than Fisher's z transformed
correlations, for example.
Minimal number of significant digits for treatment
effects, see print.default
.
Minimal number of significant digits for standard
errors, see print.default
.
Minimal number of significant digits for z or
tstatistic for test of overall effect, see print.default
.
Minimal number of significant digits for pvalue
of overall treatment effect, see print.default
.
Minimal number of significant digits for
pvalue of heterogeneity test, see print.default
.
Minimal number of significant digits for
heterogeneity statistic Q, see print.default
.
Minimal number of significant digits for
betweenstudy variance, see print.default
.
Minimal number of significant digits for square
root of betweenstudy variance, see print.default
.
Minimal number of significant digits for Isquared
statistic, see print.default
.
Minimal number of significant digits for
weights, see print.default
.
Minimal number of significant digits for means;
only applies to metacont
objects.
Minimal number of significant digits for standard
deviations; only applies to metacont
objects.
Minimal number of significant digits for
correlations; only applies to metacor
objects.
A vector or scalar with minimal number of significant digits for additional columns.
A vector or scalar with minimal number of significant digits for additional columns on right side of forest plot.
A vector or scalar with minimal number of significant digits for additional columns on left side of forest plot.
A logical specifying whether pvalues should be printed in scientific notation, e.g., 1.2345e01 instead of 0.12345.
A character used as thousands separator.
A logical specifying whether pvalues should be printed with a leading zero.
A logical specifying whether pvalues for test of overall effect should be printed according to JAMA reporting standards.
Deprecated argument (replaced by col.study
).
Deprecated argument (replaced by
weight.study
).
Deprecated argument (replaced by digits.stat
).
Deprecated argument (replaced by print.stat
).
Additional graphical arguments.
A forest plot, also called confidence interval plot, is drawn in
the active graphics window. The forest functions in R package
meta are based on the grid graphics system. In order to
print the forest plot, resize the graphics window and either use
dev.copy2eps
or dev.copy2pdf
. Another
possibility is to create a file using pdf
,
png
, or svg
and to specify the width and
height of the graphic (see Examples).
By default, treatment estimates and confidence intervals are plotted in the following way:
For an individual study, a square with treatment estimate in
the center and confidence interval as line extending either side
of the square (type.study = "square"
)
For metaanalysis results, a diamond with treatment estimate
in the center and right and left side corresponding to lower and
upper confidence limits (type.fixed = "diamond"
,
type.random = "diamond"
, and type.subgroup = "diamond"
)
In a forest plot, size of the squares typically reflects the precision of
individual treatment estimates based either on the fixed effect
(weight.study = "fixed"
) or random effects metaanalysis
(weight.study = "random"
). Information from metaanalysis object
x
is utilised if argument weight.study
is missing. Weights
from the fixed effect model are used if argument x$comb.fixed
is
TRUE
; weights from the random effects model are used if argument
x$comb.random
is TRUE
and x$comb.fixed
is FALSE
.
The same square sizes are used if weight.study = "same"
.
Arguments text.fixed
, text.random
, and
text.predict
can be used to change the label to identify
overall results (fixed effect and random effects model as well as
prediction interval). By default the following text is printed:
"Fixed effect model" (argument text.fixed
)
"Random effects model" (text.random
)
"Prediction interval" (text.predict
)
If confidence interval levels are different for individual studies,
metaanalysis, and prediction interval (arguments level
,
level.comb
, level.predict
in metaanalysis functions,
e.g., metabin
), additional information is printed,
e.g., " (99%CI)" for a 99% confidence interval in the
metaanalysis.
The following arguments can be used to print results for various statistical tests:
Argument  Statistical test 
test.overall.fixed 
Test for overall effect (fixed effect model) 
test.overall.random 
Test for overall effect (random effects model) 
test.effect.subgroup.fixed 
Test for effect in subgroup (FE model) 
test.effect.subgroup.random 
Test for effect in subgroup (RE model) 
test.subgroup.fixed 
Test for subgroup differences (FE model) 
By default, these arguments are FALSE
. R function
settings.meta
can be used to change this default for
the entire R session. For example, use the following command to
always print results of tests for an overall effect:
settings.meta(test.overall = TRUE)
The arguments leftcols
and rightcols
can be used to
specify columns which are plotted on the left and right side of the
forest plot, respectively. If argument rightcols
is
FALSE
, no columns will be plotted on the right side. By
default, i.e. if arguments leftcols
and rightcols
are
NULL
and layout = "meta"
, the following
columns will be printed on the right side
of the forest plot:
Metaanalysis results  Value of argument rightcols 
No summary  c("effect", "ci") 
Only fixed effect model  c("effect", "ci", "w.fixed")

Only random effects model  c("effect", "ci", "w.random")

By default, estimated treatment effect and corresponding confidence
interval will be printed. Depending on arguments comb.fixed
and comb.random
, weights of the fixed effect and/or random
effects model will be given too. For an object of class
metacum
or metainf
only the estimated
treatment effect with confidence interval are plotted.
Depending on the class of the metaanalysis object (which is defined by the R function used to generate the object) a different set of columns is printed on the left side of the forest plot:
Function  Value of argument leftcols 
metabin 
c("studlab", "event.e", "n.e",
"event.c", "n.c") 
metacont 
c("studlab", "n.e", "mean.e",
"sd.e", "n.c", "mean.c", "sd.c") 
metacor 
c("studlab", "n") 
metagen 
c("studlab", "TE", "seTE") 
metainc 
c("studlab", "event.e", "time.e",
"event.c", "time.c") 
metaprop 
c("studlab", "event", "n") 
metarate 
c("studlab", "event", "time")

metacum 
"studlab" 
The arguments leftlabs
and rightlabs
can be used to
specify column headings which are plotted on left and right side of
the forest plot, respectively. For certain columns predefined
labels exist. If the arguments leftlabs
and rightlabs
are NULL
, the following default labels will be used:
Column:  studlab 
TE 
seTE

n.e 
n.c 
n 
Label:  "Study"  "TE"  "seTE"  "Total"  "Total"  "Total" 
Column:  event.e 
event.c 
event 
mean.e 
mean.c 

Label:  "Events"  "Events"  "Events"  "Mean"  "Mean"  
Column:  sd.e 
sd.c 
time.e

time.c 

effect 
Label:  "SD"  "SD"  "Time"  "Time"  
x$sm 
Column:  ci 
effect.ci 
w.fixed 

w.random 
Column:  studlab 
TE 
seTE

For additional columns, the column name will be used as a label. It
is possible to only provide labels for new columns (see
Examples). Otherwise the length of leftlabs
and
rightlabs
must be the same as the number of printed columns,
respectively. The value NA
can be used to specify columns
which should use default labels (see Examples).
If argument layout = "RevMan5"
(and arguments leftcols
and
rightcols
are NULL
), the layout for forest plots used for
Cochrane reviews (which are generated with Review Manager 5,
https://training.cochrane.org/onlinelearning/coresoftwarecochranereviews/revman)
is reproduced:
All columns are printed on the left side of the forest plot
(see arguments leftcols
and rightcols
)
Tests for overall effect and subgroup differences are printed
(test.overall
, test.effect.subgroup
,
test.subgroup
)
Diamonds representing metaanalysis results are printed in
black (diamond.fixed
, diamond.random
)
Colour of squares depends on the metaanalysis object
(col.square
, col.square.lines
)
Information on effect measure and metaanalysis method is
printed above the forest plot (smlab
)
Label "Study or Subgroup" is printed for metaanalysis with
subgroups (leftlabs
)
If argument layout = "JAMA"
(and arguments leftcols
and
rightcols
are NULL
), instructions for authors of the
Journal of the American Medical Association, see
http://jamanetwork.com/journals/jama/pages/instructionsforauthors,
are taken into account:
Graph labels on right and left side are printed in bold font
at top of forest plot (see arguments bottom.lr
and
ff.lr
)
Information on effect measure and level of confidence
interval is printed at bottom of forest plot (xlab
)
Tests for overall effect are printed (test.overall
)
Diamonds representing metaanalysis results are printed in
lightblue (diamond.fixed
, diamond.random
)
Squares representing individual study results are printed in
darkblue (col.square
, col.square.lines
)
Betweenstudy variance \(\tau^2\) is not printed
Empty rows are omitted (addrow
)
Label "Source" is printed instead of "Study" (leftlabs
)
Pvalues are printed without leading zeros (zero.pval
)
Pvalues are rounded to three digits (for 0.001 < p \(\le\)
0.01) or two digits (p > 0.01) (JAMA.pval
)
The following changes are conducted if argument
layout = "subgroup"
(and arguments leftcols
and
rightcols
are NULL
) and a subgroup analysis was
conducted:
Individual study results are omitted (see argument
study.results
)
Total number of observations is not printed
(pooled.totals
)
Label "Subgroup" is printed instead of "Study"
(leftlabs
)
If arguments lab.e
and lab.c
are NULL
,
"Experimental" and "Control" are used as labels for experimental
and control group, respectively.
Argument pscale
can be used to rescale single proportions or
risk differences, e.g., pscale = 1000
means that proportions
are expressed as events per 1000 observations. This is useful in
situations with (very) low event probabilities.
Argument irscale
can be used to rescale single rates or rate
differences, e.g., irscale = 1000
means that rates are
expressed as events per 1000 time units, e.g., personyears. This is
useful in situations with (very) low rates. Argument irunit
can be used to specify the time unit used in individual studies
(default: "personyears"). This information is printed in summaries
and forest plots if argument irscale
is not equal to 1.
A prediction interval for treatment effect of a new study (Higgins
et al., 2009) is given in the forest plot if arguments
prediction
and comb.random
are TRUE
. For
graphical presentation of prediction intervals the approach by
Guddat et al. (2012) is used.
Argument hetstat
can be a character string to specify where
to print heterogeneity information:
row with results for fixed effect model (hetstat =
"fixed"
),
row with results for random effects model (hetstat =
"random"
).
Otherwise, information on heterogeneity is printed in dedicated rows.
Note, in R package meta, version 3.00 the following
arguments have been removed from R function forest.meta: byvar,
level, level.comb, level.predict. This functionality is now
provided by R function update.meta
(or directly in R
functions, e.g., metabin
, metacont
,
metagen
, metacor
, and
metaprop
).
Guddat C, Grouven U, Bender R, Skipka G (2012): A note on the graphical presentation of prediction intervals in randomeffects metaanalyses. Systematic Reviews, 1, 34
Higgins JPT, Thompson SG, Spiegelhalter DJ (2009): A reevaluation of randomeffects metaanalysis. Journal of the Royal Statistical Society: Series A, 172, 13759
# NOT RUN {
data(Olkin1995)
m1 < metabin(ev.exp, n.exp, ev.cont, n.cont,
data = Olkin1995, subset = c(41, 47, 51, 59),
sm = "RR", method = "I",
studlab = paste(author, year))
# }
# NOT RUN {
# Do standard (symmetric) forest plot
#
forest(m1)
# }
# NOT RUN {
# Layout of forest plot similar to Review Manager 5
#
# Furthermore, add labels on both sides of forest plot and
# prediction interval
#
forest(m1, layout = "RevMan5", comb.fixed = FALSE,
label.right = "Favours control", col.label.right = "red",
label.left = "Favours experimental", col.label.left = "green",
prediction = TRUE)
# }
# NOT RUN {
# Create a PDF file forestm1.pdf with the forest plot
#
pdf("forestm1.pdf", width = 10, height = 3)
forest(m1)
dev.off()
# Sort studies by decreasing treatment effect within year subgroups
#
m2 < update(m1, byvar = ifelse(year < 1987,
"Before 1987", "1987 and later"),
print.byvar = FALSE)
forest(m2, sortvar = TE, comb.random = FALSE)
# Forest plot specifying argument xlim
#
forest(m1, xlim = c(0.01, 10))
# Print results of test for overall effect
#
forest(m1, test.overall.fixed = TRUE, test.overall.random = TRUE)
# Forest plot with 'classic' layout used in R package meta,
# version < 1.60
#
forest(m1, col.square = "black", hetstat = FALSE)
# Change set of columns printed on left side of forest plot
#
forest(m1, comb.random = FALSE, leftcols = "studlab")
# Do not print columns on right side of forest plot
#
forest(m1, rightcols = FALSE)
# Change study label to "Author"
#
forest(m1, comb.random = FALSE, leftlabs = c("Author", NA, NA, NA, NA))
# Just give effect estimate and 95% confidence interval on right
# side of forest plot (in one column)
#
forest(m1, rightcols = c("effect.ci"))
# Just give effect estimate and 95% confidence interval on right
# side of forest plot
#
forest(m1, rightcols = c("effect", "ci"))
# 1. Change order of columns on left side
# 2. Attach labels to columns 'event.e' and 'event.c' instead of
# columns 'n.e' and 'n.c'
#
forest(m1,
leftcols = c("studlab", "n.e", "event.e", "n.c", "event.c"),
lab.e.attach.to.col = "event.e",
lab.c.attach.to.col = "event.c")
# Specify column labels only for variables 'year' and 'author'
# (and define digits for additional variables)
#
forest(m1,
leftcols = c("studlab", "event.e", "n.e", "event.c", "n.c",
"author", "year"),
leftlabs = c("Author", "Year of Publ"))
# Center text in all columns
#
forest(m1,
leftcols = c("studlab", "event.e", "n.e", "event.c", "n.c",
"author", "year"),
leftlabs = c("Author", "Year of Publ"), hetstat = FALSE,
just = "center", just.addcols = "center", just.studlab = "center")
# Same result
#
forest(m1,
leftcols = c("studlab", "event.e", "n.e", "event.c", "n.c",
"author", "year"),
leftlabs = c("Author", "Year of Publ"), hetstat = FALSE,
just = "c", just.addcols = "c", just.studlab = "c")
# Change some fontsizes and fontfaces
#
forest(m1,
fs.study = 10, ff.study = "italic",
fs.study.label = 11, ff.study.label = "bold",
fs.axis = 5, ff.axis = "italic",
ff.smlab = "bold.italic",
ff.fixed = "plain", ff.hetstat = "plain")
# Change some colours
#
forest(m1,
col.diamond = "green", col.diamond.lines = "red",
col.study = c("green", "blue", "red", "orange"),
col.square = "pink", col.square.lines = "black")
# Sort by weight in fixed effect model
#
forest(m1, sortvar = 1 / w.fixed, comb.random = FALSE)
# Sort by decreasing weight in fixed effect model
#
forest(m1, sortvar = 1 / w.fixed, comb.random = FALSE)
# Sort by size of treatment effect
#
forest(m1, sortvar = TE, comb.random = FALSE)
# Sort by size of treatment effect
#
forest(m1, sortvar = TE, comb.random = FALSE)
# Sort by decreasing year of publication
#
forest(m1, sortvar = year, comb.random = FALSE)
# Print results of test for subgroup differences (random effects
# model)
#
forest(m2,
sortvar = TE, comb.fixed = FALSE,
test.subgroup.random = TRUE)
# Print only subgroup results
#
forest(m2, layout = "subgroup")
# Print only subgroup results (and consider text for heterogeneity
# measures in width of subgroup column)
#
forest(m2, layout = "subgroup", calcwidth.hetstat = TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataCamp Workspace