Learn R Programming

meta (version 9.0-0)

forest.meta: Forest plot to display the result of a meta-analysis

Description

Draw a forest plot (using grid graphics system) in the active graphics window or store the forest plot in a file.

Usage

# S3 method for meta
forest(
  x,
  sortvar,
  studlab = TRUE,
  layout = gs("layout"),
  data.pooled = NULL,
  common = x$common,
  random = x$random,
  prediction = x$prediction,
  overall = x$overall,
  overall.hetstat = x$overall.hetstat & !inherits(x, "metamerge"),
  hetstat = common | random | overall.hetstat,
  resid.hetstat = gs("resid.hetstat"),
  subgroup = TRUE,
  subgroup.hetstat = subgroup & (is.character(hetstat) || hetstat),
  common.subgroup = common,
  random.subgroup = random,
  prediction.subgroup = x$prediction.subgroup,
  subgroup.name = x$subgroup.name,
  sep.subgroup = x$sep.subgroup,
  sort.subgroup = gs("sort.subgroup"),
  study.results = gs("study.results"),
  allstudies = TRUE,
  weight.study = NULL,
  test = NULL,
  LRT = gs("LRT"),
  leftcols = gs("leftcols"),
  rightcols = gs("rightcols"),
  leftlabs = gs("leftlabs"),
  rightlabs = gs("rightlabs"),
  label,
  hetlab = gs("hetlab"),
  resid.hetlab = gs("resid.hetlab"),
  lab.NA = gs("lab.NA"),
  lab.NA.effect = gs("lab.NA.effect"),
  lab.NA.weight = gs("lab.NA.weight"),
  rob = NULL,
  fontfamily = gs("fontfamily"),
  fontsize = gs("fontsize"),
  fs = NULL,
  ff = NULL,
  just = NULL,
  fill = NULL,
  col = NULL,
  print = NULL,
  type = NULL,
  pooled = NULL,
  text = NULL,
  lty = NULL,
  lwd = NULL,
  digits = NULL,
  calcwidth = NULL,
  colgap = NULL,
  ref,
  cid = NULL,
  xlab = NULL,
  xlab.pos,
  smlab = NULL,
  smlab.pos,
  xlim,
  at = NULL,
  bottom.lr = gs("bottom.lr"),
  details = gs("forest.details"),
  header.line,
  addrow = NULL,
  addrows.below.overall = gs("addrows.below.overall"),
  arrow.type = gs("arrow.type"),
  arrow.length = gs("arrow.length"),
  spacing = gs("spacing"),
  squaresize = if (layout == "BMJ") 0.9/spacing else 0.8/spacing,
  plotwidth = if (layout %in% c("BMJ", "JAMA")) "8cm" else "6cm",
  bmj.text = NULL,
  bmj.sep = " / ",
  backtransf = x$backtransf,
  big.mark = gs("big.mark"),
  pscale = x$pscale,
  irscale = x$irscale,
  irunit = x$irunit,
  scientific.pval = gs("scientific.pval"),
  zero.pval = if (layout == "JAMA") FALSE else gs("zero.pval"),
  JAMA.pval = if (layout == "JAMA") TRUE else gs("JAMA.pval"),
  main,
  main.prefix = gs("main.prefix"),
  xpos.main = gs("xpos.main"),
  gap.main = gs("gap.main"),
  lineheight.main = gs("lineheight.main"),
  filename = NULL,
  path = NULL,
  device = NULL,
  device.args = NULL,
  units = "in",
  height = NULL,
  width = NULL,
  dpi = 300,
  dev.off = NULL,
  new = TRUE,
  rows.gr = NULL,
  warn.deprecated = gs("warn.deprecated"),
  ...
)

# S3 method for meta plot(x, ...)

.forestArgs()

Value

Invisibly returns a list with information about the forest plot, including the selected columns (leftcols, rightcols), their headings (leftlabs, rightlabs), formatted results, and graphical settings (see Examples).

Arguments

x

An object of class meta.

sortvar

An optional vector used to sort the individual studies (must be of same length as x$TE).

studlab

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 the vector with estimates x$TE).

layout

A character string specifying the layout of the forest plot (see Details).

data.pooled

Data set with information for line(s) with pooled results (see Details).

common

A logical indicating whether common effect estimate should be plotted.

random

A logical indicating whether random effects estimate should be plotted.

prediction

A logical indicating whether a prediction interval should be printed.

overall

