fit.cox {causalCmprsk}  R Documentation 
Coxbased estimation of ATE corresponding to the target population
Description
Implements Coxbased estimation of ATE assuming a structural proportional hazards model for two potential outcomes. It provides three measures of treatment effects on timetoevent outcomes: (1) causespecific hazard ratios which are timedependent measures under a nonparametric model, (2) riskbased measures such as causespecific risk differences and causespecific risk ratios, and (3) restrictedmeantime differences which quantify how much time on average was lost (or gained) due to treatment by some specified time point. Please see our package vignette for more details.
Usage
fit.cox(
df,
X,
E,
trt.formula,
A,
C = NULL,
wtype = "unadj",
cens = 0,
conf.level = 0.95,
bs = FALSE,
nbs.rep = 400,
seed = 17,
parallel = FALSE,
verbose = FALSE
)
Arguments
df 
a data frame that includes timetoevent 
X 
a character string specifying the name of the timetoevent variable in 
E 
a character string specifying the name of the "event type" variable in 
trt.formula 
a formula expression, of the form 
A 
a character specifying the name of the treatment/exposure variable.
It is assumed that 
C 
a vector of character strings with variable names (potential confounders)
in the logistic regression model for Propensity Scores, i.e. P(A=1C=c).
The default value of 
wtype 
a character string variable indicating the type of weights that will define the target population for which the ATE will be estimated. The default is "unadj"  this will not adjust for possible treatment selection bias and will not use propensity scores weighting. It can be used, for example, in data from a randomized controlled trial (RCT) where there is no need for emulation of baseline randomization. Other possible values are "stab.ATE", "ATE", "ATT", "ATC" and "overlap". See Table 1 from Li, Morgan, and Zaslavsky (2018). "stab.ATE" is defined as P(A=a)/P(A=aC=c)  see Hernán et al. (2000). 
cens 
an integer value in 
conf.level 
the confidence level that will be used in the bootstrap confidence intervals. The default is 0.95 
bs 
a logical flag indicating whether to perform bootstrap in order to obtain confidence intervals. There are no
analytical confidence intervals in 
nbs.rep 
number of bootstrap replications 
seed 
the random seed for the bootstrap, in order to make the results reproducible 
parallel 
a logical flag indicating whether to perform bootstrap sequentially or in parallel, using several cores simultaneously. The default value is FALSE. In parallel execution, the number of available cores is detected, and the parallel jobs are assigned to the number of detected available cores minus one. 
verbose 
a logical flag indicating whether to show a progress of bootstrap. The progress bar is shown only for sequential bootstrap computation. The default value is FALSE. 
Value
A list of class cmprsk
with the following fields:
time  
a vector of time points for which all the parameters are estimated  
trt.0  
a list of estimates of the counterfactual parameters
corresponding to A =0 and the type of event E . trt.0
has K
fields as the number of competing events in the data set.
For each competing risk there is a list of point estimates, their standard errors and
conf.level % confidence intervals: 

CumHaz
a vector of cumulative hazard estimatesCIF
a vector of cumulative incidence functions (CIF)RMT
a vector of restricted mean time (RMT) estimatesCumHaz.CI.L
a vector of bootstrapbased quantile estimate of lower confidence limits for cumulative hazard estimatesCumHaz.CI.U
a vector of bootstrapbased quantile estimate of upper confidence limits for cumulative hazard estimatesCumHaz.SE
a vector of the bootstrapbased estimated standard errors of cumulative hazard estimatesCIF.CI.L
a vector of bootstrapbased quantile estimate of lower confidence limits for CIF estimatesCIF.CI.U
a vector of bootstrapbased quantile estimate of upper confidence limits for CIF estimatesCIF.SE
a vector of bootstrapbased estimated standard error of CIF estimatesRMT.CI.L
a vector of bootstrapbased quantile estimate of lower confidence limits for RMT estimatesRMT.CI.U
a vector of bootstrapbased quantile estimate of upper confidence limits for RMT estimatesRMT.SE
a vector of the bootstrapbased estimated standard errors of RMT estimatesbs.CumHaz
a matrix of dimensionnbs.rep
by the length oftime
vector, with cumulative hazard estimates fornbs.rep
bootstrap samples
trt.1  
a list of estimates of the counterfactual parameters
corresponding to A =1 and the type of event E . trt.1 has K
fields as the number of competing events (risks) in the data set.
For each competing risk there is a list of point estimates: 

