rstan (version 2.17.3)

check_hmc_diagnostics: Check HMC diagnostics after sampling

Description

These functions print summaries of important HMC diagnostics. The check_hmc_diagnostics function calls the other functions internally and prints an overall summary, but the other functions can also be called directly: check_divergences prints the number (and percentage) of iterations that ended with a divergence, check_treedepth prints the number (and percentage) of iterations that saturated the max treedepth, and check_energy prints E-BFMI values for each chain for which E-BFMI is less than 0.2.

Brief explanations of some of the problems detected by these diagnostics can be found at http://mc-stan.org/misc/warnings.html. For more depth see Betancourt (2017).

Usage

check_hmc_diagnostics(object)
check_divergences(object)
check_treedepth(object)
check_energy(object)

Arguments

object

A stanfit object.

References

The Stan Development Team Stan Modeling Language User's Guide and Reference Manual. http://mc-stan.org/.

Betancourt, M. (2017). A conceptual introduction to Hamiltonian Monte Carlo. https://arxiv.org/abs/1701.02434.

Examples

Run this code
# NOT RUN {
schools <- stan_demo("eight_schools")
check_hmc_diagnostics(schools)
check_divergences(schools)
check_treedepth(schools)
check_energy(schools)
# }

Run the code above in your browser using DataLab