% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ci_inad.R
\name{ci_inad}
\alias{ci_inad}
\title{Confidence intervals for fitted INAD models}
\usage{
ci_inad(
  y,
  fit,
  blocks = NULL,
  level = 0.95,
  idx_time = NULL,
  ridge = 0,
  profile_maxeval = 2500,
  profile_xtol_rel = 1e-06
)
}
\arguments{
\item{y}{Integer matrix with \code{n_subjects} rows and \code{n_time} columns.}

\item{fit}{A fitted model object returned by \code{\link{fit_inad}}.}

\item{blocks}{Optional integer vector of length \code{n_subjects}. Required for
block effect intervals. If provided, should match \code{fit$settings$blocks}.}

\item{level}{Confidence level between 0 and 1.}

\item{idx_time}{Optional integer vector of time indices for which to compute
intervals. Default is all time points.}

\item{ridge}{Nonnegative ridge value added to the observed information matrix
used for Louis based Wald intervals.}

\item{profile_maxeval}{Maximum number of function evaluations used in the
profile likelihood refits.}

\item{profile_xtol_rel}{Relative tolerance used in the profile likelihood refits.}
}
\value{
An object of class \code{inad_ci}, a list with elements
\code{settings}, \code{level}, \code{alpha}, \code{theta}, \code{nb_inno_size},
and \code{tau}. Each non NULL interval element is a data frame with columns
\code{param}, \code{est}, \code{lower}, \code{upper}, and possibly \code{se}
and \code{width}.
}
\description{
Computes confidence intervals for selected parameters from a fitted INAD model.
For the fixed effect case, Wald intervals for time varying alpha and theta are
computed via Louis identity for supported thinning-innovation combinations.
For block effects tau, profile likelihood intervals are computed by fixing one
component of tau and re maximizing the log likelihood over nuisance parameters.
For negative binomial innovations, Wald intervals for the innovation size
parameter are computed using a one dimensional observed information approximation
per time point, holding other parameters fixed at their fitted values.
}
\examples{
\donttest{
data("bolus_inad", package = "antedep")
y <- bolus_inad$y
blocks <- bolus_inad$blocks
fit <- fit_inad(y, order = 1, thinning = "binom", innovation = "bell", blocks = blocks)
ci <- ci_inad(y, fit, blocks = blocks)
ci$alpha
ci$theta
ci$tau
}

}
