% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dependent_censoring_analytical.R
\name{DC.ss.analytical}
\alias{DC.ss.analytical}
\title{Find Sample Size for RMST with Covariate-Dependent Censoring (Analytic)}
\usage{
DC.ss.analytical(
  pilot_data,
  time_var,
  status_var,
  arm_var,
  target_power,
  linear_terms = NULL,
  L,
  alpha = 0.05,
  n_start = 50,
  n_step = 25,
  max_n_per_arm = 2000,
  verbose = FALSE
)
}
\arguments{
\item{pilot_data}{A \code{data.frame} containing 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{target_power}{A single numeric value for the desired power.}

\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{n_start}{The starting sample size \emph{per arm} for the search.}

\item{n_step}{The increment in sample size at each step of the search.}

\item{max_n_per_arm}{The maximum sample size \emph{per arm} to search.}

\item{verbose}{Logical; if \code{TRUE}, emit progress messages. Default \code{FALSE}.}
}
\value{
A \code{list} with:
\item{results_data}{data.frame with \code{Target_Power} and \code{Required_N_per_Arm}.}
\item{results_plot}{ggplot showing the search path.}
\item{results_summary}{data.frame summarizing the pilot arm effect.}
}
\description{
Iteratively finds required per-arm sample size for a target power,
using the same IPCW-based analytic variance as \code{DC.power.analytical}.
}
\details{
Uses a single censoring Cox model \code{Surv(time, status==0) ~ linear_terms} to form IPCW
and fits a weighted RMST regression. Treatment is excluded from the censoring model
by default. Competing risks are not modeled. Variance ignores uncertainty in \eqn{\hat G}.

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