CumHaz
a vector of cumulative hazard estimatesCIF
a vector of cumulative incidence functionsRMT
a vector of restricted mean time estimatesCumHaz.CI.L
a vector of bootstrapbased quantile estimate of lower confidence limits for cumulative hazard estimatesCumHaz.CI.U
a vector of bootstrapbased quantile estimate of upper confidence limits for cumulative hazard estimatesCumHaz.SE
a vector of the bootstrapbased estimated standard errors of cumulative hazard estimatesCIF.CI.L
a vector of bootstrapbased quantile estimate of lower confidence limits for CIF estimatesCIF.CI.U
a vector of bootstrapbased quantile estimate of upper confidence limits for CIF estimatesCIF.SE
a vector of bootstrapbased estimated standard error for CIF estimatesRMT.CI.L
a vector of bootstrapbased quantile estimate of lower confidence limits for RMT estimatesRMT.CI.U
a vector of bootstrapbased quantile estimate of upper confidence limits for RMT estimatesRMT.SE
a vector of the bootstrapbased estimated standard errors of the RMT estimatesbs.CumHaz
a matrix of dimensionnbs.rep
by the length oftime
vector, with cumulative hazard estimates fornbs.rep
bootstrap samples
trt.eff  
a list of estimates of the treatment effect measures
corresponding to the type of event E . trt.eff has the number of
fields as the number of different types of events (risks) in the data set.
For each competing risk there is a list of estimates: 
log.CumHazR
an estimate of the log of the hazard ratio. It is a scalar since the Cox model is assumed.RD
a vector of timevarying Risk Difference between two treatment armsRR
a vector of timevarying Risk Ratio between two treatment armsATE.RMT
a vector of the timevarying Restricted Mean Time Difference between two treatment armslog.CumHazR.CI.L
a bootstrapbased quantile estimate of the lower confidence limit oflog.CumHazR
log.CumHazR.CI.U
a bootstrapbased quantile estimate of the upper confidence limit oflog.CumHazR
log.CumHazR.SE
a bootstrapbased estimated standard error oflog.CumHazR
log.CumHazR.pvalue
pvalue from a Wald test of a twosided hypothesis H0: HR(A=1)/HR(A=0)=1RD.CI.L
a vector of bootstrapbased quantile estimates of the lower confidence limits of the Risk Difference estimatesRD.CI.U
a vector of bootstrapbased quantile estimate of the upper confidence limits of the Risk Difference estimatesRD.SE
a vector of the bootstrapbased estimated standard errors of the Risk DifferenceRR.CI.L
a vector of bootstrapbased quantile estimates of the lower confidence limits of the Risk Ratio estimatesRR.CI.U
a vector of bootstrapbased quantile estimate of the upper confidence limits of the Risk Ratio estimatesRR.SE
a vector of the bootstrapbased estimated standard errors of the Risk RatioATE.RMT.CI.L
a vector of bootstrapbased quantile estimate of lower confidence limits for the RMT difference estimatesATE.RMT.CI.U
a vector of bootstrapbased quantile estimate of upper confidence limits for the RMT difference estimatesATE.RMT.SE
a vector of bootstrapbased estimated standard errors of the RMT difference estimates
References
F. Li, K.L. Morgan, and A.M. Zaslavsky. 2018. Balancing Covariates via Propensity Score Weighting. Journal of the American Statistical Association, 113 (521): 390–400.
M.A. Hernán, B. Brumback, and J.M. Robins. 2000. Marginal structural models and to estimate the causal effect of zidovudine on the survival of HIVpositive men. Epidemiology, 11 (5): 561570.
See Also
fit.nonpar
, get.pointEst
, causalCmprsk
Examples
# create a data set
n < 1000
set.seed(7)
c1 < runif(n)
c2 < as.numeric(runif(n)< 0.2)
set.seed(77)
cf.m.T1 < rweibull(n, shape=1, scale=exp((1 + 2*c1)))
cf.m.T2 < rweibull(n, shape=1, scale=exp((1 + 1*c2)))
cf.m.T < pmin( cf.m.T1, cf.m.T2)
cf.m.E < rep(0, n)
cf.m.E[cf.m.T1<=cf.m.T2] < 1
cf.m.E[cf.m.T2<cf.m.T1] < 2
set.seed(77)
cf.s.T1 < rweibull(n, shape=1, scale=exp(1*c1 ))
cf.s.T2 < rweibull(n, shape=1, scale=exp(2*c2))
cf.s.T < pmin( cf.s.T1, cf.s.T2)
cf.s.E < rep(0, n)
cf.s.E[cf.s.T1<=cf.s.T2] < 1
cf.s.E[cf.s.T2<cf.s.T1] < 2
exp.z < exp(0.5 + 1*c1  1*c2)
pr < exp.z/(1+exp.z)
TRT < ifelse(runif(n)< pr, 1, 0)
X < ifelse(TRT==1, cf.m.T, cf.s.T)
E < ifelse(TRT==1, cf.m.E, cf.s.E)
covs.names < c("c1", "c2")
data < data.frame(X=X, E=E, TRT=TRT, c1=c1, c2=c2)
form.txt < paste0("TRT", " ~ ", paste0(covs.names, collapse = "+"))
trt.formula < as.formula(form.txt)
wei < get.weights(formula=trt.formula, data=data, wtype = "overlap")
hist(wei$ps[data$TRT==1], col="red", breaks = seq(0,1,0.05))
hist(wei$ps[data$TRT==0], col="blue", breaks = seq(0,1,0.05))
# Coxbased estimation:
res.cox.ATE < fit.cox(df=data, X="X", E="E", trt.formula=trt.formula, wtype="stab.ATE")
cox.pe < get.pointEst(res.cox.ATE, 0.5)
cox.pe$trt.eff[[1]]$RD
# please see our package vignette for practical examples