loo.dynamitefit {dynamite}R Documentation

Approximate Leave-One-Out (LOO) Cross-validation

Description

Estimates the leave-one-out (LOO) information criterion for dynamite models using Pareto smoothed importance sampling with the loo package.

Usage

## S3 method for class 'dynamitefit'
loo(x, separate_channels = FALSE, ...)

Arguments

x

[dynamitefit]
The model fit object.

separate_channels

[logical(1)]
If TRUE, computes LOO separately for each channel. This can be useful in diagnosing where the model fails. Default is FALSE, in which case the likelihoods of different channels are combined, i.e., all channels of are left out.

...

Ignored.

Value

An output from loo::loo() or a list of such outputs (if separate_channels was TRUE).

References

Aki Vehtari, Andrew, Gelman, and Johah Gabry (2017). Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing. 27(5), 1413–1432.

See Also

Model diagnostics lfo(), mcmc_diagnostics()

Examples

data.table::setDTthreads(1) # For CRAN

# Please update your rstan and StanHeaders installation before running
# on Windows
if (!identical(.Platform$OS.type, "windows")) {
  # this gives warnings due to the small number of iterations
  suppressWarnings(loo(gaussian_example_fit))
  suppressWarnings(loo(gaussian_example_fit, separate_channels = TRUE))
}



[Package dynamite version 1.4.9 Index]