Learn R Programming

metaviz (version 0.3.1)

viz_thickforest: Thick forest plots for meta-analyses

Description

Creates a thick forest plot, a novel variant of the forest plot.

Usage

viz_thickforest(
  x,
  group = NULL,
  type = "standard",
  method = "FE",
  study_labels = NULL,
  summary_label = NULL,
  confidence_level = 0.95,
  col = "Blues",
  summary_col = col,
  tick_col = "firebrick",
  text_size = 3,
  xlab = "Effect",
  x_limit = NULL,
  x_trans_function = NULL,
  x_breaks = NULL,
  annotate_CI = FALSE,
  study_table = NULL,
  summary_table = NULL,
  table_headers = NULL,
  table_layout = NULL
)

Arguments

x

data.frame or matrix with the effect sizes of all studies (e.g., correlations, log odds ratios, or Cohen d) in the first column and their respective standard errors in the second column. Alternatively, x can be the output object of function rma.uni from package metafor; then effect sizes and standard errors are extracted from x.

group

factor indicating the subgroup of each study to plot a subgroup forest plot. Has to be in the same order than x.

type

character string indicating the type of forest plot to be plotted. Can be "standard" (default), "study_only", "summary_only", "cumulative", or "sensitivity". See 'Details'.

method

character string indicating which method should be used to compute the study weights and summary effect(s). Can be any method argument from rma.uni (e.g., "FE" for the fixed effect model, or "DL" for the random effects model using the DerSimonian-Laird method to estimate \(\tau^2\)). If input x is an output object of function rma.uni from package metafor, then the method is extracted from x.

study_labels

a character vector with names/identifiers to annotate each study in the forest plot. Has to be in the same order than x. Ignored if study_table and/or summary_table is supplied.

summary_label

a character string specifying the name to annotate the summary effect. If a subgroup analysis is plotted, summary_label should be a character vector with a name for each subgroup summary effect, arranged in the order of the levels of group. Ignored if study_table and/or summary_table is supplied.

confidence_level

numeric value. The confidence level for the plotted confidence bars.

col

character string specifying the color used for the study-level error bars. Can be a vector of length nrow(x) with colors for each study-level result individually.

summary_col

character string specifying the main color for plotting the summary effect(s). Can be a vector with colors for each subgroup summary effect individually.

tick_col

character string specifying the color used for the ticks indicating the point estimates.

text_size

numeric value. Size of text in the forest plot. Default is 3.

xlab

character string specifying the label of the x axis. By default also used for the header of the aligned table if annotate_CI is TRUE.

x_limit

numeric vector of length 2 with the limits (minimum, maximum) of the x axis.

x_trans_function

function to transform the labels of the x axis. Common uses are to transform log-odds-ratios or log-risk-ratios with exp to their original scale (odds ratios and risk ratios), or Fisher's z values back to correlation coefficients using tanh.

x_breaks

numeric vector of values for the breaks on the x-axis. When used in tandem with x_trans_function the supplied values should be not yet transformed.

annotate_CI

logical scalar. Should the effect size and confidence interval values be shown as text in an aligned table on the right-hand side of the forest plot?

study_table

a data.frame with additional study-level variables which should be shown in an aligned table. Has to be in the same order than x.

summary_table

a data.frame with additional summary-level information shown in an aligned table. If group is supplied, summary_table must have a row for each subgroup summary effect, arranged in the order of the levels of group.

table_headers

character vector. Headers for each column of aligned tables via study_table, summary_table, or annotate_CI.

table_layout

numeric layout matrix passed to layout_matrx of arrangeGrob. Can be used to overwrite the default spacing of the forest plot and aligned tables via study_table, summary_table, and annotate_CI.

Value

A thick forest plot is created using ggplot2.

Details

The thick forest plot was proposed by Schild and Voracek (2015) as a variant and enhancement of classic forest plots. Thick forest plots use rectangular error bars instead of traditional lines to display confidence intervals (width of the error bar), as well as the relative meta-analytic weight (height of the error bar) of each study. In addition, study and summary level point estimates are depicted clearly by a specific symbol.

Thick forest plots have the following advantages, as compared to classic forest plots:

  1. Using the height of bars proportional to the (relative) meta-analytic weight causes small studies (with wide confidence intervals and less weight in the meta-analysis) to be visually less dominant.

  2. In classic forest plots, it is often hard to depict the magnitude of point estimates to a reasonable degree of accuracy, especially for studies with large meta-analytic weights and correspondingly large plotting symbols (commonly squares). Specific symbols within the thick forest plot improve the visualization of study point estimates.

Note that for subgroup analysis the height of each error bar is scaled by the weight of each study within the subgroup divided by the sum of the weights of all studies irrespective of subgroup. Therefore, with subgroups present, the overall impression of error bar heights within a given subgroup compared to other subgroups conveys information about the relative precision of the meta-analytic estimate within the subgroup.

References

Schild, A. H., & Voracek, M. (2015). Finding your way out of the forest without a trail of bread crumbs: Development and evaluation of two novel displays of forest plots. Research Synthesis Methods, 6, 74-86.

Examples

Run this code
# NOT RUN {
library(metaviz)
# Plotting a thick forest plot using the mozart data
viz_thickforest(x = mozart[, c("d", "se")],
study_labels = mozart[, "study_name"], xlab = "Cohen d")

# Visualizing a subgroup analysis of published and unpublished studies
viz_thickforest(x = mozart[, c("d", "se")], group = mozart[, "rr_lab"],
study_labels = mozart[, "study_name"], method = "REML",
summary_label = c("Summary (rr_lab = no)", "Summary (rr_lab = yes)"),
xlab = "Cohen d")

# Showing additional information in aligned tables. Log risk ratios are labeled
# in their original metric (risk ratios) on the x axis.
viz_thickforest(x = exrehab[, c("logrr", "logrr_se")],
annotate_CI = TRUE, xlab = "RR", x_trans_function = exp,
study_table = data.frame(
Name = exrehab[, "study_name"],
eventsT = paste(exrehab$ai, "/", exrehab$ai + exrehab$bi, sep = ""),
eventsC = paste(exrehab$ci, "/", exrehab$ci + exrehab$di, sep = "")),
summary_table = data.frame(
Name = "Summary",
eventsT = paste(sum(exrehab$ai), "/", sum(exrehab$ai + exrehab$bi), sep = ""),
eventsC = paste(sum(exrehab$ci), "/", sum(exrehab$ci + exrehab$di), sep = "")),
table_layout = matrix(c(1, 1, 2, 2, 3), nrow = 1))
# }

Run the code above in your browser using DataLab