# Average treatment effect (ATE) for Competing risks and binary outcomes

#### Klaus Holst & Thomas Scheike

#### 2021-09-05

# Average treatment for Competing risks data

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\).

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 function 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.

- We estimate the average treatment effect of our binary response \(I(T \leq t, \epsilon=1)\)
  - Using a working logistic model for the resonse
  - Using a working logistic model for treatment given covariates
  - Using a working model for censoring given covariates, here a stratified Kaplan-Meier.

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

- A working logistic model for the resonse
- A working logistic model for treatment given covariates

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

- \(A_i\) is treatment indicator
- \(\pi_A(X_i) = P(A_i=1|X_i)\) is treatment model
- \(Y_i\) outcome, that in case of censoring is censoring adjusted \(\tilde Y_i \Delta(t) /G_c(T_i- \wedge t)\)
- \(\tilde Y_i = I(T_i \leq t, \epsilon_i=1)\) oucome before censoring.
- \(m_j(X_i)=P(Y_i=1| A_i=j,X_i)\) is outcome model, using binomial regression to estimate.

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.

- Censoring model by strata used for phreg

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.

# Average treatment effect

First we simulate some data that mimics that 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)

    n <- 3000
    kumar <- kumarsim(n,depcens=1)
    kumar$cause <- kumar$status
    kumar$ttt24 <- kumar[,6]
    dtable(kumar,~cause)
    #>
    #> cause
    #>    0    1    2
    #>  977  923 1100

    c2 <- binregATE(Event(time,cause)~gp+dnr+preauto+ttt24,kumar,cause=2,
        treat.model=gp~dnr+preauto+ttt24,time=40,cens.model=~strata(gp,dnr,preauto,ttt24))
    #> Warning in log(1 - diff(hazt)): NaNs produced
    summary(c2)
    #>
    #>     n events
    #>  3000   1034
    #>
    #>  3000 clusters
    #> coeffients:
    #>              Estimate   Std.Err      2.5%     97.5% P-value
    #> (Intercept) -1.144519  0.074491 -1.290518 -0.998521  0.0000
    #> gp           0.564363  0.093219  0.381657  0.747069  0.0000
    #> dnr          0.265688  0.099681  0.070316  0.461060  0.0077
    #> preauto      0.550741  0.104465  0.345994  0.755489  0.0000
    #> ttt24        0.387195  0.102527  0.186245  0.588145  0.0002
    #>
    #> exp(coeffients):
    #>             Estimate    2.5%  97.5%
    #> (Intercept)  0.31838 0.27513 0.3684
    #> gp           1.75833 1.46471 2.1108
    #> dnr          1.30433 1.07285 1.5858
    #> preauto      1.73454 1.41339 2.1287
    #> ttt24        1.47284 1.20472 1.8006
    #>
    #> Average Treatment effects (G-formula) :
    #>             Estimate  Std.Err     2.5%    97.5% P-value
    #> treat-1     0.471129 0.015396 0.440954 0.501305       0
    #> treat-0     0.341729 0.014408 0.313489 0.369968       0
    #> differenceG 0.129400 0.021447 0.087365 0.171436       0
    #>
    #> Average Treatment effects (double robust) :
    #>              Estimate  Std.Err     2.5%    97.5% P-value
    #> treat-1      0.468832 0.016126 0.437226 0.500439       0
    #> treat-0      0.331948 0.015241 0.302076 0.361820       0
    #> differenceDR 0.136885 0.022034 0.093699 0.180070       0
    #>
    #> Average Treatment effects on Treated/Non-Treated (DR) :
    #>      Estimate   Std.Err      2.5%     97.5% P-value
    #> ATT  0.149604  0.024858  0.100884  0.198324       0
    #> ATC -0.109435  0.019324 -0.147309 -0.071562       0

    c1 <- binregATE(Event(time,cause)~gp+dnr+preauto+ttt24,kumar,cause=2,
            treat.model=gp~dnr+preauto+ttt24,time=60)
    summary(c1)
    #>
    #>     n events
    #>  3000   1077
    #>
    #>  3000 clusters
    #> coeffients:
    #>              Estimate   Std.Err      2.5%     97.5% P-value
    #> (Intercept) -0.651812  0.084818 -0.818051 -0.485572  0.0000
    #> gp          -0.070369  0.106124 -0.278368  0.137629  0.5073
    #> dnr          0.479700  0.106637  0.270695  0.688705  0.0000
    #> preauto      0.344222  0.106440  0.135604  0.552840  0.0012
    #> ttt24        0.413397  0.106359  0.204937  0.621856  0.0001
    #>
    #> exp(coeffients):
    #>             Estimate    2.5%  97.5%
    #> (Intercept)  0.52110 0.44129 0.6153
    #> gp           0.93205 0.75702 1.1475
    #> dnr          1.61559 1.31088 1.9911
    #> preauto      1.41089 1.14523 1.7382
    #> ttt24        1.51194 1.22745 1.8624
    #>
    #> Average Treatment effects (G-formula) :
    #>              Estimate   Std.Err      2.5%     97.5% P-value
    #> treat-1      0.433102  0.014000  0.405663  0.460541   0.000
    #> treat-0      0.449694  0.018697  0.413048  0.486340   0.000
    #> differenceG -0.016592  0.025007 -0.065604  0.032420   0.507
    #>
    #> Average Treatment effects (double robust) :
    #>               Estimate   Std.Err      2.5%     97.5% P-value
    #> treat-1       0.434568  0.014495  0.406159  0.462977  0.0000
    #> treat-0       0.447025  0.020666  0.406520  0.487529  0.0000
    #> differenceDR -0.012456  0.025751 -0.062927  0.038014  0.6286
    #>
    #> Average Treatment effects on Treated/Non-Treated (DR) :
    #>      Estimate   Std.Err      2.5%     97.5% P-value
    #> ATT -0.011896  0.029855 -0.070411  0.046619  0.6903
    #> ATC -0.238359  0.021175 -0.279862 -0.196856  0.0000

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.

