% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fit.R
\name{logLik.bdeb_fit}
\alias{logLik.bdeb_fit}
\title{Log-Likelihood of a BDEB Fit}
\usage{
\method{logLik}{bdeb_fit}(object, ...)
}
\arguments{
\item{object}{A \code{\link[=bdeb_fit]{bdeb_fit()}} object.}

\item{...}{Ignored.}
}
\value{
A \code{logLik} object with attributes \code{df} (number of model
parameters) and \code{nobs} (number of observations).
}
\description{
Computes the log-pointwise predictive density (lppd):
\deqn{\mathrm{lppd} = \sum_{i=1}^{N} \log\!\left(
  \frac{1}{S} \sum_{s=1}^{S} \exp(\log p(y_i \mid \theta^{(s)}))
\right),}
the Bayesian analogue of \code{\link[stats:logLik]{stats::logLik()}}.  This is the natural
point summary of model fit reported by \code{bdeb_loo()} (which adds
Pareto-smoothed importance sampling for cross-validation).
}
\details{
Requires the Stan model to store per-observation \code{log_lik} in
\verb{generated quantities}.  Currently available for \code{"individual"} and
\code{"growth_repro"} models; \code{"hierarchical"} and \code{"debtox"} compute the
likelihood inside \code{reduce_sum} and do not expose individual terms.
}
\examples{
\donttest{
if (requireNamespace("cmdstanr", quietly = TRUE) &&
    nzchar(tryCatch(cmdstanr::cmdstan_path(), error = function(e) ""))) {
  data(eisenia_growth)
  dat <- bdeb_data(growth = eisenia_growth[eisenia_growth$id == 1, ])
  fit <- bdeb_fit(bdeb_model(dat, type = "individual"),
                  chains = 2, iter_warmup = 200, iter_sampling = 200,
                  refresh = 0)
  logLik(fit)
}
}
}
