% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bic_inad.R
\name{bic_inad}
\alias{bic_inad}
\title{Bayesian information criterion for fitted INAD models}
\usage{
bic_inad(fit, n_subjects = NULL)
}
\arguments{
\item{fit}{A fitted model object returned by \code{\link{fit_inad}}.}

\item{n_subjects}{Number of subjects, typically \code{nrow(y)}. If
\code{NULL}, inferred from \code{fit$settings$n_subjects} or legacy
\code{length(fit$settings$blocks)} when available (with a warning).}
}
\value{
A numeric scalar BIC value.
}
\description{
Computes BIC using the fitted log likelihood and a parameter count that
respects structural zeros and identifiability constraints.
}
\details{
The BIC is computed as:
\deqn{BIC = -2 \times \ell + k \times \log(N)}
where \eqn{\ell} is the log-likelihood, \eqn{k} is the number of free parameters,
and \eqn{N} is the number of subjects.
}
\examples{
set.seed(1)
y <- simulate_inad(
  n_subjects = 40,
  n_time = 5,
  order = 1,
  thinning = "binom",
  innovation = "pois",
  alpha = 0.3,
  theta = 2
)
fit <- fit_inad(y, order = 1, thinning = "binom", innovation = "pois", max_iter = 20)
bic_inad(fit, n_subjects = nrow(y))
}