A logical indicating whether overall summaries should be plotted. This argument is useful in a meta-analysis with subgroups if summaries should only be plotted on group level.

overall.hetstat

A logical value indicating whether to print heterogeneity measures for overall treatment comparisons. This argument is useful in a meta-analysis with subgroups if heterogeneity statistics should only be printed on subgroup level.

hetstat

Either a logical value indicating whether to print results for heterogeneity measures at all or a character string (see Details).

resid.hetstat

A logical value indicating whether to print measures of residual heterogeneity in a meta-analysis with subgroups.

subgroup

A single logical or logical vector indicating whether / which subgroup results should be shown in forest plot. This argument is useful in a meta-analysis with subgroups if summaries should not be plotted for (some) subgroups.

subgroup.hetstat

A single logical or logical vector indicating whether / which information on heterogeneity in subgroups should be shown in forest plot. This argument is useful in a meta-analysis with subgroups if heterogeneity statistics should not be printed for (some) subgroups.

common.subgroup

A single logical or logical vector indicating whether / which common effect estimates should be printed for subgroups.

random.subgroup

A single logical, logical vector, or logical matrix indicating whether / which random effects estimates should be printed for subgroups.

prediction.subgroup

A single logical, logical vector, or logical matrix indicating whether / which prediction intervals should be printed for subgroups.

subgroup.name

A character string with a label for the grouping variable.

sep.subgroup

A character string defining the separator between label and levels of grouping variable.

sort.subgroup

A logical indicating whether groups should be ordered alphabetically.

study.results

A logical indicating whether results for individual studies should be shown in the figure (useful to only plot subgroup results).

allstudies

A logical indicating whether studies with inestimable treatment effects should be included in the forest plot.

weight.study

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", "common", or "random", can be abbreviated. Plot symbols have the same size for all studies or represent study weights from common effect or random effects model.

test

A named list specifying which results of statistical tests should be printed; see meta-formatting.

LRT

A logical value indicating whether to report Likelihood-Ratio or Wald-type test of heterogeneity for generalised linear mixed models.

leftcols

A character vector specifying (additional) columns to be printed on the left side of the forest plot or a logical value (see Details).

rightcols

A character vector specifying (additional) columns to be printed on the right side of the forest plot or a logical value (see Details).

leftlabs

A character vector specifying labels for (additional) columns on left side of the forest plot (see Details).

rightlabs

A character vector specifying labels for (additional) columns on right side of the forest plot (see Details).

label

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 named list can also be supplied to specify column labels; see meta-formatting.

hetlab

Label printed in front of results for heterogeneity measures.

resid.hetlab

Label printed in front of results for residual heterogeneity measures.

lab.NA

A character string to label missing values.

lab.NA.effect

A character string to label missing values in individual treatment estimates and confidence intervals.

lab.NA.weight

A character string to label missing weights.

rob

Risk-of-bias (RoB) assessment, or a named list specifying the assessment, table heading, legend, and right-side display; see meta-formatting.

fontfamily

The font family, see gpar.

fontsize

The size of text (in points), see gpar.

fs

A named list specifying font sizes for elements of the forest plot; see meta-formatting.

ff

A named list specifying fontfaces for elements of the forest plot; see meta-formatting.

just

A named list specifying justification settings; a character string is also accepted for the common justification. See meta-formatting.

fill

A named list specifying fill settings; a scalar value is also accepted. See meta-formatting.

col

A named list specifying colours used in the forest plot; see meta-formatting.

print

A named list specifying which information to print in the forest plot; see meta-formatting.

type

A named list specifying graphical types for study, pooled, and subgroup results; see meta-formatting.

pooled

A named list specifying pooled totals and event/time settings; see meta-formatting.

text

A named list specifying text for pooled results, subgroup results, and additional lines; see meta-formatting.

lty

A named list specifying line types; see meta-formatting.

lwd

The line width, see par, or a named list specifying line widths; see meta-formatting.

digits

A named list specifying digits used for displayed results; a scalar value is also accepted. See meta-formatting.

calcwidth

A named list specifying which text is considered when calculating column widths; see meta-formatting.

colgap

A named list specifying gaps between columns; a scalar value is also accepted. See meta-formatting.

ref

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.

cid

A numeric value or vector, or a named list specifying clinically important differences (CID) / decision thresholds used to calculate probabilities of clinically important benefit or harm, or not important effects (see Details); see meta-formatting.

xlab

