autoplot.confMeta: Visualizations of 'confMeta' objects

View source: R/autoplot_pfun.R

autoplot.confMetaR Documentation

Visualizations of confMeta objects

Description

Plots one or more confMeta objects. This function can create two types of plots: the p-value function plot (also known as drapery plot) and the forest plot. This allows for direct visual comparison of different p-value functions.

Optionally, a Bayesian meta-analysis object created with the bayesmeta::bayesmeta() function can be supplied via the bayesmeta argument. When provided, its posterior summary is displayed as an additional diamond at the bottom of the forest plot for comparison with the frequentist methods

Important Note: If supplying a Bayesian meta-analysis object via the bayesmeta argument, this function explicitly extracts the 95% credible intervals. If the Bayesian model was fit using a different credible level, the function will crash.

Usage

## S3 method for class 'confMeta'
autoplot(
  ...,
  type = c("p", "forest"),
  diamond_height = 0.5,
  v_space = 1.5,
  scale_diamonds = TRUE,
  show_studies = TRUE,
  drapery = TRUE,
  reference_methods_p = c("re"),
  reference_methods_forest = c("re", "hk", "hc"),
  ref_labels = NULL,
  xlim = NULL,
  xlim_p = NULL,
  xlim_forest = NULL,
  same_xlim = TRUE,
  xlab = NULL,
  n_breaks = 7,
  bayesmeta = NULL,
  n_points = 1000
)

Arguments

...

One or more objects of class confMeta.

type

A character vector of length 1 or 2. Indicates what type of plot should be returned. Accepted values are "p", "forest", or both. Defaults to c("p", "forest").

diamond_height

Numeric scalar. Indicates the maximal possible height of the diamonds in the forest plot. Defaults to 0.5. This argument is only relevant if type contains "forest" and will be ignored otherwise.

v_space

Numeric scalar. Indicates the vertical space between two diamonds in the forest plot. Defaults to 1.5. This argument is only relevant if type contains "forest" and will be ignored otherwise.

scale_diamonds

Logical. If TRUE (default), the diamond is rescaled to the interval [0, 1] in cases where the maximum of the p-value function is not equal to 1. This argument is only relevant if type contains "forest" and will be ignored otherwise.

show_studies

Logical. If TRUE (default), the forest plot shows the confidence intervals for the individual effect estimates. Otherwise, the intervals are suppressed. This argument is only relevant if type contains "forest" and will be ignored otherwise.

drapery

Logical. If TRUE (default), individual study effects are represented as drapery plots in the p-value function plot. If FALSE the studies are represented by a simple vertical line at their effect estimates. This argument is only relevant if type contains "p" and will be ignored otherwise.

reference_methods_p

Character vector controlling which reference meta-analysis methods are shown as baseline curves in the p-value function plot. Valid options are "fe", "re", or c("fe", "re") for both. Defaults to "re".

reference_methods_forest

Character vector of length 1 to 4. Specifies which reference meta-analysis methods should be shown as diamonds in the forest plot. Valid options are any subset of c("fe", "re", "hk", "hc"), which correspond to:

  • "fe": fixed-effect meta-analysis

  • "re": random-effects meta-analysis

  • "hk": Hartung-Knapp adjustment

  • "hc": Henmi-Copas adjustment

Defaults to c("re", "hk", "hc").

ref_labels

A named character vector to customize the labels of the reference methods in the plot legends and axes (e.g., c("fe" = "Fixed-effect (IV)", "re" = "Random-effects (DL)")). Defaults to NULL.

xlim

Numeric vector of length 2. Global limits for the x-axis. If NULL, limits are calculated automatically.

xlim_p

Numeric vector of length 2. Specific x-axis limits for the p-value plot. Overrides xlim.

xlim_forest

Numeric vector of length 2. Specific x-axis limits for the forest plot. Overrides xlim.

same_xlim

Logical. If TRUE, forces the p-value plot to use the same x-axis limits as the forest plot. Defaults to TRUE.

xlab

Character string. Label for the x-axis. Defaults to NULL (renders as \mu).

n_breaks

Numeric. Approximate number of tick marks to display on the x-axis. Defaults to 7.

bayesmeta

An object of class bayesmeta, typically created using bayesmeta::bayesmeta(). When provided, the posterior median (or mean) and 95% credible interval are displayed as an additional diamond at the bottom of the forest plot. Has no effect on the p-value plot. Defaults to NULL.

n_points

Numeric. Number of points used to create the p-value plot. Higher values (e.g., 10000) yield higher resolution but take longer to render. Defaults to 1000.

Value

An object of class ggplot containing the specified plot(s).


confMeta documentation built on June 10, 2026, 1:06 a.m.