# Average treatment effect for binary data

In the binary case a binary outcome is specified instead of the survival outcome, and as a consequence no-censoring adjustment is done

- the binary outcome must be a variable in the data-frame

    kumar$cause2 <- 1*(kumar$cause==2)

    b3 <- logitATE(cause2~gp+dnr+preauto+ttt24,kumar,treat.model=gp~dnr+preauto+ttt24)
    summary(b3)
    #>
    #>     n events
    #>  3000   1100
    #>
    #>  3000 clusters
    #> coeffients:
    #>              Estimate   Std.Err      2.5%     97.5% P-value
    #> (Intercept) -0.993219  0.068514 -1.127504 -0.858935  0.0000
    #> gp           0.052314  0.086223 -0.116681  0.221308  0.5440
    #> dnr          0.415101  0.086440  0.245681  0.584520  0.0000
    #> preauto      0.322253  0.090074  0.145710  0.498795  0.0003
    #> ttt24        0.370318  0.087084  0.199637  0.540999  0.0000
    #>
    #> exp(coeffients):
    #>             Estimate    2.5%  97.5%
    #> (Intercept)  0.37038 0.32384 0.4236
    #> gp           1.05371 0.88987 1.2477
    #> dnr          1.51452 1.27849 1.7941
    #> preauto      1.38023 1.15686 1.6467
    #> ttt24        1.44820 1.22096 1.7177
    #>
    #> Average Treatment effects (G-formula) :
    #>              Estimate   Std.Err      2.5%     97.5% P-value
    #> treat-1      0.371772  0.012232  0.347797  0.395747   0.000
    #> treat-0      0.360052  0.013949  0.332713  0.387391   0.000
    #> differenceG  0.011720  0.019317 -0.026140  0.049580   0.544
    #>
    #> Average Treatment effects (double robust) :
    #>               Estimate   Std.Err      2.5%     97.5% P-value
    #> treat-1       0.373698  0.012744  0.348721  0.398675  0.0000
    #> treat-0       0.360589  0.015071  0.331050  0.390127  0.0000
    #> differenceDR  0.013109  0.019589 -0.025284  0.051502  0.5034
    #>
    #> Average Treatment effects on Treated/Non-Treated (DR) :
    #>      Estimate   Std.Err      2.5%     97.5% P-value
    #> ATT  0.010957  0.022249 -0.032650  0.054565  0.6224
    #> ATC -0.177951  0.016869 -0.211014 -0.144888  0.0000

    ## quite similar to binregATE
    b2 <- logitATE(Event(time,cause)~gp+dnr+preauto+ttt24,kumar,cause=2,time=60,treat.model=gp~dnr+preauto+ttt24)
    summary(b2)
    #>
    #>     n events
    #>  3000   1077
    #>
    #>  3000 clusters
    #> coeffients:
    #>              Estimate   Std.Err      2.5%     97.5% P-value
    #> (Intercept) -1.003783  0.073866 -1.148557 -0.859008  0.0000
    #> gp           0.868828  0.099424  0.673961  1.063696  0.0000
    #> dnr          0.087348  0.103878 -0.116249  0.290944  0.4004
    #> preauto      0.668256  0.107566  0.457432  0.879081  0.0000
    #> ttt24        0.307429  0.104997  0.101639  0.513219  0.0034
    #>
    #> exp(coeffients):
    #>             Estimate    2.5%  97.5%
    #> (Intercept)  0.36649 0.31709 0.4236
    #> gp           2.38412 1.96199 2.8971
    #> dnr          1.09128 0.89025 1.3377
    #> preauto      1.95083 1.58001 2.4087
    #> ttt24        1.35992 1.10698 1.6707
    #>
    #> Average Treatment effects (G-formula) :
    #>             Estimate  Std.Err     2.5%    97.5% P-value
    #> treat-1     0.570505 0.016420 0.538323 0.602688       0
    #> treat-0     0.366012 0.015136 0.336346 0.395678       0
    #> differenceG 0.204494 0.023522 0.158391 0.250596       0
    #>
    #> Average Treatment effects (double robust) :
    #>               Estimate   Std.Err      2.5%     97.5% P-value
    #> treat-1       0.434652  0.014510  0.406213  0.463090  0.0000
    #> treat-0       0.448260  0.020636  0.407814  0.488705  0.0000
    #> differenceDR -0.013608  0.025901 -0.064373  0.037157  0.5993
    #>
    #> Average Treatment effects on Treated/Non-Treated (DR) :
    #>      Estimate   Std.Err      2.5%     97.5% P-value
    #> ATT -0.014123  0.029921 -0.072767  0.044522  0.6369
    #> ATC -0.238172  0.023013 -0.283276 -0.193067  0.0000

