Skip to contents

Doubly robust estimator of the average treatment effect between two treatments, which is the restricted mean time lost ratio for survival outcomes. Bootstrap is used for inference.

Usage

atefitsurv(
  data,
  outcome_model,
  outcome_method = "coxph",
  ps_model,
  ps_method = "glm",
  censoring_model = NULL,
  censoring_method = "breslow",
  minPS = 0.01,
  maxPS = 0.99,
  followup.time = NULL,
  tau0 = NULL,
  surv.min = 0.025,
  n.boot = 500,
  seed = NULL,
  verbose = 0,
  rmst.control = list(),
  ps.control = list(),
  ...
)

Arguments

data

A data frame containing the variables in the outcome, treatment, and censoring models (if specified); a data frame with n rows (1 row per observation).

outcome_model

A formula specifying the survival outcome model, fitted separately in each treatment arm. Use a Surv outcome on the left and baseline covariates on the right; do not include treatment.

outcome_method

Survival outcome-model method: "coxph" (default), "weibull", or "log_normal" (alias "lognormal"). The parametric methods fit accelerated failure time models with separate scale parameters in each treatment arm. Weibull models have proportional hazards across covariates within an arm but can have non-proportional hazards between arms if their shapes differ. Log-normal models do not impose proportional hazards. Both assume their specified event-time distribution and require positive observed times and an event in each arm. The censoring model is specified separately by censoring_method and censoring_model.

ps_model

A formula describing the treatment model (propensity-score model) to be fitted. The treatment must appear on the left-hand side. The treatment must be a numeric vector coded as 0/1. If data are from a randomized controlled trial, specify ps_model = trt ~ 1 as an intercept-only model.

ps_method

A character value for the method to estimate the propensity score. Allowed values include one of: 'glm' for logistic regression with main effects only (default), or 'lasso' for a logistic regression with main effects and LASSO penalization on two-way interactions (added to the model if interactions are not specified in ps_model). Relevant only when ps_model has more than one variable.

censoring_model

A formula describing the censoring model used for inverse probability of censoring weighting (IPCW). The left-hand side must be empty. Only applies for survival outcomes. Default is NULL, which uses a censoring model with the same covariates as the outcome model outcome_model, plus the treatment.

censoring_method

A character value for the censoring model. Only applies for survival outcomes. Allowed values are: 'breslow' (Cox regression with Breslow estimator of t he baseline survivor function), 'aft (exponential)', 'aft (weibull)', 'aft (lognormal)' or 'aft (loglogistic)' (accelerated failure time model with different distributions for y variable). Default is 'breslow'.

minPS

A numerical value (in `[0, 1]`) below which estimated propensity scores should be truncated. Default is 0.01.

maxPS

A numerical value (in `(0, 1]`) above which estimated propensity scores should be truncated. Must be strictly greater than minPS. Default is 0.99.

followup.time

A column name in data specifying the maximum follow-up time, interpreted as the potential censoring time. Only applies for survival outcomes. Default is NULL, which corresponds to unknown potential censoring time.

tau0

The truncation time for defining restricted mean time lost. Only applies for survival outcomes. Default is NULL, which corresponds to setting the truncation time as the maximum survival time in the data.

surv.min

Lower truncation limit for the probability of being censored. It must be a positive value and should be chosen close to 0. Only applies for survival outcomes. Default is 0.025.

n.boot

A numeric value indicating the number of bootstrap samples used. Default is 500.

seed

An optional integer specifying an initial randomization seed for reproducibility. Default is NULL, corresponding to no seed.

verbose

An integer value indicating whether intermediate progress messages should be printed. 1 indicates messages are printed and 0 otherwise. Default is 0.

rmst.control

Named options for Cox restricted mean survival integration. Supported entry: solver = "C" (default) or solver = "R". The C backend accumulates each patient's integral without allocating a patient-by-event-time matrix. Cox model fitting is unchanged. Applies to Cox outcome models only; parametric models use closed-form integration.

ps.control

Named options for LASSO propensity-score interaction screening. Supported entry: solver = "C" (default) or solver = "R". Only affects screening when ps_method = "lasso"; the LASSO fit and interaction selection rule are unchanged. Kept separate from boosting's ... and other numerical controls.

