% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/loglik_inad.R
\name{logL_inad}
\alias{logL_inad}
\title{Log-likelihood for INAD models (with missing data support)}
\usage{
logL_inad(
  y,
  order = 1,
  thinning = c("binom", "pois", "nbinom"),
  innovation = c("pois", "bell", "nbinom"),
  alpha,
  theta,
  nb_inno_size = NULL,
  blocks = NULL,
  tau = 0,
  na_action = c("fail", "complete", "marginalize")
)
}
\arguments{
\item{y}{Integer matrix n_sub by n_time.}

\item{order}{Integer in \{0, 1, 2\}.}

\item{thinning}{One of "binom", "pois", "nbinom".}

\item{innovation}{One of "pois", "bell", "nbinom".}

\item{alpha}{Thinning parameters. For order 1, numeric length 1 or n_time.
For order 2, either a matrix n_time by 2 or a list(alpha1, alpha2).}

\item{theta}{Innovation parameter(s). Numeric length 1 or n_time. For
Poisson and negative binomial innovations, this is the innovation mean.
For Bell innovations, this is the Bell rate parameter
(mean \eqn{\theta e^\theta}).}

\item{nb_inno_size}{Size parameter for innovation "nbinom". Numeric length 1 or n_time.}

\item{blocks}{Optional integer vector of length n_sub. If NULL, no fixed effect.}

\item{tau}{Optional numeric vector. Only used if blocks is not NULL.}

\item{na_action}{How to handle missing values:
\itemize{
\item \code{"fail"}: error if any NA is present.
\item \code{"complete"}: use only complete-case subjects.
\item \code{"marginalize"}: observed-data likelihood under MAR via truncated-state recursion.
}}
}
\value{
A scalar log likelihood.
}
\description{
If blocks is NULL, this computes the log likelihood as the sum of per time
contributions from logL_inad_i for computational convenience.
}
\examples{
set.seed(1)
y <- simulate_inad(
  n_subjects = 60,
  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)
logL_inad(
  y,
  order = 1,
  thinning = "binom",
  innovation = "pois",
  alpha = fit$alpha,
  theta = fit$theta
)
}
