get_diagnostics: Function to extract Stan diagnostics from an HPR model

View source: R/get_diagnostics.R

get_diagnosticsR Documentation

Function to extract Stan diagnostics from an HPR model

Description

Function to extract Stan diagnostics from an HPR model

Usage

get_diagnostics(object = NULL, verbose = FALSE)

Arguments

object

The results object from a run of hpr.

verbose

A logical indicator of whether a full cmdstan diagnostic report should be printed to the console. The default is false.

Value

A dataframe with columns:

Divergences

The number of HMC samples that ended in a divergence.

Max_Treedepth

The number of HMC samples that had a max_treedepth warning.

Rhat

The number of f parameters that had Rhat greater than 1.1, using the adjusted Rhat of Vehtari et al. (Bayesian Analysis, 2021).

Min_Ess_Bulk

The minimum effective sample size in the bulk of the posterior across the f parameters. This estimated according to Vehtari et al. (Bayesian Analysis, 2021).

Min_Ess_Tail

The minimum effective sample size in the tails of the posterior across the f parameters. This estimated according to Vehtari et al. (Bayesian Analysis, 2021).

Num_Param

The length of the f vector (the systematic component of the model), which is a function of all other parameters in the model.

Num_Samples

The number of HMC posterior samples.

Time

The computing time of Stan sampling.

For more information on these metrics, please see Chase et al. (2022+) or the Stan reference manual.

Examples

X <- as.matrix(dat$Day, ncol = 1)
y <- dat$Temperature

mymodel <- hpr(y = y, X = X, family = "gaussian")
get_diagnostics(mymodel)


elizabethchase/HPR documentation built on May 7, 2023, 5:48 a.m.