% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ild_ipcw_weights.R
\name{ild_ipcw_weights}
\alias{ild_ipcw_weights}
\title{Inverse probability of censoring weights (IPCW) for monotone dropout}
\usage{
ild_ipcw_weights(x, predictors, stabilize = TRUE, trim = c(0.01, 0.99), ...)
}
\arguments{
\item{x}{An ILD object (see [is_ild()]).}

\item{predictors}{Character vector of covariate names (time-varying or baseline
carried forward in \code{x}).}

\item{stabilize}{Logical. If \code{TRUE} (default), multiply factors
\code{mean(1 - p_drop) / (1 - p_drop)} at each row before cumulating; if
\code{FALSE}, use \code{1 / (1 - p_drop)}.}

\item{trim}{Numeric of length 2. Quantiles applied to **final** cumulative
\code{.ipw_censor} (default \code{c(0.01, 0.99)}).}

\item{...}{Passed to \code{stats::glm()}.}
}
\value{
\code{x} with added column \code{.ipw_censor}. Attribute
  \code{ild_ipcw_fit} holds the fitted \code{glm}.
}
\description{
Builds **discrete-time** IPCW weights for **monotone loss-to-follow-up**:
each person contributes a sequence of observed visits; after the last visit
the person is censored. This differs from [ild_missing_model()] + [ild_ipw_weights()],
which model **sporadic item missingness** on an outcome.
}
\details{
Internally, each person-occasion row is labeled with an indicator
\code{drop_next}: whether the person drops before the next scheduled occasion
(including the last observed row). A pooled logistic regression models
\code{drop_next} given covariates; stabilized or unstabilized inverse
probabilities are accumulated within person (product over follow-up) to yield
\code{.ipw_censor}.

**Assumptions:** Monotone censoring, positivity, correct censoring model.
}
\section{Bundle integration}{

Adds \code{.ipw_censor}. Combine with [ild_iptw_weights()] or
[ild_iptw_msm_weights()] via [ild_joint_msm_weights()].
}

\examples{
set.seed(3)
d <- ild_simulate(n_id = 18, n_obs_per = 7, seed = 3)
d$stress <- rnorm(nrow(d))
x <- ild_prepare(d, id = "id", time = "time")
x <- ild_ipcw_weights(x, predictors = "stress")
summary(x$.ipw_censor)
}
\seealso{
[ild_iptw_weights()], [ild_joint_msm_weights()]

Other ild_diagnostics_utilities: 
\code{\link{ild_design_check}()},
\code{\link{ild_iptw_msm_weights}()},
\code{\link{ild_iptw_weights}()},
\code{\link{ild_ipw_weights}()},
\code{\link{ild_joint_msm_weights}()},
\code{\link{ild_missing_cohort}()},
\code{\link{ild_missing_compliance}()},
\code{\link{ild_missing_hazard_first}()},
\code{\link{ild_missing_model}()},
\code{\link{ild_missing_pattern}()},
\code{\link{ild_missingness_report}()}
}
\concept{ild_diagnostics_utilities}
