data: The input data frame that contains the following variables:
id: The subject id.
stratum: The stratum.
time: The survival time for right censored data.
event: The event indicator, 1=event, 0=no event.
treat: The randomized treatment indicator, 1=treatment, 0=control.
rx: The proportion of time on active treatment.
censor_time: The administrative censoring time. It should be provided for all subjects including those who had events.
base_cov: The baseline covariates (excluding treat).
id: The name of the id variable in the input data.
stratum: The name(s) of the stratum variable(s) in the input data.
time: The name of the time variable in the input data.
event: The name of the event variable in the input data.
treat: The name of the treatment variable in the input data.
rx: The name of the rx variable in the input data.
censor_time: The name of the censor_time variable in the input data.
base_cov: The names of baseline covariates (excluding treat) in the input data for the outcome Cox model.
low_psi: The lower limit of the causal parameter.
hi_psi: The upper limit of the causal parameter.
n_eval_z: The number of points between low_psi and hi_psi (inclusive) at which to evaluate the log-rank Z-statistics.
treat_modifier: The optional sensitivity parameter for the constant treatment effect assumption.
recensor: Whether to apply recensoring to counterfactual survival times. Defaults to TRUE.
admin_recensor_only: Whether to apply recensoring to administrative censoring times only. Defaults to TRUE. If FALSE, recensoring will be applied to the actual censoring times for dropouts.
autoswitch: Whether to exclude recensoring for treatment arms with no switching. Defaults to TRUE.
gridsearch: Whether to use grid search to estimate the causal parameter psi. Defaults to FALSE, in which case, a root finding algorithm will be used.
alpha: The significance level to calculate confidence intervals.
ties: The method for handling ties in the Cox model, either "breslow" or "efron" (default).
tol: The desired accuracy (convergence tolerance) for psi.
boot: Whether to use bootstrap to obtain the confidence interval for hazard ratio. Defaults to FALSE, in which case, the confidence interval will be constructed to match the log-rank test p-value.
n_boot: The number of bootstrap samples.
seed: The seed to reproduce the bootstrap results. The default is missing, in which case, the seed from the environment will be used.
Returns
A list with the following components:
psi: The estimated causal parameter.
psi_CI: The confidence interval for psi.
psi_CI_type: The type of confidence interval for psi, i.e., "grid search", "root finding", or "bootstrap".
logrank_pvalue: The two-sided p-value of the log-rank test for the ITT analysis.
cox_pvalue: The two-sided p-value for treatment effect based on the Cox model.
hr: The estimated hazard ratio from the Cox model.
hr_CI: The confidence interval for hazard ratio.
hr_CI_type: The type of confidence interval for hazard ratio, either "log-rank p-value" or "bootstrap".
eval_z: A data frame containing the log-rank test Z-statistics evaluated at a sequence of psi values. Used to plot and check if the range of psi values to search for the solution and limits of confidence interval of psi need be modified.
Sstar: A data frame containing the counterfactual untreated survival times and event indicators for each treatment group.
kmstar: A data frame containing the Kaplan-Meier estimates based on the counterfactual untreated survival times by treatment arm.
data_outcome: The input data for the outcome Cox model.
fit_outcome: The fitted outcome Cox model.
settings: A list with the following components:
low_psi: The lower limit of the causal parameter.
hi_psi: The upper limit of the causal parameter.
n_eval_z: The number of points between low_psi and hi_psi (inclusive) at which to evaluate the log-rank Z-statistics.
treat_modifier: The sensitivity parameter for the constant treatment effect assumption.
recensor: Whether to apply recensoring to counterfactual survival times.
admin_recensor_only: Whether to apply recensoring to administrative censoring times only.
autoswitch: Whether to exclude recensoring for treatment arms with no switching.
gridsearch: Whether to use grid search to estimate the causal parameter psi.
alpha: The significance level to calculate confidence intervals.
ties: The method for handling ties in the Cox model.
tol: The desired accuracy (convergence tolerance) for psi.
boot: Whether to use bootstrap to obtain the confidence interval for hazard ratio.
n_boot: The number of bootstrap samples.
seed: The seed to reproduce the bootstrap results.
hr_boots: The bootstrap hazard ratio estimates if boot is TRUE.
psi_boots: The bootstrap psi estimates if boot is TRUE.
Details
We use the following steps to obtain the hazard ratio estimate and confidence interval had there been no treatment switching:
Use RPSFTM to estimate the causal parameter ψ based on the log-rank test for counterfactual untreated survival times for both arms:
Ui,ψ=TCi+eψTEi
Fit the Cox proportional hazards model to the observed survival times for the experimental group and the counterfactual survival times for the control group to obtain the hazard ratio estimate.
Use either the log-rank test p-value for the intention-to-treat (ITT) analysis or bootstrap to construct the confidence interval for hazard ratio. If bootstrapping is used, the confidence interval and corresponding p-value are calculated based on a t-distribution with n_boot - 1 degrees of freedom.
James M. Robins and Anastasios A. Tsiatis. Correcting for non-compliance in randomized trials using rank preserving structural failure time models. Communications in Statistics. 1991;20(8):2609-2631.
Ian R. White, Adbel G. Babiker, Sarah Walker, and Janet H. Darbyshire. Randomization-based methods for correcting for treatment changes: Examples from the CONCORDE trial. Statistics in Medicine. 1999;18:2617-2634.