Discovery of Critical Thresholds in Mixed Exposures and Estimation of Policy Intervention Effects using Targeted Learning
Author: David McCoy
This package operationalizes the methodology presented here:
https://arxiv.org/abs/2302.07976
People often encounter multiple simultaneous exposures (e.g. several drugs or pollutants). Policymakers are interested in setting safe limits, interdictions, or recommended dosage combinations based on a combination of thresholds, one per exposure. Setting these thresholds is difficult because all relevant interactions between exposures must be accounted for. Previous statistical methods have used parametric estimators which do not directly address the question of safe exposure limits, rely on unrealistic assumptions, and do not result in a threshold based statistical quantity that is directly relevant to policy regulators.
Here we present an estimator that a) identifies thresholds that minimize/maximize the expected outcome controlling for covariates and other exposures; and which b) efficiently estimates a policy intervention which compares the expected outcome if everyone was forced to these safe levels compared to the observed outcome under observed exposure distribution.
This is done by using cross-validation where in training folds of the data, a custom g-computation tree-based search algorithm finds the minimizing region, and an estimation sample is used to estimate the policy intervention using targeted maximum likelihood estimation.
This package takes in a mixed exposure, covariates, outcome, super learner stacks of learners if determined (if not default are used), number of folds, minimum observations in a region, if the desired region is minimizer or maximizer and parallelization parameters.
The output are k-fold specific results for the region found in each fold with valid inference, a pooled estimate of the overall oracle parameter across all folds and pooled exposure sets if the region has some inconsistency across the folds.
Note: Because CVtreeMLE
package (currently) depends on sl3
that
allows ensemble machine learning to be used for nuisance parameter
estimation and sl3
is not on CRAN the CVtreeMLE
package is not
available on CRAN and must be downloaded here.
There are many dependencies for CVtreeMLE
so it’s easier to break up
installation of the various packages to ensure proper installation.
CVtreeMLE
uses the sl3
package to build ensemble machine learners
for each nuisance parameter.
Install sl3
on devel:
remotes::install_github("tlverse/sl3@devel")
Make sure sl3
installs correctly then install CVtreeMLE
remotes::install_github("blind-contours/CVtreeMLE@main")
First load the package and other packages needed
library(CVtreeMLE)
library(sl3)
library(dplyr)
library(kableExtra)
library(ggplot2)
seed <- 98484
set.seed(seed)
To illustrate how CVtreeMLE
may be used to find and estimate a region
that, if intervened on would lead to the biggest reduction in an outcome
we use synthetic data from the National Institute of Environmental
Health:
The 2015 NIEHS Mixtures Workshop was developed to determine if new
mixture methods detect ground-truth interactions built into the
simulated data. In this way we can simultaneously show CVtreeMLE
output, interpretation and validity.
For detailed information on this simulated data please see:
https://github.com/niehs-prime/2015-NIEHS-MIxtures-Workshop
niehs_data <- NIEHS_data_1
head(niehs_data) %>%
kableExtra::kbl(caption = "NIEHS Data") %>%
kableExtra::kable_classic(full_width = FALSE, html_font = "Cambria")
obs | Y | X1 | X2 | X3 | X4 | X5 | X6 | X7 | Z |
---|---|---|---|---|---|---|---|---|---|
1 | 7.534686 | 0.4157066 | 0.5308077 | 0.2223965 | 1.1592634 | 2.4577556 | 0.9438601 | 1.8714406 | 0 |
2 | 19.611934 | 0.5293572 | 0.9339570 | 1.1210595 | 1.3350074 | 0.3096883 | 0.5190970 | 0.2418065 | 0 |
3 | 12.664050 | 0.4849759 | 0.7210988 | 0.4629027 | 1.0334138 | 0.9492810 | 0.3664090 | 0.3502445 | 0 |
4 | 15.600288 | 0.8275456 | 1.0457137 | 0.9699040 | 0.9045099 | 0.9107914 | 0.4299847 | 1.0007901 | 0 |
5 | 18.606498 | 0.5190363 | 0.7802400 | 0.6142188 | 0.3729743 | 0.5038126 | 0.3575472 | 0.5906156 | 0 |
6 | 18.525890 | 0.4009491 | 0.8639886 | 0.5501847 | 0.9011016 | 1.2907615 | 0.7990418 | 1.5097039 | 0 |
Briefly, this synthetic data can be considered the results of a
prospective cohort epidemiologic study. The outcome cannot cause the
exposures (as might occur in a cross-sectional study). Correlations
between exposure variables can be thought of as caused by common sources
or modes of exposure. The nuisance variable Z can be assumed to be a
potential confounder and not a collider. There are 7 exposures which
have a complicated dependency structure.
One issue is that many machine learning algorithms will fail given only 1 variable passed as a feature so let’s add some other covariates.
niehs_data$Z2 <- rbinom(nrow(niehs_data),
size = 1,
prob = 0.3
)
niehs_data$Z3 <- rbinom(nrow(niehs_data),
size = 1,
prob = 0.1
)
ptm <- proc.time()
# Convert continuous X variables to their corresponding deciles for example
niehs_data <- niehs_data %>%
mutate(across(starts_with("X"), ~ ntile(., 10), .names = "decile_{col}"))
niehs_results <- CVtreeMLE(
data = as.data.frame(niehs_data),
w = c("Z", "Z2", "Z3"),
a = c("decile_X1", "decile_X2", "decile_X3", "decile_X4", "decile_X5", "decile_X6", "decile_X7"),
y = "Y",
n_folds = 7,
seed = seed,
parallel_cv = TRUE,
parallel = TRUE,
family = "continuous",
num_cores = 8,
min_max = "min",
max_depth = 2,
min_obs = 25
)
proc.time() - ptm
#> user system elapsed
#> 7.184 0.816 91.497
First let’s look at the k-fold specific estimates:
k_fold_results <- niehs_results$`V-Specific Mix Results`
k_fold_results %>%
kableExtra::kbl(caption = "K-fold Results") %>%
kableExtra::kable_classic(full_width = FALSE, html_font = "Cambria")
are | se | lower_ci | upper_ci | p_val | p_val_adj | rmse | mix_rule | fold | variables |
---|---|---|---|---|---|---|---|---|---|
-2.876 | 20.006 | -42.087 | 36.335 | 0.885677 | 1 | 4.118 | decile_X1 \<= 5 & decile_X7 \<= 3 | 1 | decile_X1-decile_X7 |
-2.733 | 20.039 | -42.009 | 36.544 | 0.891537 | 1 | 4.123 | decile_X1 \<= 5 & decile_X7 \<= 4 | 2 | decile_X1-decile_X7 |
-3.061 | 24.969 | -51.999 | 45.878 | 0.902437 | 1 | 5.026 | decile_X1 \<= 5 & decile_X7 \<= 3 | 3 | decile_X1-decile_X7 |
-2.196 | 18.755 | -38.955 | 34.564 | 0.906806 | 1 | 4.452 | decile_X1 \<= 5 & decile_X7 \<= 3 | 4 | decile_X1-decile_X7 |
-3.257 | 21.951 | -46.280 | 39.765 | 0.882028 | 1 | 4.489 | decile_X1 \<= 5 & decile_X7 \<= 4 | 5 | decile_X1-decile_X7 |
-3.371 | 16.739 | -36.178 | 29.436 | 0.840393 | 1 | 4.000 | decile_X1 \<= 5 & decile_X7 \<= 3 | 6 | decile_X1-decile_X7 |
-3.441 | 21.135 | -44.864 | 37.982 | 0.870658 | 1 | 4.491 | decile_X1 \<= 5 & decile_X7 \<= 4 | 7 | decile_X1-decile_X7 |
This indicates that the exposure X2 was found in every fold to have the most minimizing impact on endocrine disruption if all individuals were were forced to be exposed to levels less around 0.41. This resembles a policy where, if everyone were still exposed to the other exposures but we created a regulation that restricted individuals to only exposure of X2 less than 0.41.
The pooled estimates, leveraging all the folds for our estimates oracle target parameter looks like:
pooled_mixture_results <- niehs_results$`Oracle Region Results`
pooled_mixture_results %>%
kableExtra::kbl(caption = "Oracle Mixture Results") %>%
kableExtra::kable_classic(full_width = FALSE, html_font = "Cambria")
Region ARE | Standard Error | Lower CI | Upper CI | P-value |
---|---|---|---|---|
-3.12 | 7.776 | -18.361 | 12.121 | 0.688247 |
Additional details for this and other features are given in the vignette.
If you encounter any bugs or have any specific feature requests, please file an issue. Further details on filing issues are provided in our contribution guidelines.
Contributions are very welcome. Interested contributors should consult our contribution guidelines prior to submitting a pull request.
After using the CVtreeMLE
R package, please cite the following:
@article{McCoy2023,
doi = {10.21105/joss.04181},
url = {https://doi.org/10.21105/joss.04181},
year = {2023}, publisher = {The Open Journal},
volume = {8}, number = {82}, pages = {4181},
author = {David McCoy and Alan Hubbard and Mark Van der Laan},
title = {CVtreeMLE: Efficient Estimation of Mixed Exposures using Data Adaptive Decision Trees and Cross-Validated Targeted Maximum Likelihood Estimation in R},
journal = {Journal of Open Source Software} }
- R/
sl3
- An R package providing implementation for Super Learner ensemble machine learning algorithms.
The development of this software was supported in part through grants from the NIH-funded Biomedical Big Data Training Program at UC Berkeley where I was a biomedical big data fellow.
© 2017-2024 David B. McCoy
The contents of this repository are distributed under the MIT license. See below for details:
MIT License
Copyright (c) 2017-2024 David B. McCoy
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.