Targeted Learning of the Causal Effects of Stochastic Interventions

**Authors:** Nima Hejazi and David Benkeser

`txshift`

?The `txshift`

R package is designed to provide facilities to compute targeted maximum likelihood estimates (TMLE) of the population-level causal effect of interventions based on stochastic mechanisms for treatment assignment (Díaz and van der Laan (2012)). As opposed to the original algorithm given for computing such a TMLE, `txshift`

implements and builds upon subsequent work by Díaz and van der Laan (2018), who reveal a simplified algorithm for computing the TML estimator of the shift intervention causal effect parameter.

For many practical applications (e.g., observational medical studies), it is often the case that the data structure of interest is generated by a selective sampling process (i.e., a two-stage design). In such cases, TML estimators may be augmented to cope with – and even exhibit efficiency – in spite of the challenges induced by such an artificial censoring process. This augmentation procedure is done by way of adding inverse probability of censoring weights (IPCW), which leads to an IPCW-TMLE, originally proposed by Rose and van der Laan (2011). `txshift`

extends the approach of computing IPCW-TMLEs to the shift intervention causal effect parameter.

For background on the Targeted Learning methodology, as well as recent advances, the canonical references are van der Laan and Rose (2011) and van der Laan and Rose (2018).

Install the most recent *stable release* from GitHub via `devtools`

:

`devtools::install_github("nhejazi/txshift", build_vignettes = FALSE)`

To illustrate how `txshift`

may be used to ascertain the effect of a treatment, consider the following example:

```
library(txshift)
library(condensier)
set.seed(429153)
# simulate simple data for tmle-shift sketch
n_obs <- 1000 # number of observations
n_w <- 1 # number of baseline covariates
p_w <- 0.5 # probability of a success ("1") in the baseline variables
tx_mult <- 2 # multiplier for the effect of W = 1 on the treatment
## baseline covariate -- simple, binary
W <- as.numeric(replicate(n_w, rbinom(n_obs, 1, p_w)))
## create treatment based on baseline W
A <- as.numeric(rnorm(n_obs, mean = tx_mult * W, sd = 1))
# create outcome as a linear function of A, W + white noise
Y <- A + W + rnorm(n_obs, mean = 0, sd = 1)
# fit the TMLE
tmle_shift <- tmle_txshift(W = W, A = A, Y = Y, delta = 0.5,
g_fit_args = list(fit_type = "glm",
nbins = 25,
bin_method = "dhist",
bin_estimator =
speedglmR6$new(),
parfit = FALSE),
Q_fit_args = list(fit_type = "glm",
glm_formula = "Y ~ .")
)
# conveniently summarize the results
summary(tmle_shift)
#> lwr_ci param_est upr_ci param_var eif_mean
#> 1.957777 2.098018 2.238259 0.00512 3.961214e-12
#> n_iter
#> 0
# now, let's introduce a censoring process (for two-stage sampling)
C <- rbinom(n_obs, 1, plogis(W + Y))
# fit an IPCW-TMLE to account for this censoring process:
ipcwtmle_shift <- tmle_txshift(W = W, A = A, Y = Y, delta = 0.5,
C = C, V = c("W", "Y"),
max_iter = 10, # limit iterations for speed
ipcw_fit_args = list(fit_type = "glm"),
g_fit_args = list(fit_type = "glm",
nbins = 25,
bin_method = "dhist",
bin_estimator =
speedglmR6$new(),
parfit = FALSE),
Q_fit_args = list(fit_type = "glm",
glm_formula = "Y ~ ."),
eif_reg_spec = FALSE # fit EIF with a GLM
)
# conveniently summarize the results
summary(ipcwtmle_shift)
#> lwr_ci param_est upr_ci param_var eif_mean
#> 1.693336 2.121628 2.549921 0.047751 2.161841e-08
#> n_iter
#> 10
```

Contributions are very welcome. Interested contributors should consult our contribution guidelines prior to submitting a pull request.

After using the `txshift`

R package, please cite the following:

```
@manual{hejazi2018txshift,
author = {Hejazi, Nima S and {van der Laan}, Mark J and Benkeser,
David C},
title = {txshift: {Targeted Learning} of the Causal Effects of
Stochastic Interventions in {R}},
year = {2018},
url = {https://github.com/nhejazi/txshift},
note = {R package version 0.2.0}
}
```

The development of this software was supported in part through a grant from the National Institutes of Health: T32 LM012417-02.

© 2017-2018 Nima S. Hejazi

The contents of this repository are distributed under the MIT license. See below for details:

```
MIT License
Copyright (c) 2017-2018 Nima S. Hejazi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

Díaz, Iván, and Mark J van der Laan. 2012. “Population Intervention Causal Effects Based on Stochastic Interventions.” *Biometrics* 68 (2). Wiley Online Library: 541–49.

———. 2018. “Stochastic Treatment Regimes.” In *Targeted Learning in Data Science: Causal Inference for Complex Longitudinal Studies*, 167–80. Springer Science & Business Media.

Rose, Sherri, and Mark J van der Laan. 2011. “A Targeted Maximum Likelihood Estimator for Two-Stage Designs.” *The International Journal of Biostatistics* 7 (1): 1–21.

van der Laan, Mark J, and Sherri Rose. 2011. *Targeted Learning: Causal Inference for Observational and Experimental Data*. Springer Science & Business Media.

———. 2018. *Targeted Learning in Data Science: Causal Inference for Complex Longitudinal Studies*. Springer Science & Business Media.