A label for the x-axis. By default, no label is printed, except for meta-analyses of single proportions, incidence rates, risk differences, or rate differences if proportions or rates are expressed as events per a specified number of observations or time units using pscale or irscale.

xlab.pos

A numeric specifying the center of the label on the x-axis.

smlab

A label for the summary measure (printed at top of figure). By default, no label is printed for single proportions or incidence rates.

smlab.pos

A numeric specifying the center of the label for the summary measure.

xlim

The x limits (min,max) of the plot, or the character string "symmetric" to produce symmetric forest plots.

at

The points at which tick-marks are to be drawn, see grid.xaxis.

bottom.lr

A logical indicating whether labels on right and left side should be printed at bottom or top of forest plot.

details

A logical specifying whether details on statistical methods should be printed.

header.line

A logical value indicating whether to print a header line or a character string ("both", "below", "").

addrow

A logical value indicating whether an empty row is printed above study results, or a named list specifying row-spacing settings; see meta-formatting.

addrows.below.overall

A numeric value indicating how many empty rows are printed between meta-analysis results and heterogeneity statistics and test results.

arrow.type

A character string indicating whether arrows printed for results outside the forest plot should be "open", or "closed", can be abbreviated.

arrow.length

The length of arrows in inches.

spacing

A numeric determining line spacing in a forest plot.

squaresize

A numeric used to increase or decrease the size of squares in the forest plot.

plotwidth

Either a character string, e.g., "8cm", "60mm", or "3inch", or a unit object specifying width of the forest plot.

bmj.text

A character string used in the plot with BMJ layout to label the group specific information.

bmj.sep

A character string used to separate sample sizes from number of events or means / standard deviations.

backtransf

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.

big.mark

A character used as thousands separator.

pscale

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".

irscale

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".

irunit

A character specifying the time unit used to calculate rates, e.g., person-years.

scientific.pval

A logical specifying whether p-values should be printed in scientific notation, e.g., 1.2345e-01 instead of 0.12345.

zero.pval

A logical specifying whether p-values should be printed with a leading zero.

JAMA.pval

A logical specifying whether p-values for test of overall effect should be printed according to JAMA reporting standards.

main

A title for the forest plot (see Details).

main.prefix

A logical indicating whether to add a pre-defined prefix to title lines (see Details).

xpos.main

Horizontal position of title.

gap.main

Number of empty rows between title and column headings.

lineheight.main

Line height for the main title, see gpar.

filename

File name to store forest plot.

path

Path of the directory to save plot to: `path` and `filename` are combined to create the fully qualified file name. Defaults to the working directory.

device

Device to use. Can either be a device function (e.g., png), or one of "eps", "ps", "tex" (pictex), "pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (Windows only). By default, the device is guessed based on the `filename` extension.

device.args

List with additional graphical parameters passed on to graphics function.

units

Units of the `width` and `height` of the file containing the forest plot. One of "in" (for inches, default), "cm", "mm", or "px" (for pixels), can be abbreviated.

height

Height of the graphics file.

width

Width of the graphics file.

dpi

Plot resolution.

dev.off

A logical to specify whether current graphics device should be shut down.

new

A logical value indicating whether a new figure should be printed in an existing graphics window.

rows.gr

Deprecated argument to add rows to the forest plot to change the height of the graphics file; only provided for backward compatibility.

warn.deprecated

A logical indicating whether warnings should be printed if deprecated arguments are used.

...

Additional graphical arguments.

Author

Guido Schwarzer [email protected], Nour Edin Darwish [email protected]

Details

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. Resize the graphics windows if the forest plot is too large or too small for the graphics window. Alternatively, save the forest plot in a file.

Formatting defaults

Defaults for the named formatting lists test, label, rob, fs, ff, just, fill, col, print, type, pooled, text, lty, lwd, digits, calcwidth, colgap, cid, and addrow are described in meta-formatting.

Saving forest plots

A forest plot can be directly stored in a file using argument filename. The R function for the graphics device driver can be specified using argument device, e.g., device = "cairo_pdf" or device = cairo_pdf. If only the filename is provided, the extension of the filename is checked and matched against the most common graphics device drivers:

ExtensionGraphics device
.pdfpdf
.pspostscript
.svgsvg or svglite if the R package svglite is available
.bmpbmp
.jpg / .jpegjpeg
.pngpng
.tif / .tifftiff

If only argument device is provided, the filename will be equal to "Rplots.device".

By default, the file dimensions are determined automatically (values .height and .width). Automatic sizing is recommended for most forest plots.

