powered by
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 clmstan diagnostics( object, detail = FALSE, rhat_threshold = 1.01, ess_threshold = 400, ... )
# S3 method for clmstan diagnostics( object, detail = FALSE, rhat_threshold = 1.01, ess_threshold = 400, ... )
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
A clmstan object
Additional arguments (ignored)
Logical. If TRUE, show full parameter-level diagnostics table. If FALSE (default), show only summary and any problematic parameters.
Threshold for flagging high Rhat values. Default 1.01.
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)
if (FALSE) { fit <- clm_stan(rating ~ temp, data = wine) diagnostics(fit) diagnostics(fit, detail = TRUE) }
Run the code above in your browser using DataLab