Skip to contents

Produces colored bar charts for median AE (ESS/N) and CE (ESS/s) by node family, restricted to nodes that are actually sampled by the MCMC configuration (strict "samplers only"). Designed for large models where memory/time constraints require fast post-processing on a reduced subset.

Usage

plot_bottlenecks_fast(
  diag_tbl,
  sampled_only = TRUE,
  conf.mcmc = NULL,
  samples_ml = NULL,
  out_dir = NULL
)

Arguments

diag_tbl

A data.frame with at least column target. If present and finite, metrics are taken from AE_worst (fallback to AE_total) and ESS_per_sec_worst (fallback to ESS_per_sec_total).

sampled_only

Logical (default TRUE). When TRUE, keep only nodes that are targets of configured samplers and also present in samples_ml columns. If no node remains, the function raises an error (no permissive fallback).

conf.mcmc

A Nimble MCMC configuration (result of nimble::configureMCMC()), required when sampled_only=TRUE.

samples_ml

A coda::mcmc.list (or compatible) holding posterior draws, required when sampled_only=TRUE.

out_dir

Optional output directory. When provided, saves: AE_median_by_family__samplers_only.png and CE_median_by_family__samplers_only.png.

Value

(invisible) A list with ggplot objects and summary tables: list(p_ae, p_ce, table_ae, table_ce).

Examples

if (FALSE) { # \dontrun{
conf <- nimble::configureMCMC(m)
res <- plot_bottlenecks_fast(
  diag_tbl   = diag_tbl,
  sampled_only = TRUE,
  conf.mcmc  = conf,
  samples_ml = samples_mla,
  out_dir    = "outputs/diagnostics_fast"
)
} # }