| diagnostics | R Documentation |
Provides a summary of MCMC convergence diagnostics including HMC-specific diagnostics (divergences, treedepth, E-BFMI) and general convergence measures (Rhat, ESS).
diagnostics(object, ...)
## S3 method for class 'clmstan'
diagnostics(
object,
detail = FALSE,
rhat_threshold = 1.01,
ess_threshold = 400,
...
)
object |
A clmstan object |
... |
Additional arguments (ignored) |
detail |
Logical. If TRUE, show full parameter-level diagnostics table. If FALSE (default), show only summary and any problematic parameters. |
rhat_threshold |
Threshold for flagging high Rhat values. Default 1.01. |
ess_threshold |
Threshold for flagging low ESS values. Default 400. |
The function checks for the following issues:
Divergences: Number of divergent transitions (ideally 0)
Treedepth: Transitions hitting max treedepth (efficiency issue)
E-BFMI: Energy Bayesian Fraction of Missing Information (values < 0.3 indicate problems)
Rhat: Potential scale reduction factor (values > 1.01 indicate lack of convergence)
ESS: Effective sample size for bulk and tail (low values indicate high autocorrelation)
Invisibly returns a list containing:
hmc: HMC diagnostics from CmdStanMCMC$diagnostic_summary()
convergence: Data frame of per-parameter Rhat and ESS values
issues: Logical indicating whether any issues were detected
## Not run:
fit <- clm_stan(rating ~ temp, data = wine)
diagnostics(fit)
diagnostics(fit, detail = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.