...

Additional arguments. Deprecated argument names from precmed 1.1.0 remain supported for backward compatibility and emit warnings.

Value

An object of class atefit. See atefit for available methods and the contents of the fitted object.

Details

This helper function estimates the average treatment effect (ATE) for survival data between two treatment groups in a given dataset. The ATE is estimated with a doubly robust estimator that accounts for imbalances in covariate distributions between the two treatment groups with inverse probability treatment and censoring weighting. For survival outcomes, the estimated ATE is the estimated by RMTL ratio between treatment 1 versus treatment 0. The log-transformed RMTL and cumulative hazard ratios are returned, as well as the estimated RMST in either treatment group. The variability of the estimated RMTL ratio is calculated using bootstrap. Additional outputs include standard error of the log RMTL ratio, 95% confidence interval, p-value, and a histogram of the bootstrap estimates. The cumulative hazard ratio and event risks use augmented inverse probability of treatment weighted survival probabilities without discretizing event times. These estimates require appropriate censoring assumptions and a correctly specified censoring model; treatment-model double robustness does not protect against censoring-model misspecification. Event risks outside [0, 1] are unavailable. Undefined estimates or bootstrap replicates yield unavailable inference for the affected measure. If a doubly robust RMST estimate falls outside [0, tau0], the corresponding outcome-model estimate is substituted and a warning is issued. That fallback does not retain the doubly robust guarantee.

Failed or non-finite bootstrap estimates are recorded in bootstrap.diagnostics, with replicate number, affected measure and reason. A warning summarizes failures; inference for each affected measure is unavailable rather than based on a subset of replicates. See also diagnostics() to inspect these records.

Examples

# \donttest{
library(survival)
tau0 <- with(survivalExample,
             min(quantile(y[trt == "drug1"], 0.95), quantile(y[trt == "drug0"], 0.95)))

output <- atefitsurv(data = survivalExample,
                     outcome_model = Surv(y, d) ~ age + female +
                                  previous_cost + previous_number_relapses,
                     ps_model = trt ~ age + previous_treatment,
                     tau0 = tau0,
                     n.boot = 50,
                     seed = 999,
                     verbose = 1)
#> Variable trt was recoded to 0/1 with drug0->0 and drug1->1.
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |=========                                                             |  12%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |================                                                      |  22%
  |                                                                            
  |=================                                                     |  24%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=====================                                                 |  31%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |========================                                              |  35%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |===========================                                           |  39%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |===============================                                       |  45%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |==================================                                    |  49%
  |                                                                            
  |====================================                                  |  51%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |=======================================                               |  55%
  |                                                                            
  |========================================                              |  57%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |===========================================                           |  61%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |==============================================                        |  65%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |=================================================                     |  69%
  |                                                                            
  |==================================================                    |  71%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |======================================================                |  78%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |=============================================================         |  88%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |==================================================================    |  94%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |======================================================================| 100%
output
#> Average treatment effect:
#> 
#>                               estimate         SE     CI.lower   CI.upper
#> log.rmtl.ratio              0.07015530 0.03206484  0.007309376 0.13300123
#> log.cumulative.hazard.ratio 0.02697948 0.10369129 -0.176251706 0.23021067
#> risk.difference             0.00663013 0.02487538 -0.042124717 0.05538498
#>                                 pvalue
#> log.rmtl.ratio              0.02867542
#> log.cumulative.hazard.ratio 0.79471688
#> risk.difference             0.78982810
#> 
#> Estimated event risks at tau0:
#> 
#>        estimate         SE  CI.lower  CI.upper pvalue
#> risk1 0.8908200 0.01623662 0.8589968 0.9226432      0
#> risk0 0.8841899 0.01313583 0.8584441 0.9099356      0
#> 
#> Estimated RMST:
#> 
#>       estimate       SE CI.lower CI.upper pvalue
#> rmst1 172.8609 6.271374 160.5692 185.1526      0
#> rmst0 196.5603 7.753894 181.3629 211.7576      0
#> 
#> Variable trt was recoded to 0/1 with drug0->0 and drug1->1.
plot(output)

# }