Arguments height and width can adjust these dimensions. For example, width = .width * 1.05 increases the automatically determined width by 5 percent. Absolute dimensions can also be supplied, e.g., width = 10 for a file with a width of 10 inches. Setting either argument to NA uses the corresponding dimension of the current graphics device.

The deprecated argument rows.gr uses a different approach to determine file height and is retained only for backward compatibility.

Set dev.off = FALSE to keep the graphics device open and add further forest plots to the same file. Afterwards, call dev.off to close the device and finalize the file.

Additional arguments to the graphics device function can be supplied as a named list in device.args.

Default forest plot layout

By default, treatment estimates and confidence intervals are plotted in the following way. The plot types can be specified with the named list type; see meta-formatting for the available list elements. The individual arguments type.study, type.common, type.random, type.subgroup, type.subgroup.common, and type.subgroup.random are also supported.

  • For an individual study, a square with treatment estimate in the center and confidence interval as a line extending either side of the square (type.study = "square")

  • For overall meta-analysis results, a diamond is used by default (type.common = "diamond" and type.random = "diamond").

  • For subgroup results, a diamond is used by default if individual study results are shown; otherwise, a square is used (type.subgroup, type.subgroup.common, type.subgroup.random, and study.results).

In a forest plot, size of the squares typically reflects the precision of individual treatment estimates based either on the common effect (weight.study = "common") or random effects meta-analysis (weight.study = "random"). Information from meta-analysis object x is utilised if argument weight.study is missing. Weights from the common effect model are used if argument x$common is TRUE; weights from the random effects model are used if argument x$random is TRUE and x$common is FALSE. The same square sizes are used if weight.study = "same".

If prediction = TRUE, a prediction interval for the treatment effect in a new study is shown (Higgins et al., 2009). The interval is displayed as a bar, following Guddat et al. (2012).

Columns printed on left side of forest plot

Argument leftcols specifies the columns printed on the left side of the forest plot. If leftcols = NULL and layout = "meta", the following columns are printed by default. These column names can be used in leftcols or rightcols:

ColumnDescription
"studlab"study labels
...outcome-specific columns
"w.common"weights from the common effect model, if applicable
"w.random"weights from the random-effects model, if applicable
"effect"estimated effect in the study
"ci"confidence interval for the estimated effect

For three-level models, the cluster variable is printed next to the study labels. Use "cluster" in leftcols to select this column, for example, to change the order of variables.

The following outcome-specific columns are printed, depending on the function used to create the meta-analysis object:

FunctionDefault outcome-specific columns
metabin"event.e", "n.e", "event.c", "n.c"
metacont"n.e", "mean.e", "sd.e", "n.c", "mean.c", "sd.c"
metacor"n"
metagen"TE", "seTE"
metainc"event.e", "time.e", "event.c", "time.c"
metamean"n", "mean", "sd"
metaprop"event", "n"
metarate"event", "time", "n"

By default, study labels and labels for pooled estimates and heterogeneity statistics will be printed in the first column on the left side of the forest plot. The character string "studlab" is used to identify study labels as this is the name of the list element of a meta-analysis object.

If the character string "studlab" is not provided in either leftcols or rightcols, the first additional variable specified by the user is used as the study labels. Labels for pooled estimates are also printed in this column. Additional variables are variables not listed among the predefined column names below. For example, leftcols = "studlab" and leftcols = "study" produce the same forest plot if "study" contains the study labels used in the meta-analysis. If no additional variable is provided, no study labels are printed.

Columns printed on right side of forest plot

Argument rightcols can be used to specify columns printed on the right side of the forest plot. By default, if rightcols is NULL and layout = "meta", no columns are printed on the right side; internally, rightcols is set to FALSE.

Previous default forest plot layout (layout = "meta8")

If layout = "meta8" is specified and both leftcols and rightcols are NULL, the previous default forest plot layout is used.

The following columns are printed on the left side of the forest plot. These column names can also be used in argument leftcols or rightcols:

ColumnDescription
"studlab"study labels
...outcome-specific columns

See the section on the default forest plot layout (layout = "meta") for the outcome-specific columns.

The following columns are printed on the right side of the forest plot:

ColumnDescription
"effect"estimated effect in the study
"ci"confidence interval for the estimated effect
"w.common"weights from the common effect model, if applicable
"w.random"weights from the random effects model, if applicable

Predefined columns and column labels

