gc.survival {RISCA} | R Documentation |
Marginal Effect for Censored Outcome by G-computation with a Cox Regression for the Outcome Model.
Description
This function allows to estimate the marginal effect of an exposure or a treatment by G-computation for a censored times-to-event, the Q-model being specified by a Cox model.
Usage
gc.survival(object, data, group, times, failures, max.time, effect,
iterations, n.cluster, cluster.type)
Arguments
object |
A coxph object obtained by using the function |
data |
A data frame in which to look for the variables related to the status of the event (observed or censored), the follow-up time, the treatment/exposure and the covariables included in the previous model |
group |
The name of the variable related to the exposure/treatment. This variable shall have only two modalities encoded 0 for the untreated/unexposed patients and 1 for the treated/exposed ones. |
times |
The name of the variable related the numeric vector with the follow-up times. |
failures |
The name of the variable related the numeric vector with the event indicators (0=right censored, 1=event). |
max.time |
The maximum time of follow-up to estimate of restricted mean survival time (RMST). |
effect |
The type of marginal effect to be estimated. Three types are possible (see details): "ATE" (by default), "ATT" and "ATU". |
iterations |
The number of bootstrap resamples to estimate of the variances and the confidence intervals. |
n.cluster |
The number of cores to use, i.e., the upper limit for the number of child processes that run simultaneously (1 by default). |
cluster.type |
A character string with the type of parallelization. The default type is "PSOCK" (it calls makePSOCKcluster, faster on MacOS or Linux platforms). An alternative is "FORK" (it calls makeForkCluster, it does not work on Windows platforms). |
Details
The ATE corresponds to Average Treatment effect on the Entire population, i.e. the marginal effect if all the sample is treated versus all the sample is untreated. The ATT corresponds to Average Treatment effect on the Treated, i.e. the marginal effect if the treated patients (group
= 1) would have been untreated. The ATU corresponds to Average Treatment effect on the Untreated , i.e. the marginal effect if the untreated patients (group
= 0) would have been treated. The RMST is the mean survival time of all subjects in the study population followed up to max.time
.
Value
table.surv |
This data frame presents the survival probabilities ( |
effect |
A character string with the type of selected effect. |
max.time |
A scalar related to the maximum time of follow-up. |
RMST0 |
A table related to the RMST in the unexposed/untreated sample: |
RMST1 |
A table related to the RMST in the exposed/treated sample: |
delta |
A table related to the difference between the RMST in the exposed/treated sample minus in the unexposed/untreated one: |
logHR |
A table related to the logarithm of the average Hazard Ratio (HR): |
Author(s)
Yohann Foucher <Yohann.Foucher@univ-poitiers.fr>
Arthur Chatton <Arthur.Chatton@etu.univ-nantes.fr>
References
Chatton et al. G-computation and doubly robust standardisation for continuous-time data: A comparison with inverse probability weighting. Stat Methods Med Res. 31(4):706-718. 2022. <doi: 10.1177/09622802211047345>.
Examples
data(dataDIVAT2)
#Raw effect of the treatment
cox.raw <- coxph(Surv(times,failures) ~ ecd, data=dataDIVAT2, x=TRUE)
summary(cox.raw)
#Conditional effect of the treatment
cox.cdt <- coxph(Surv(times,failures) ~ ecd + age + retransplant,
data=dataDIVAT2, x=TRUE)
summary(cox.cdt)
#Marginal effect of the treatment (ATE): use 1000 iterations instead of 10
#We restricted to 10 to respect the CRAN policy in terms of time for computation
gc.ate <- gc.survival(object=cox.cdt, data=dataDIVAT2, group="ecd", times="times",
failures="failures", max.time=max(dataDIVAT2$times), iterations=10, effect="ATE",
n.cluster=1)
gc.ate
#Sum-up of the 3 HRs
data.frame( raw=exp(cox.raw$coefficients),
conditional=exp(cox.cdt$coefficients[1]),
marginal.ate=exp(gc.ate$logHR[,1]) )
#Plot the survival curves
plot(gc.ate, ylab="Confounder-adjusted survival",
xlab="Time post-transplantation (years)", col=c(1,2))