# SessionInfo

    sessionInfo()
    #> R version 4.1.1 (2021-08-10)
    #> Platform: x86_64-apple-darwin20.4.0 (64-bit)
    #> Running under: macOS Big Sur 11.5.2
    #>
    #> Matrix products: default
    #> BLAS:   /usr/local/Cellar/openblas/0.3.17/lib/libopenblasp-r0.3.17.dylib
    #> LAPACK: /usr/local/Cellar/r/4.1.1/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.2.9      lava_1.6.11     timereg_2.0.0   survival_3.2-13
    #>
    #> loaded via a namespace (and not attached):
    #>  [1] Rcpp_1.0.7          bslib_0.2.5.1       compiler_4.1.1
    #>  [4] jquerylib_0.1.4     tools_4.1.1         digest_0.6.27
    #>  [7] jsonlite_1.7.2      evaluate_0.14       lattice_0.20-44
    #> [10] ucminf_1.1-4        rlang_0.4.11        Matrix_1.3-4
    #> [13] yaml_2.2.1          parallel_4.1.1      mvtnorm_1.1-2
    #> [16] xfun_0.25           fastmap_1.1.0       stringr_1.4.0
    #> [19] knitr_1.33          sass_0.4.0          globals_0.14.0
    #> [22] grid_4.1.1          listenv_0.8.0       R6_2.5.1
    #> [25] future.apply_1.8.1  parallelly_1.27.0   rmarkdown_2.10
    #> [28] magrittr_2.0.1      codetools_0.2-18    htmltools_0.5.2
    #> [31] splines_4.1.1       future_1.22.1       numDeriv_2016.8-1.1
    #> [34] stringi_1.7.4