The arguments leftlabs and rightlabs can be used to specify column headings which are printed on the left or right side of the forest plot. For certain columns predefined labels exist which are used by default, i.e., if arguments leftlabs and rightlabs are NULL:

Column:n.e, n.c, nmean.e, mean.c, meansd.e, sd.c, sd
Label:gs("label.n")gs("label.mean")gs("label.sd")
Column:event.e, event.c, eventtime.e, time.c, timecor
Label:gs("label.events")gs("label.time")gs("label.cor")
Column:effectcieffect.ci
Label:x$smx$level"% CI"effect+ci
Column:clustercyclesLabel:
gs("label.cluster")gs("label.cycles")Column:pval
statisticLabel:gs("label.pval")"z", "t", or "z|t"
Column:tau2tauI2
Label:gs("label.tau2")gs("label.tau")gs("label.I2")

For the columns studlab (study labels), TE (treatment estimates), seTE (standard errors of treatment estimates), w.common (weights under the common effect model), and w.random (weights under the random effects model), context-specific column labels are used.

For other columns, the column name will be used as a label if no column label is defined. 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. The value NA can be used to specify columns which should use default labels (see Examples).

In pairwise meta-analysis comparing two groups (i.e., metabin, metacont, metainc, and metagen depending on the outcome), arguments label.e and label.c are used to label columns belonging to the two treatment groups. By default, labels defined in the meta-analysis object are used. The columns where treatment labels are attached can be changed using arguments label.e.attach and label.c.attach.

Spacing and width calculation

Information on heterogeneity measures and statistical tests is printed below the meta-analysis results. Argument addrows.below.overall can be used to specify the number of empty rows between these results and the information below them. By default, no extra space is added.

The width of information printed in the leftmost column is automatically included when calculating the width of the forest plot. Consequently, this information does not overlap with the forest plot or x-axis by default. The automatic calculation can be disabled using the relevant elements of calcwidth; see meta-formatting. Gaps between columns and plot elements can be adjusted with the named list colgap or the corresponding individual arguments.

The widths of x-axis tick labels, smlab, xlab, label.left, and label.right are also considered automatically. Additional space is allocated through the corresponding forest-plot gaps to avoid overlap with columns, statistics, details, or other plot elements. User-specified values supplied through either the colgap list elements forest.left and forest.right or the individual arguments colgap.forest.left and colgap.forest.right take precedence over the automatic calculation.

Title of forest plot

A title for the forest plot can be provided via argument main. If main is not specified, the title is generated from the general title, comparison label, and outcome label, i.e., the title, complab, and outclab components of meta-analysis object x.

If main.prefix = TRUE (the default), the prefixes "Review:", "Comparison:", and "Outcome:" are added automatically to the corresponding title lines. This can be prevented by setting title.prefixes = FALSE.

Risk of bias assessment

A risk of bias (RoB) assessment can be shown in the forest plot by either using a meta-analysis object with an RoB assessment as main input or providing a suitable object created with rob. Argument rob = FALSE can be used to suppress the print of the risk of bias information.

RoB assessments are shown as the only information on the right side of the forest plot if argument rob.only = TRUE. In this case, arguments rightcols and rightlabs are ignored. Predefined columns shown by default on the right side of a forest plot will be moved to the left side.

Note, the column names for risk of bias domains cannot be changed with argument rightlabs. You have to manually change the column names in the risk of bias data set, i.e., list element 'rob' in the meta-analysis object.

Information on heterogeneity and statistical tests

Argument hetstat can be a character string to specify where to print heterogeneity information:

  • row with results for common effect model (hetstat = "common"),

  • row with results for random effects model (hetstat = "random").

Otherwise, information on heterogeneity measures is printed below the meta-analysis results if argument overall.hetstat = TRUE (default). The heterogeneity measures to print can be specified (see list of arguments following overall.hetstat).

In addition, results for various statistical tests can be printed using the named list test; see meta-formatting for the available list elements. The individual arguments test.overall, test.overall.common, test.overall.random, test.subgroup, test.subgroup.common, test.subgroup.random, test.effect.subgroup, test.effect.subgroup.common, and test.effect.subgroup.random are also supported:

ArgumentStatistical test
test.overall.commonTest for overall effect (common effect model)
test.overall.randomTest for overall effect (random effects model)
test.effect.subgroup.commonTest for effect in subgroup (CE model)
test.effect.subgroup.randomTest for effect in subgroup (RE model)
test.subgroup.commonTest for subgroup differences (CE model)
test.subgroup.randomTest for subgroup differences (RE model)

