Checks rank-normalized R-hat, bulk and tail effective sample sizes, divergences, maximum-tree-depth hits, and every retained biological state. An MLE is not required; when present, its independently stored validation remains separate. Full-draw validation includes natural mortality at every age. A mortality exception is applied only when explicitly stored with the fit's MCMC acceptance settings or supplied by the caller.
Usage
check_mcmc(
fit,
max_rhat = NULL,
min_bulk_ess = NULL,
min_tail_ess = NULL,
divergences = NULL,
max_treedepth_hits = NULL,
mortality_exception = NULL,
cores = 1L,
state_diagnostics = NULL,
stop_on_failure = TRUE,
mode = c("auto", "full", "skip")
)Arguments
- fit
An
sbt_fit()containing MCMC draws.- max_rhat, min_bulk_ess, min_tail_ess
Optional sampler thresholds. Values stored with the fit are used by default, followed by
1.01,400, and400.- divergences, max_treedepth_hits
Required pathology counts; defaults are zero.
- mortality_exception
Optional explicit mortality-exception list.
- cores
Number of workers used for full-draw state evaluation.
- state_diagnostics
Optional biological-state diagnostics already calculated from this exact posterior in the current completion workflow. This avoids evaluating every draw a second time; normal later calls should leave it
NULLand reuse the embedded validation record.- stop_on_failure
Stop when any gate fails. Set to
FALSEto retain a rejected posterior and its diagnostics for inspection.- mode
Validation mode.
"auto"reuses a matching embedded record and otherwise performs the checks,"full"always performs them, and"skip"returns the fit without checking or creating a record.
Value
The checked sbt_fit, with diagnostics stored in
fit$fit$diagnostics$mcmc and full state results in
fit$fit$diagnostics$biological_state_posterior. A payload-bound result
is stored in fit$validation.
See also
Other fit workflow:
check_mle(),
sbt_add_bounds(),
sbt_add_map(),
sbt_add_msy(),
sbt_add_parameters(),
sbt_add_priors(),
sbt_build_object(),
sbt_example_fit(),
sbt_fit(),
sbt_fit_compatibility(),
sbt_fit_io,
sbt_fit_rebuild(),
sbt_fit_report(),
sbt_fit_validate(),
sbt_fit_validation(),
sbt_mcmc(),
sbt_obj(),
sbt_optimise()
Examples
if (FALSE) { # \dontrun{
fit <- sbt_example_fit()
fit <- sbt_mcmc(fit)
fit <- check_mcmc(fit, mode = "auto")
sbt_fit_validation(fit, scope = "mcmc", require_pass = TRUE)$passes
} # }
