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.framewith at least columntarget. If present and finite, metrics are taken fromAE_worst(fallback toAE_total) andESS_per_sec_worst(fallback toESS_per_sec_total).- sampled_only
Logical (default
TRUE). WhenTRUE, keep only nodes that are targets of configured samplers and also present insamples_mlcolumns. If no node remains, the function raises an error (no permissive fallback).- conf.mcmc
A Nimble MCMC configuration (result of
nimble::configureMCMC()), required whensampled_only=TRUE.- samples_ml
A
coda::mcmc.list(or compatible) holding posterior draws, required whensampled_only=TRUE.- out_dir
Optional output directory. When provided, saves:
AE_median_by_family__samplers_only.pngandCE_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"
)
} # }