By default, tests for an overall effect and tests for subgroup differences are printed if the corresponding models or subgroup analyses are available. Tests can be suppressed with the relevant arguments. R function settings.meta can be used to change this default for the entire R session.

Highlight regions corresponding to minimal clinically important differences

Regions corresponding to minimal clinically important differences can be added to the forest plot using either argument cid or cid.below.null and cid.above.null. Input for the later arguments will be ignored if argument cid was specified. In this case, the values of cid.below.null and cid.above.null will be equal to

  • cid and 1 / cid for ratio measures,

  • cid and -cid for difference measures.

Thresholds based on argument cid will always be symmetric. Asymmetric thresholds can be defined using arguments cid.below.null and cid.above.null.

Flexible printing of subgroup results

Argument subgroup determines whether summary results are printed for subgroups. A logical vector of length equal to the number of subgroups can be provided to determine which subgroup summaries are printed. By default, only subgroup results based on at least two studies are printed which is identical to use argument subgroup = k.w > 1. The order of the logical vector corresponds to the order of subgroups in list element 'subgroup.levels' of a meta-analysis object. Argument subgroup = k.w >= 1 can be used to show results for all subgroups (including those with a single study).

The following arguments can be used in a similar way:

  • subgroup.hetstat (heterogeneity statistic in subgroups),

  • common.subgroup (common effect estimates in subgroups),

  • random.subgroup (random effects estimates in subgroups),

  • prediction.subgroup (prediction interval in subgroups),

  • test.effect.subgroup (test for effect in subgroups),

  • test.effect.subgroup.common (test for effect in subgroups, common effect model),

  • test.effect.subgroup.random (test for effect in subgroups, random effects model).

Data set with information to print with overall results

Argument data.pooled can be used to provide information printed in the line(s) with overall results, i.e., for the common effect or random effects model. Input must be a data frame with variable names equal to those provided in arguments leftcols or rightcols. Only variables for additional variables are considered.

It is possible to provide a row in data set data.pooled for each common effect or random effects estimate. The order in the data set corresponds to the order of common effect and random effects estimates in the forest plot, i.e., common effect followed by random effects estimates. If the data set contains a single row, the value provided for a variable is considered for all printed common effect and random effects estimates

In meta-analyses with subgroups, a row must be provided in data set data.pooled for each overall common effect or random effects estimate, followed by common effect or random effects estimates within subgroups. The order for subgroup results is the same as see in the forest plot.

Additional general settings

The named list text can be used to change labels identifying overall results (common-effect and random-effects models) and prediction intervals; see meta-formatting for the available list elements. The individual arguments text.common, text.random, and text.predict are also supported. By default, the following text is printed:

  • "Common effect model" (argument text.common)

  • "Random effects model" (text.random)

  • "Prediction interval" (text.predict)

If confidence interval levels are different for individual studies, meta-analysis, and prediction interval (arguments level, level.ma, level.predict in meta-analysis functions, e.g., metabin), additional information is printed, e.g., " (99% CI)" for a 99% confidence interval in the meta-analysis.

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., person-years. This is useful in situations with (very) low rates. Argument irunit can be used to specify the time unit used in individual studies (default: "person-years"). This information is printed in summaries and forest plots if argument irscale is not equal to 1.

Forest plots in RevMan5 layout

If argument layout = "RevMan5" (and arguments leftcols and rightcols are NULL), the layout for forest plots used for Cochrane reviews (which were generated with Review Manager 5) is reproduced:

  1. All columns are printed on the left side of the forest plot (see arguments leftcols and rightcols)

  2. The main title is left aligned (just.main)

  3. Tests for overall effect and subgroup differences are printed (test.overall, test.subgroup)

  4. Diamonds representing meta-analysis results are printed in black (col.diamond.common, col.diamond.random)

  5. Colour of squares depends on the meta-analysis object (col.square, col.square.lines)

  6. Information on effect measure and meta-analysis method is printed above the forest plot (smlab)

  7. Label "Study or Subgroup" is printed for meta-analysis with subgroups (leftlabs)

  8. Details on meta-analysis methods are not printed (details)

Forest plots in JAMA layout

