% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dependent_censoring_analytical.R
\name{DC.power.analytical}
\alias{DC.power.analytical}
\title{Analyze Power for RMST Model with Covariate-Dependent Censoring (Analytic)}
\usage{
DC.power.analytical(
  pilot_data,
  time_var,
  status_var,
  arm_var,
  sample_sizes,
  linear_terms = NULL,
  L,
  alpha = 0.05,
  verbose = FALSE
)
}
\arguments{
\item{pilot_data}{A \code{data.frame} with pilot study data.}

\item{time_var}{A character string for the time-to-event variable.}

\item{status_var}{A character string for the event status variable (1=event, 0=censored).}

\item{arm_var}{A character string for the treatment arm variable (1=treatment, 0=control).}

\item{sample_sizes}{A numeric vector of sample sizes \emph{per arm} to calculate power for.}

\item{linear_terms}{Optional character vector of additional covariate names.}

\item{L}{The numeric value for the RMST truncation time.}

\item{alpha}{The significance level (Type I error rate).}

\item{verbose}{Logical; if \code{TRUE}, emit progress messages. Default \code{FALSE}.}
}
\value{
A \code{list} with:
\item{results_data}{A data.frame with \code{N_per_Arm} and \code{Power}.}
\item{results_plot}{A ggplot object of the power curve.}
\item{results_summary}{A data.frame summarizing the pilot arm effect.}
}
\description{
Performs power analysis for an RMST model when the censoring mechanism
depends on observed covariates.
}
\details{
This function assumes a single censoring process whose hazard depends on covariates
(but not on treatment by default). It fits a Cox model for censoring
\deqn{\Pr(\text{censoring by } t \mid X) = 1 - G(t \mid X)}
using \code{Surv(time, status==0) ~ linear\_terms}, then forms inverse-probability-of-censoring
weights (IPCW) \eqn{w_i = 1/\hat G(Y_i\mid X_i)} evaluated at \eqn{Y_i=\min(T_i,L)}.
The RMST regression \eqn{E[Y_i \mid A_i,X_i]} is then fit by weighted least squares,
and power is derived from a sandwich variance that ignores uncertainty from
estimating \eqn{\hat G}.

Note: This implementation models a single censoring process and does not
handle competing risks.
}
