% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interval-cumoddsreg.r
\name{interval_logitsurv_discrete}
\alias{interval_logitsurv_discrete}
\alias{Interval}
\alias{dInterval}
\alias{predictlogitSurvd}
\alias{predictSurvd}
\alias{plotSurvd}
\title{Discrete Time-to-Event Analysis with Interval Censoring}
\usage{
interval_logitsurv_discrete(
  formula,
  data,
  beta = NULL,
  no.opt = FALSE,
  method = "NR",
  stderr = TRUE,
  weights = NULL,
  offsets = NULL,
  exp.link = 1,
  increment = 1,
  ...
)
}
\arguments{
\item{formula}{Formula with an \code{Interval} object (e.g., \code{Interval(entry, time)}) 
on the left-hand side and covariates on the right. Can include \code{cluster()} for 
correlated data.}

\item{data}{Data frame containing the variables in the formula.}

\item{beta}{Starting values for the optimization (vector of length \eqn{p + k}, where 
\eqn{p} is the number of covariates and \eqn{k} is the number of time intervals).}

\item{no.opt}{Logical; if TRUE, skips optimization and returns estimates based on 
the provided \code{beta} (useful for initialization).}

\item{method}{Optimization method: \code{"NR"} (Newton-Raphson, default) or \code{"nlm"}.}

\item{stderr}{Logical; if FALSE, returns only the coefficient estimates.}

\item{weights}{Observation weights (follows ID).}

\item{offsets}{Offsets (follows ID).}

\item{exp.link}{Logical; if TRUE, parameterizes increments as \eqn{\exp(\alpha) > 0}.}

\item{increment}{Logical; if TRUE, uses increments \eqn{dG(t) = \exp(\alpha)} as parameters.}

\item{...}{Additional arguments passed to the optimizer (\code{lava::NR} or \code{nlm}).}
}
\value{
An object of class \code{"cumoddsreg"} containing:
  \item{coef}{Estimated coefficients (baseline time effects and covariate effects).}
  \item{se.coef}{Standard errors of the coefficients.}
  \item{var}{Variance-covariance matrix.}
  \item{iid}{Influence function (IID) decomposition for robust variance estimation.}
  \item{ntimes}{Number of distinct time intervals.}
  \item{utimes}{Unique time points.}
  \item{ploglik}{Log-likelihood at convergence.}
  \item{gradient, hessian}{Optimization results.}
  \item{call}{Original function call.}
}
\description{
Fits a cumulative odds model for discrete time-to-event data, handling interval 
censoring where the event time is known only to lie within an interval \eqn{(t_l, t_r]}.
The model assumes:
\deqn{ \text{logit}(P(T \leq t | x)) = \log(G(t)) + x \beta }
where \eqn{G(t)} is the baseline cumulative odds function and \eqn{\beta} are the 
regression coefficients. This is equivalent to:
\deqn{ P(T \leq t | x) = \frac{G(t) \exp(x \beta)}{1 + G(t) \exp(x \beta)} }
}
\details{
The baseline \eqn{G(t)} is parameterized as the cumulative sum of exponentials 
(\eqn{G(t) = \sum \exp(\alpha)}), ensuring positivity. The regression coefficients 
describe the log-odds of the event occurring by time \eqn{t}.

The likelihood is maximized over the observed intervals:
\deqn{ L = \prod_i [ P(T_i > t_{il} | x_i) - P(T_i > t_{ir} | x_i) ] }
where \eqn{t_{il}} and \eqn{t_{ir}} are the left and right endpoints of the interval 
for subject \eqn{i}. Right-censored intervals have \eqn{t_{ir} = \infty}.
}
\examples{
data(ttpd) 
dtable(ttpd,~entry+time2)

out <- interval_logitsurv_discrete(Interval(entry,time2)~X1+X2+X3+X4,ttpd)
summary(out)
head(iid(out)) 

pred <- predictlogitSurvd(out,se=FALSE)
plotSurvd(pred)

ttpd <- dfactor(ttpd,fentry~entry)
out <- cumoddsreg(fentry~X1+X2+X3+X4,ttpd)
summary(out)
}
\references{
Scheike, T. H. (2024). Discrete time survival analysis with interval censoring. mets package documentation.
}
\seealso{
\code{\link{cumoddsreg}}, \code{\link{predictlogitSurvd}}, \code{\link{simlogitSurvd}}
}
\author{
Thomas Scheike
}