If argument layout = "JAMA" (and arguments leftcols and rightcols are NULL), instructions for authors of the Journal of the American Medical Association are taken into account:

  1. All columns are printed on the left side of the forest plot (see arguments leftcols and rightcols)

  2. The main title is left aligned (just.main)

  3. Graph labels on right and left side are printed in bold font at top of forest plot (see arguments bottom.lr and ff.lr)

  4. Information on effect measure and level of confidence interval is printed at bottom of forest plot (xlab)

  5. Tests for overall effect are printed (test.overall)

  6. Diamonds representing meta-analysis results are printed in lightblue (col.diamond.common, col.diamond.random)

  7. Squares representing individual study results are printed in darkblue (col.square, col.square.lines)

  8. Between-study variance \(\tau^2\) is not printed

  9. Empty rows are omitted (addrow, addrow.overall, addrow.subgroups)

  10. Label "Source" is printed instead of "Study" (leftlabs)

  11. P-values are printed without leading zeros (zero.pval)

  12. P-values are rounded to three digits (for 0.001 < p \(\le\) 0.01) or two digits (p > 0.01) (JAMA.pval)

  13. Details on meta-analysis methods are not printed (details)

Study labels according to JAMA guidelines can be generated using labels.meta.

Forest plots in BMJ layout

If argument layout = "BMJ" (and arguments leftcols and rightcols are NULL), the following features of forest plots for the British Medical Journal are taken into account:

  1. Columns are printed on the left and right side of the forest plot (see arguments leftcols and rightcols)

  2. The main title is center aligned (just.main)

  3. Combined treatment-group headers are centered over both columns for binary outcomes, continuous outcomes, and incidence rates

  4. Prediction intervals are shown if requested (prediction)

  5. Tests for overall effect and subgroup differences are printed (test.overall, test.subgroup)

  6. Details on meta-analysis methods are not printed (details)

Forest plots showing results of subgroups

The following changes are conducted if argument layout = "subgroup" (and arguments leftcols and rightcols are NULL) and a subgroup analysis was conducted:

  1. Individual study results are omitted (see argument study.results)

  2. Total number of observations is not printed (pooled.totals)

  3. Label "Subgroup" is printed instead of "Study" (leftlabs)

References

Guddat C, Grouven U, Bender R, Skipka G (2012): A note on the graphical presentation of prediction intervals in random-effects meta-analyses. Systematic Reviews, 1, 34

Higgins JPT, Thompson SG, Spiegelhalter DJ (2009): A re-evaluation of random-effects meta-analysis. Journal of the Royal Statistical Society: Series A, 172, 137-59

See Also

meta-formatting, metabin, metacont, metagen, forest.metabind, settings.meta, labels.meta

Examples

Run this code
data(Olkin1995)
ma1 <- 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))


if (FALSE) {
# Draw a forest plot with the default layout
#
forest(ma1)
}

# Review Manager 5 layout with directional labels, a prediction interval,
# and a main title
#
forest(ma1, layout = "RevMan5", common = FALSE,
  label = list(left = "Favours experimental", right = "Favours control"),
  col = list(label.left = "green", label.right = "red"),
  prediction = TRUE,
  main = paste("Meta-analysis on Thrombolytic Therapy",
               "after Acute Myocardial Infarction"))

