Learn R Programming

metaviz (version 0.4.0)

wineq_forest: Forest plot for the comparison of fixed-effect and random-effects models

Description

Creates a rain, thick or classic forest plot variant that integrates study weights and overall effects of both a fixed-effect and a random-effects model based on the same data.

Usage

wineq_forest(
  x,
  group = NULL,
  variant = "classic",
  method = "REML",
  study_labels = NULL,
  summary_label_FE = NULL,
  summary_label_REML = NULL,
  confidence_level = 0.95,
  summary_line = TRUE,
  summary_col_FE = "grey70",
  summary_col_REML = "grey50",
  col = "weights",
  errorbar_col = TRUE,
  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,
  show_legend = FALSE,
  ...
)

Value

A wineq forest plot is created by use of ggplot2.

Arguments

x

metafor rma.uni object conducted with method “FE” or “REML” (the chosen method of the input model makes no difference in the resulting plot)

group

factor indicating the group membership of each study

variant

“classic” (default), “thick” or “rain” to create a classic, thick or rainforest plot variant

method

determines whether x-axis values are based on the fixed-effect (“FE”) or the random-effects model (“REML”; default). If no value is entered, the method is extracted from model x.

study_labels

y-axis labels for the study effects

summary_label_FE

y-axis label for the fixed-effect model summary effect

summary_label_REML

y-axis label for the random-effects model summary effect

confidence_level

confidence level for the study effects and summary effects

summary_line

adds dashed vertical lines intersecting each summary effect

summary_col_FE

determines color of the fixed-effect model summary effect

summary_col_REML

determines color of the random-effects model summary effect

col

“weights”: colors point estimates (classic variant), errorbars (thick variant) or raindrops (rain variant) according to weight change on a gradient from blue to red, “BW”: greyscale version, Note: the rain variant is only available in color)

errorbar_col

boolean argument that determines whether the errorbars of the classic variant are colored according to weight change (“TRUE”) or in black (“FALSE”)

text_size

determines text size within the plot

xlab

x-axis label

x_limit

determines the limits of the x-axis. Input is a numeric vector of length 2 (min, max).

x_trans_function

function which transforms x-axis labels back to their original scale when data consists, for example, of log-odds-ratios or Fisher’s z values

x_breaks

option to costumize the number of breaks on the x-axis. Input is a numeric vector specifying the breaks

annotate_CI

adds a right-hand side table to the plot containing the confidence intervals of each effect

study_table

custom table on the left-hand side of the plot that contains study information. Takes a dataframe as input which has to be of a length equal to the number of studies.

summary_table

custom table on the left-hand side of the plot that contains information about the summary effects. Takes a dataframe as input which contains one row for each summary effect.

table_headers

headers for each column of the left-hand side table. Takes a character vector as input

table_layout

numeric layout matrix to customize the arrangement of the plot and tables

show_legend

shows a color legend below the plot which corresponds to the change in weight between the fixed and random-effects model

...

further arguments passed to the internal helper functions for the classic, thick and rainforest variants of the wineq forest plot

Author

Verena Pilar <[email protected]>

Details

The function wineq_forest creates a forest plot by use of ggplot2 that integrates a fixed-effect and a random-effects model based on the same data. It thus provides insight into a sample-specific as well as generalizable result (Borenstein et al., 2010). Color-coded point estimates denote a gain or loss in study weight between the two models and facilitate the identification of small-study effects. Overall effects are shown for both models. This forest plot comes in three variants: classic forest plot, thick forest plot and rainforest plot (Schild & Voracek, 2015). Optional tables provide additional statistical information about the sample. Note: This function was developed on the basis of the viz_forest code which was created by Michael Kossmeier.

References

Borenstein, M., Hedges, L. V., Higgins, J. P., & Rothstein, H. R. (2010). A basic introduction to fixed‐effect and random‐effects models for meta‐analysis. Research synthesis methods, 1(2), 97-111. https://doi.org/10.1002/jrsm.12

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
library(metafor)
# Arranging the data according to effect size to faciliate the identification of small-study effects
mozart <- mozart[order(mozart$d),]

# Calculating a random-effects model based on the mozart data
mozart_r <- rma(yi = d,
                sei = se,
                data = mozart,
                method = "REML")

# Plotting a wineq forest plot based on the mozart data
# using a matrix as input
wineq_forest(x = mozart[, c("d", "se")], study_labels = mozart$study_name)
# using a rma.uni model as input
wineq_forest(x = mozart_r, study_labels = mozart$study_name)

# Thick and rainforest plot variants of the wineq forest plot
wineq_forest(mozart_r, variant = "thick")
wineq_forest(mozart_r, variant = "rain")

Run the code above in your browser using DataLab