% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/phreg_rct.R
\name{phreg_rct}
\alias{phreg_rct}
\title{Lu-Tsiatis More Efficient Log-Rank for Randomized Studies with Baseline Covariates}
\usage{
phreg_rct(
  formula,
  data,
  cause = 1,
  cens.code = 0,
  typesR = c("R0", "R1", "R01"),
  typesC = c("C", "dynC"),
  weights = NULL,
  augmentR0 = NULL,
  augmentR1 = NULL,
  augmentC = NULL,
  treat.model = ~+1,
  RCT = TRUE,
  treat.var = NULL,
  km = TRUE,
  level = 0.95,
  cens.model = NULL,
  estpr = 1,
  pi0 = 0.5,
  base.augment = FALSE,
  return.augmentR0 = FALSE,
  mlogit = FALSE,
  ...
)
}
\arguments{
\item{formula}{Formula with \code{Surv} or \code{Event} outcome (see \code{coxph}) and 
treatment variable (randomization 0/1). The treatment variable must be the first 
covariate on the right-hand side.}

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

\item{cause}{Numeric code for the event of interest in competing risks or recurrent events.}

\item{cens.code}{Numeric code for censoring in competing risks or recurrent events.}

\item{typesR}{Character vector specifying augmentation types for randomization 
(options: "R0" for baseline, "R1" for post-baseline, "R01" for both).}

\item{typesC}{Character vector specifying augmentation types for censoring 
(options: "C" for static, "dynC" for dynamic).}

\item{weights}{Weights to be used for \code{phreg}.}

\item{augmentR0}{Formula for the first randomization augmentation (e.g., \code{~age+sex}).}

\item{augmentR1}{Formula for the second randomization augmentation (e.g., \code{~age+sex}).}

\item{augmentC}{Formula for the censoring augmentation (e.g., \code{~age+sex}).}

\item{treat.model}{Propensity score model formula (default is \code{~+1}, assuming RCT).}

\item{RCT}{Logical; if FALSE, uses propensity score adjustment for marginal model.}

\item{treat.var}{Variable indicating treatment times in two-stage randomization.}

\item{km}{Logical; use Kaplan-Meier for censoring weights (stratified on treatment).}

\item{level}{Confidence level for intervals (default 0.95).}

\item{cens.model}{Censoring model formula (default is \code{~strata(treatment)}).}

\item{estpr}{Numeric code (1/0); estimate propensity scores or not (default TRUE).}

\item{pi0}{Fixed propensity scores for randomizations (if not estimating).}

\item{base.augment}{Logical; covariate augment baselines (only for R0 augmentation).}

\item{return.augmentR0}{Logical; return augmentation data.}

\item{mlogit}{Logical; use multinomial logistic regression for propensity scores.}

\item{...}{Additional arguments passed to \code{phreg} function.}
}
\value{
An object of class \code{"phreg_rct"} containing:
  \item{coefs}{Coefficient estimates for the treatment effect.}
  \item{iid}{Influence function (IID) decomposition for variance estimation.}
  \item{AugR0, AugR1, AugCdyn, AugClt}{Augmentation terms for different strategies.}
  \item{cumhaz}{Cumulative hazards.}
  \item{var}{Variance-covariance matrix.}
  \item{se}{Standard errors.}
  \item{call}{Original function call.}
  \item{formula}{Formula used.}
  \item{data}{The data used (if requested).}
  
  The object includes results for different augmentation combinations (R0, R1, R01, C, dynC).
}
\description{
Efficient implementation of the Lu-Tsiatis improvement using baseline covariates, 
extended to competing risks and recurrent events. The results are almost equivalent 
to the \code{speffSurv} function of the \code{speff2trial} package in the survival case. 
A dynamic censoring augmentation regression is also computed to gain additional 
efficiency from the censoring augmentation. The function handles two-stage 
randomizations and recurrent events (start,stop) with cluster structure.
}
\details{
The method improves the efficiency of the log-rank test by utilizing auxiliary 
baseline covariates to reduce variance, particularly useful in randomized clinical 
trials (RCTs) where covariate adjustment can increase power.
}
\examples{
## Lu, Tsiatis simulation
data <- mets:::simLT(0.7,100)
dfactor(data) <- Z.f~Z

out <- phreg_rct(Surv(time,status)~Z.f,data=data,augmentR0=~X,augmentC=~factor(Z):X)
summary(out)
}
\references{
Lu, T. and Tsiatis, A. A. (2008), Improving the efficiency of the log-rank test using auxiliary covariates, Biometrika, 95, 679--694.

Scheike, T. H., Nerstroem, C. and Martinussen, T. (2026), Randomized clinical trials and the proportional hazards model for recurrent events, TEST.
}
\author{
Thomas Scheike
}