if (FALSE) {
#
# Save forest plots to files
#

# 1) Specify a filename; the ".pdf" extension selects pdf()
#    The height and width are determined automatically
#
forest(ma1, filename = "forest-ma1-1.pdf")

# 2) Specify only the device; svg() creates "Rplots.svg"
#
forest(ma1, device = "svg")

# 3) Set the PDF metadata title and the plot background colour
#
forest(ma1, filename = "forest-ma1-2.pdf",
  device.args = list(title = "Forest plot created with R package meta",
    bg = "green"))

# 4) Specify the width and height in inches
#
forest(ma1, filename = "forest-ma1-3.pdf", width = 10, height = 3)

#
# More forest plots
#

# Mark equivalence limits at 0.75 and 1 / 0.75
#
forest(ma1, layout = "RevMan5", common = FALSE,
  cid = 0.75, fill = list(fill = "lightgray", cid = "white"))

# Shade regions indicating beneficial and harmful effects
#
forest(ma1, layout = "RevMan5", common = FALSE,
  cid = 0.75,
  fill = list(fill = "lightgray", cid = "white",
    cid.below.null = "green", cid.above.null = "red"),
  label = list(left = "Desirable effect", right = "Undesirable effect"))

# Define thresholds for small, moderate, and large effects
# and shade the corresponding regions using hcl.colors()
#
thresholds <- c(0.25, 0.5, 0.75)
n.cols <- length(thresholds)
#
forest(ma1, layout = "RevMan5", common = FALSE,
  cid.below.null = thresholds, cid.above.null = 1 / rev(thresholds),
  fill = list(
    cid.below.null = hcl.colors(n.cols, palette = "Blues 2", alpha = 0.6),
    cid.above.null = hcl.colors(n.cols, palette = "Oranges", alpha = 0.6,
      rev = TRUE)),
  lty = list(cid = 3), col = list(cid = "darkgray"),
  label = list(left = "Desirable effect", right = "Undesirable effect"))

# Specify the limits of the horizontal axis
#
forest(ma1, xlim = c(0.01, 10))

# Show tests for overall effects
#
forest(ma1, test = list(overall.common = TRUE, overall.random = TRUE))

# Use black squares and omit heterogeneity information
#
forest(ma1, col.square = "black", overall.hetstat = FALSE)

# Inspect the columns and headings on both sides of the forest plot
#
fdat <- forest(ma1)
#
fdat$leftcols
fdat$leftlabs
fdat$rightcols
fdat$rightlabs
# character(0) indicates that no columns or headings are present

# Show only study labels on the left and effect estimates and
# confidence intervals on the right
#
forest(ma1, random = FALSE,
  leftcols = "studlab", rightcols = c("effect", "ci"))

# Omit columns on the left and combine effect estimates and
# confidence intervals in one column on the right
#
forest(ma1, leftcols = FALSE, rightcols = "effect.ci")

# Change the study-label heading to "Author"
# Use the columns and headings returned by forest(ma1) above
#
lcols <- fdat$leftcols
llabs <- fdat$leftlabs
llabs[lcols == "studlab"] <- "Author"
#
forest(ma1, leftlabs = llabs)

# Attach group labels to event counts rather than sample sizes
#
forest(ma1,
  label = list(e.attach = "event.e", c.attach = "event.c"))

# Add 'author' and 'year', using their variable names as headings
#
forest(ma1, leftcols = c(lcols, "author", "year"))

# Specify headings only for the newly added columns
#
forest(ma1, leftcols = c(lcols, "author", "year"),
  leftlabs = c("Author", "Year of publication"))

# Additional columns are centered by default
# Left-align 'author' and right-align 'year'
#
forest(ma1, leftcols = c(lcols, "author", "year"),
  leftlabs = c("Author", "Year of publication"),
  just.addcols = c("left", "right"))

# Draw the same plot using abbreviated justification values
#
forest(ma1, leftcols = c(lcols, "author", "year"),
  leftlabs = c("Author", "Year of publication"),
  just.addcols = c("l", "r"))

# Center text in all columns except study labels
#
forest(ma1, leftcols = c(lcols, "author", "year"),
  leftlabs = c("First author", "Year of publication"),
  just = "center")

# Center text in all columns
#
forest(ma1, leftcols = c(lcols, "author", "year"),
  leftlabs = c("First author", "Year of publication"),
  just = list(just = "center", studlab = "center"))

# Change font sizes and faces
#
forest(ma1,
  fs = list(study = 10, study.labels = 11, axis = 5),
  ff = list(study = "italic", study.labels = "bold",
    axis = "italic", smlab = "bold.italic",
    common = "plain", hetstat = "plain"))

# Change colours
#
forest(ma1,
  col = list(diamond = "green", diamond.lines = "red",
    study = c("green", "blue", "red", "orange"),
    square = "pink", square.lines = "black"))

# Sort by increasing common-effect weight
#
forest(ma1, sortvar = w.common, random = FALSE)

# Sort by decreasing common-effect weight
#
forest(ma1, sortvar = -w.common, random = FALSE)

# Sort by increasing treatment effect
#
forest(ma1, sortvar = TE, random = FALSE)

# Sort by decreasing treatment effect
#
forest(ma1, sortvar = -TE, random = FALSE)

# Sort by decreasing publication year
#
forest(ma1, sortvar = -year, random = FALSE)

#
# Forest plots for subgroup meta-analyses
#

# Conduct a subgroup meta-analysis
#
ma2 <- update(ma1,
  subgroup = ifelse(year < 1987, "Before 1987", "1987 and later"),
  print.subgroup.name = FALSE)

# Omit subgroup summaries based on a single study (the default)
#
forest(ma2, random = FALSE)

# Include subgroup summaries based on a single study
# (identical to the individual study results)
#
forest(ma2, random = FALSE, subgroup = k.w > 0)

# Show only subgroup results
#
forest(ma2, layout = "subgroup")
}

Run the code above in your browser using DataLab