Efficient Estimation of the Causal Effects of Stochastic Interventions

**Authors:** Nima Hejazi and David Benkeser

`txshift`

?The `txshift`

R package is designed to provide facilities for the construction of efficient estimators of a causal parameter defined as the counterfactual mean of an outcome under stochastic mechanisms for treatment assignment (Díaz and van der Laan 2012). `txshift`

implements and builds upon a simplified algorithm for the targeted maximum likelihood (TML) estimator of such a causal parameter, originally proposed by Díaz and van der Laan (2018), and makes use of analogous machinery to compute an efficient one-step estimator (Pfanzagl and Wefelmeyer 1985). `txshift`

integrates with the `sl3`

package (Coyle et al. 2020) to allow for ensemble machine learning to be leveraged in the estimation procedure.

For many practical applications (e.g., vaccine efficacy trials), observed data is often subject to a two-phase sampling mechanism (i.e., through the use of a two-stage design). In such cases, efficient estimators (of both varieties) must be augmented to construct unbiased estimates of the population-level causal parameter. Rose and van der Laan (2011) first introduced an augmentation procedure that relies on introducing inverse probability of censoring (IPC) weights directly to an appropriate loss function or to the efficient influence function estimating equation. `txshift`

extends this approach to compute IPC-weighted one-step and TML estimators of the counterfactual mean under a stochastic treatment regime.

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(haldensify) set.seed(429153) # simulate simple data n_obs <- 1000 W <- replicate(2, rbinom(n_obs, 1, 0.5)) A <- rnorm(n_obs, mean = 2 * W, sd = 1) Y <- rbinom(n_obs, 1, plogis(A + W + rnorm(n_obs, mean = 0, sd = 1))) # now, let's introduce a a two-stage sampling process C <- rbinom(n_obs, 1, plogis(W + Y)) # fit the full-data TMLE (ignoring two-phase sampling) tmle <- txshift(W = W, A = A, Y = Y, delta = 0.5, estimator = "tmle", g_fit_args = list(fit_type = "hal", n_bins = 5, grid_type = "equal_mass", lambda_seq = exp(seq(-1, -9, length = 300))), Q_fit_args = list(fit_type = "glm", glm_formula = "Y ~ .") ) summary(tmle) #> lwr_ci param_est upr_ci param_var eif_mean estimator n_iter #> 0.7474 0.7782 0.8061 2e-04 7.0199e-11 tmle 0 # fit a full-data one-step estimator for comparison (again, no sampling) os <- txshift(W = W, A = A, Y = Y, delta = 0.5, estimator = "onestep", g_fit_args = list(fit_type = "hal", n_bins = 5, grid_type = "equal_mass", lambda_seq = exp(seq(-1, -9, length = 300))), Q_fit_args = list(fit_type = "glm", glm_formula = "Y ~ .") ) summary(os) #> lwr_ci param_est upr_ci param_var eif_mean estimator #> 0.7472 0.7779 0.8059 2e-04 -1.6704e-03 onestep #> n_iter #> 0 # fit an IPCW-TMLE to account for the two-phase sampling process ipcw_tmle <- txshift(W = W, A = A, Y = Y, delta = 0.5, C = C, V = c("W", "Y"), estimator = "tmle", max_iter = 5, ipcw_fit_args = list(fit_type = "glm"), g_fit_args = list(fit_type = "hal", n_bins = 5, grid_type = "equal_mass", lambda_seq = exp(seq(-1, -9, length = 300))), Q_fit_args = list(fit_type = "glm", glm_formula = "Y ~ ."), eif_reg_type = "glm" ) summary(ipcw_tmle) #> lwr_ci param_est upr_ci param_var eif_mean estimator #> 0.7435 0.7765 0.8063 3e-04 -4.0365e-05 tmle #> n_iter #> 1 # compare with an IPCW-agumented one-step estimator under two-phase sampling ipcw_os <- txshift(W = W, A = A, Y = Y, delta = 0.5, C = C, V = c("W", "Y"), estimator = "onestep", ipcw_fit_args = list(fit_type = "glm"), g_fit_args = list(fit_type = "hal", n_bins = 5, grid_type = "equal_mass", lambda_seq = exp(seq(-1, -9, length = 300))), Q_fit_args = list(fit_type = "glm", glm_formula = "Y ~ ."), eif_reg_type = "glm" ) summary(ipcw_os) #> lwr_ci param_est upr_ci param_var eif_mean estimator #> 0.7427 0.7758 0.8058 3e-04 -2.0555e-03 onestep #> n_iter #> 0

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:

```
@article{hejazi2020efficient,
author = {Hejazi, Nima S and {van der Laan}, Mark J and Janes, Holly
E and Gilbert, Peter B and Benkeser, David C},
title = {Efficient nonparametric inference on the effects of
stochastic interventions under two-phase sampling, with
applications to vaccine efficacy trials},
year = {2020},
url = {http://arxiv.org/abs/2003.13771}
}
@manual{hejazi2020txshift,
author = {Hejazi, Nima S and Benkeser, David C},
title = {{txshift}: Efficient Estimation of the Causal Effects of
Stochastic Interventions},
year = {2020},
url = {https://github.com/nhejazi/txshift},
note = {R package version 0.3.4}
}
```

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

© 2017-2020 Nima S. Hejazi

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

```
MIT License
Copyright (c) 2017-2020 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.
```

Coyle, Jeremy R, Nima S Hejazi, Ivana Malenica, and Oleg Sofrygin. 2020. *sl3: Modern Pipelines for Machine Learning and Super Learning*. https://github.com/tlverse/sl3. https://doi.org/10.5281/zenodo.1342293.

Coyle, Jeremy R, Nima S Hejazi, and Mark J van der Laan. 2019. *hal9001: The Scalable Highly Adaptive Lasso*. https://github.com/tlverse/hal9001. https://doi.org/10.5281/zenodo.3558313.

Díaz, Iván, and Nima S Hejazi. 2020. “Causal Mediation Analysis for Stochastic Interventions.” *Journal of the Royal Statistical Society: Series B (Statistical Methodology)*. Wiley Online Library. https://doi.org/10.1111/rssb.12362.

Díaz, Iván, and Mark J van der Laan. 2011. “Super Learner Based Conditional Density Estimation with Application to Marginal Structural Models.” *The International Journal of Biostatistics* 7 (1). De Gruyter: 1–20.

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

Pfanzagl, J, and W Wefelmeyer. 1985. “Contributions to a General Asymptotic Statistical Theory.” *Statistics & Risk Modeling* 3 (3-4): 379–88.

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.