Skip to contents

Create a pairs-style diagnostic plot for SparseNUTS RTMB fits, with trace, histogram, or ACF panels on the diagonal, scatter plots below the diagonal, and correlations above the diagonal.

Usage

pairs_rtmb(
  fit,
  pars = NULL,
  order = c("orig", "slow", "fast", "mismatch", "divergent"),
  diag = c("trace", "acf", "hist"),
  inc_warmup = FALSE,
  add_mle = TRUE,
  add_monitor = TRUE,
  unbounded = FALSE,
  rhat_max = 1.01,
  ess_min = 400L
)

Arguments

fit

A SparseNUTS fit object.

pars

Optional character vector or integer vector identifying parameters to plot. If NULL, the first 10 parameters after ordering are shown.

order

Character. Parameter ordering: original order, slowest ESS, fastest ESS, largest posterior/MLE uncertainty mismatch, or largest standardized divergent-draw excursion.

diag

Character. Diagonal panel type.

inc_warmup

Logical. Include warmup samples.

add_mle

Logical. Add MLE point and asymptotic 95% ellipse where available.

add_monitor

Logical. Add ESS/Rhat labels to diagonal panels.

unbounded

Logical. Passed to SparseNUTS::extract_samples().

rhat_max

Numeric. Strict upper R-hat threshold. Labels are red when R-hat is greater than or equal to this value. Default is 1.01.

ess_min

Numeric. Strict lower bulk- and tail-ESS threshold. Labels are red when either ESS is less than or equal to this value. Default is 400.

Value

A GGally::ggmatrix object.

Details

For an ACF diagonal, draws are arranged in extracted sample order; chain boundaries are not handled as separate autocorrelation series. Red monitoring labels are a visual diagnostic only and do not replace check_mcmc() or its production acceptance contract.