% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/loo.R
\name{loo.dynamitefit}
\alias{loo.dynamitefit}
\alias{loo}
\title{Approximate Leave-One-Out (LOO) Cross-validation}
\usage{
\method{loo}{dynamitefit}(x, separate_channels = FALSE, thin = 1L, ...)
}
\arguments{
\item{x}{[\code{dynamitefit}]\cr The model fit object.}

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

\item{thin}{[\code{integer(1)}]\cr Use only every \code{thin} posterior sample when
computing LOO. This can be beneficial with when the model object contains
large number of samples. Default is \code{1} meaning that all samples are used.}

\item{...}{Ignored.}
}
\value{
An output from \code{\link[loo:loo]{loo::loo()}} or a list of such outputs (if
\code{separate_channels} was \code{TRUE}).
}
\description{
Estimates the leave-one-out (LOO) information criterion for \code{dynamite}
models using Pareto smoothed importance sampling with the \pkg{loo} package.
}
\examples{
data.table::setDTthreads(1) # For CRAN
\donttest{
# 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))
}
}

}
\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.
}
\seealso{
Model diagnostics
\code{\link{hmc_diagnostics}()},
\code{\link{lfo}()},
\code{\link{mcmc_diagnostics}()}
}
\concept{diagnostics}
