The binreg function does direct binomial regression for one time-point, \(t\), fitting the model \[\begin{align*} P(T \leq t, \epsilon=1 | X ) & = \mbox{expit}( X^T beta), \end{align*}\] the estimation is based on IPCW weighted EE \[\begin{align*} U(\beta) = & X \left( \Delta(t) I(T \leq t, \epsilon=1 )/G_c(T \wedge t) - \mbox{expit}( X^T beta) \right) = 0 \end{align*}\] for IPCW adjusted responses and with \(\Delta\) indicator of death and \(G_c\) censoring survival distribution. With \(\Delta(t) = I( C > T \wedge t)\).
The function logitIPCW instead considers \[\begin{align*} U(\beta) = & X \frac{\Delta(t)}{G_c(T \wedge t)} \left( I(T \leq t, \epsilon=1 ) - \mbox{expit}( X^T beta) \right) = 0. \end{align*}\] The two score equations are quite similar, and exactly the same when the censoring model is fully-nonparametric given \(X\). It seems that the binreg estimating equations most often the preferable ones to use.
Additional functions logitATE, and binregATE computes the average treatment effect, the average effect on treated (ATT), and the average effect on non-treated (ATC). We demonstrate their use below.
The functions binregATE (recommended) and logitATE also works when there is no censoring and we thus have simple binary outcome.
Variance is based on sandwich formula with IPCW adjustment, and naive.var is variance under known censoring model. The influence functions are stored in the output.
If there are no censoring then the censoring weights are simply put to 1.
The average treatment effect is \[\begin{align*} E(Y(1) - Y(0)) \end{align*}\] using counterfactual outcomes.
We compute the simple G-estimator \[\begin{align*} \sum m_a(X_i) \end{align*}\] to estimate the risk \(E(Y(a))\).
The DR-estimator instead uses the estimating equations that are double robust wrt
This is estimated using the estimator \[\begin{align*} \sum \left[ \frac{A_i Y_i}{\pi_A(X_i)}-\frac{A_i - \pi_A(X_i)}{\pi_A(X_i)} m_1(X_i) \right] - \left[ \frac{(1-A_i) Y_i}{1-\pi_A(X_i)}+\frac{A_i - \pi_A(X_i)}{1-\pi_A(X_i)} m_0(X_i) \right] \end{align*}\] where
The standard errors are then based on an iid decomposition using taylor-expansion for the parameters of the treatment-model and the outcome-model, and the censoring probability.
Needs that the censoring model is correct, so it can be important to use a sufficiently large censorng model as we also illustrate below.
Also compute standard marginalization for average treatment effect (called differenceG) \[\begin{align*} \sum \left[ m_1(X_i) - m_0(X_i) \right] \end{align*}\] and again standard errors are based on the related influcence functions and are also returned.
First we simulate some data that mimics that of Kumar et al 2012. This is data from multiple myeloma patients treated with allogeneic stem cell transplantation from the Center for International Blood and Marrow Transplant Research (CIBMTR) Kumar et al (2012), “Trends in allogeneic stem cell transplantation for multiple myeloma: a CIBMTR analysis”. The data used in this paper consist of patients transplanted from 1995 to 2005, and we compared the outcomes between transplant periods: 2001-2005 (N=488) versus 1995-2000 (N=375). The two competing events were relapse and treatment-related mortality (TRM) defined as death without relapse. considered the following risk covariates: transplant time period (gp (main interest of the study): 1 for transplanted in 2001-2005 versus 0 for transplanted in 1995-2000), donor type (dnr: 1 for Unrelated or other related donor (N=280) versus 0 for HLA-identical sibling (N=584)), prior autologous transplant (preauto: 1 for Auto+Allo transplant (N=399) versus 0 for allogeneic transplant alone (N=465)) and time to transplant (ttt24: 1 for more than 24 months (N=289) versus 0 for less than or equal to 24 months (N=575))).
We here generate similar data by assuming that the two cumlative incidence curves are logistic and we have censoring that depends on the covariates via a Cox model. All this is wrapped in the kumarsim function. The simulation does not deal with possible violations of the bound that \(F_1+F_2 < 1\). But as we increase the sample size we still see that we recover the parameters of cause 2.
library(mets)
set.seed(100)
<- 400
n <- kumarsim(n,depcens=1)
kumar $cause <- kumar$status
kumar$ttt24 <- kumar[,6]
kumardtable(kumar,~cause)
#>
#> cause
#> 0 1 2
#> 122 126 152
dfactor(kumar) <- gp.f~gp
### censoring model must be adapted to size of data
###c2 <- binregATE(Event(time,cause)~gp.f+dnr+preauto+ttt24,kumar,cause=2,
### treat.model=gp.f~dnr+preauto+ttt24,time=40,cens.model=~strata(gp,dnr,preauto,ttt24))
###summary(c2)
<- binregATE(Event(time,cause)~gp.f+dnr+preauto+ttt24,kumar,cause=2,
c2 treat.model=gp.f~dnr+preauto+ttt24,time=40,cens.model=~strata(gp,dnr))
summary(c2)
#>
#> n events
#> 400 144
#>
#> 400 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -1.05194 0.21327 -1.46993 -0.63395 0.0000
#> gp.f1 0.74736 0.26024 0.23730 1.25741 0.0041
#> dnr 0.24186 0.26393 -0.27544 0.75916 0.3595
#> preauto 0.37081 0.29377 -0.20497 0.94659 0.2069
#> ttt24 0.20367 0.29270 -0.37000 0.77734 0.4865
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 0.34926 0.22994 0.5305
#> gp.f1 2.11141 1.26782 3.5163
#> dnr 1.27362 0.75924 2.1365
#> preauto 1.44891 0.81468 2.5769
#> ttt24 1.22589 0.69073 2.1757
#>
#> Average Treatment effects (G-formula) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> treat0 0.328953 0.040459 0.249654 0.408251 0.0000
#> treat1 0.504878 0.041575 0.423393 0.586362 0.0000
#> treat:1-0 0.175925 0.060798 0.056764 0.295087 0.0038
#>
#> Average Treatment effects (double robust) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> treat0 0.312621 0.040994 0.232274 0.392967 0.0000
#> treat1 0.496317 0.043169 0.411707 0.580926 0.0000
#> treat:1-0 0.183696 0.059693 0.066700 0.300692 0.0021
<- binregATE(Event(time,cause)~gp.f+dnr+preauto+ttt24,kumar,cause=2,
c1 treat.model=gp.f~dnr+preauto+ttt24,time=60)
summary(c1)
#>
#> n events
#> 400 150
#>
#> 400 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -0.657017 0.234686 -1.116993 -0.197040 0.0051
#> gp.f1 0.102286 0.293157 -0.472291 0.676863 0.7272
#> dnr 0.574571 0.319460 -0.051558 1.200701 0.0721
#> preauto 0.164113 0.302361 -0.428504 0.756730 0.5873
#> ttt24 0.596183 0.326051 -0.042864 1.235230 0.0675
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 0.51840 0.32726 0.8212
#> gp.f1 1.10770 0.62357 1.9677
#> dnr 1.77637 0.94975 3.3224
#> preauto 1.17835 0.65148 2.1313
#> ttt24 1.81518 0.95804 3.4392
#>
#> Average Treatment effects (G-formula) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> treat0 0.452073 0.052419 0.349333 0.554813 0.0000
#> treat1 0.476115 0.038011 0.401615 0.550615 0.0000
#> treat:1-0 0.024042 0.068950 -0.111097 0.159181 0.7273
#>
#> Average Treatment effects (double robust) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> treat0 0.432878 0.053526 0.327969 0.537787 0.0000
#> treat1 0.467654 0.040089 0.389081 0.546228 0.0000
#> treat:1-0 0.034777 0.068783 -0.100035 0.169589 0.6131
We note that correct estimates that found using the large censoring model are very different from those using the simple Kaplan-Meier weights that are severely biased for these data. This is due to a stong censoring dependence.
The average treatment is around \(0.17 = E(Y(1) - Y(0))\) at time 60 for the transplant period, under the standard causal assumptions. We here use the logistic model and a treat model that is also logistic. The 1/0 variable used for the causal computation is found as the rhs of the treat.model.
In the binary case a binary outcome is specified instead of the survival outcome, and as a consequence no-censoring adjustment is done
First binnary outcome (can also use binregATE koding cause without censorings values, so setting cens.code=2, and time large)
$cause2 <- 1*(kumar$cause==2)
kumar
<- logitATE(cause2~gp+dnr+preauto+ttt24,kumar,treat.model=gp~dnr+preauto+ttt24)
b3 summary(b3)
#>
#> n events
#> 400 152
#>
#> 400 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -1.07282963 0.19388190 -1.45283117 -0.69282808 0.0000
#> gp 0.26229718 0.23212023 -0.19265012 0.71724448 0.2585
#> dnr 0.47162640 0.24030425 0.00063871 0.94261408 0.0497
#> preauto 0.26934293 0.24156220 -0.20411028 0.74279614 0.2648
#> ttt24 0.40066829 0.24437556 -0.07829902 0.87963559 0.1011
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 0.34204 0.23391 0.5002
#> gp 1.29991 0.82477 2.0488
#> dnr 1.60260 1.00064 2.5667
#> preauto 1.30910 0.81537 2.1018
#> ttt24 1.49282 0.92469 2.4100
#>
#> Average Treatment effects (G-formula) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> treat-1 0.404802 0.033367 0.339404 0.470200 0.0000
#> treat-0 0.345704 0.037959 0.271306 0.420102 0.0000
#> Difference 0.059098 0.052111 -0.043037 0.161232 0.2568
#>
#> Average Treatment effects (double robust) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> treat-1 0.398074 0.034407 0.330637 0.465511 0.0000
#> treat-0 0.331726 0.039466 0.254375 0.409078 0.0000
#> Difference 0.066348 0.052260 -0.036080 0.168775 0.2042
#>
#> Average Treatment effects on Treated/Non-Treated (DR) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> ATT 0.083954 0.059846 -0.033341 0.201250 0.1607
#> ATC -0.138652 0.047566 -0.231879 -0.045425 0.0036
<- binregATE(Event(time,cause2)~gp.f+dnr+preauto+ttt24,kumar,treat.model=gp.f~dnr+preauto+ttt24,cens.code=2,time=200)
b4 summary(b4)
#>
#> n events
#> 400 152
#>
#> 400 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -1.07282963 0.19388190 -1.45283117 -0.69282808 0.0000
#> gp.f1 0.26229718 0.23212023 -0.19265012 0.71724448 0.2585
#> dnr 0.47162640 0.24030425 0.00063871 0.94261408 0.0497
#> preauto 0.26934293 0.24156220 -0.20411028 0.74279614 0.2648
#> ttt24 0.40066829 0.24437556 -0.07829902 0.87963559 0.1011
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 0.34204 0.23391 0.5002
#> gp.f1 1.29991 0.82477 2.0488
#> dnr 1.60260 1.00064 2.5667
#> preauto 1.30910 0.81537 2.1018
#> ttt24 1.49282 0.92469 2.4100
#>
#> Average Treatment effects (G-formula) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> treat0 0.345704 0.037959 0.271306 0.420102 0.0000
#> treat1 0.404802 0.033367 0.339404 0.470200 0.0000
#> treat:1-0 0.059098 0.052111 -0.043037 0.161232 0.2568
#>
#> Average Treatment effects (double robust) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> treat0 0.331726 0.039466 0.254375 0.409078 0.0000
#> treat1 0.398074 0.034407 0.330637 0.465511 0.0000
#> treat:1-0 0.066348 0.052260 -0.036080 0.168775 0.2042
Or with continuous response using normal estiamating equations
<- normalATE(time~gp+dnr+preauto+ttt24,kumar,treat.model=gp~dnr+preauto+ttt24)
b3 summary(b3)
#>
#> n events
#> 400 6804.193
#>
#> 400 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) 27.80015 3.30304 21.32631 34.27399 0.0000
#> gp -16.06100 3.25515 -22.44098 -9.68102 0.0000
#> dnr -6.51649 3.16550 -12.72075 -0.31223 0.0395
#> preauto 1.66745 2.93033 -4.07590 7.41080 0.5693
#> ttt24 -1.12151 3.27807 -7.54640 5.30338 0.7323
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 1.1843e+12 1.8277e+09 7.6737e+14
#> gp 1.0588e-07 1.7948e-10 1.0000e-04
#> dnr 1.4788e-03 2.9885e-06 7.3180e-01
#> preauto 5.2986e+00 1.6977e-02 1.6537e+03
#> ttt24 3.2579e-01 5.2801e-04 2.0102e+02
#>
#> Average Treatment effects (G-formula) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> treat-1 10.1846 1.0464 8.1336 12.2355 0
#> treat-0 26.2456 2.9998 20.3660 32.1251 0
#> Difference -16.0610 3.2552 -22.4410 -9.6810 0
#>
#> Average Treatment effects (double robust) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> treat-1 10.7094 1.0007 8.7481 12.6707 0
#> treat-0 28.0289 3.2124 21.7328 34.3251 0
#> Difference -17.3195 3.3652 -23.9153 -10.7238 0
#>
#> Average Treatment effects on Treated/Non-Treated (DR) :
#> Estimate Std.Err 2.5% 97.5% P-value
#> ATT -19.1625 4.2750 -27.5414 -10.7836 0
#> ATC -20.7176 3.1222 -26.8371 -14.5981 0
sessionInfo()
#> R version 4.2.1 (2022-06-23)
#> Platform: x86_64-apple-darwin21.5.0 (64-bit)
#> Running under: macOS Monterey 12.5.1
#>
#> Matrix products: default
#> BLAS: /usr/local/Cellar/openblas/0.3.21/lib/libopenblasp-r0.3.21.dylib
#> LAPACK: /usr/local/Cellar/r/4.2.1_2/lib/R/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] mets_1.3.0 lava_1.7.0 timereg_2.0.2 survival_3.3-1
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.9 bslib_0.3.1 compiler_4.2.1
#> [4] jquerylib_0.1.4 tools_4.2.1 digest_0.6.29
#> [7] jsonlite_1.8.0 evaluate_0.15 lattice_0.20-45
#> [10] ucminf_1.1-4 rlang_1.0.2 Matrix_1.4-1
#> [13] cli_3.3.0 yaml_2.3.5 parallel_4.2.1
#> [16] mvtnorm_1.1-3 xfun_0.30 fastmap_1.1.0
#> [19] stringr_1.4.0 knitr_1.37 sass_0.4.0
#> [22] globals_0.16.1 grid_4.2.1 listenv_0.8.0
#> [25] R6_2.5.1 future.apply_1.9.0 parallelly_1.32.1
#> [28] rmarkdown_2.13 magrittr_2.0.2 codetools_0.2-18
#> [31] htmltools_0.5.2 splines_4.2.1 future_1.27.0
#> [34] numDeriv_2016.8-1.1 stringi_1.7.6