Skip to contents

Visual diagnostic tools for MCMC convergence assessment. All functions provide base R fallbacks when ggplot2/bayesplot are unavailable.

Creates a combined diagnostic figure with Rhat, ESS, trace plot, and energy/ACF panels. Requires the patchwork package for layout.

Usage

plot_diagnostics(fit, pars = NULL)

Arguments

fit

A ratiod_fit object.

pars

Character vector of parameter names for trace plot. If NULL, uses the parameter with worst Rhat.

Value

A combined plot (ggplot + patchwork) or NULL if requirements not met.

Details

Creates a 2x2 grid:

  • Top left: Rhat plot

  • Top right: ESS plot

  • Bottom left: Trace for worst parameter

  • Bottom right: Energy (HMC) or ACF (other)

Examples

# See plot_rhat() examples for fitting a model
# plot_diagnostics(fit)