All Projects → benkeser → drtmle

benkeser / drtmle

Licence: other
Nonparametric estimators of the average treatment effect with doubly-robust confidence intervals and hypothesis tests

Programming Languages

r
7636 projects
Makefile
30231 projects

Projects that are alternatives of or similar to drtmle

survtmle
Targeted Learning for Survival Analysis
Stars: ✭ 18 (+28.57%)
Mutual labels:  tmle, ensemble-learning
Pgmpy
Python Library for learning (Structure and Parameter) and inference (Probabilistic and Causal) in Bayesian Networks.
Stars: ✭ 1,942 (+13771.43%)
Mutual labels:  statistical-inference, causal-inference
PyNets
A Reproducible Workflow for Structural and Functional Connectome Ensemble Learning
Stars: ✭ 114 (+714.29%)
Mutual labels:  ensemble-learning
KissABC.jl
Pure julia implementation of Multiple Affine Invariant Sampling for efficient Approximate Bayesian Computation
Stars: ✭ 28 (+100%)
Mutual labels:  statistical-inference
SIN
Causal Effect Inference for Structured Treatments (SIN) (NeurIPS 2021)
Stars: ✭ 32 (+128.57%)
Mutual labels:  causal-inference
perfect match
➕➕ Perfect Match is a simple method for learning representations for counterfactual inference with neural networks.
Stars: ✭ 100 (+614.29%)
Mutual labels:  causal-inference
RECCON
This repository contains the dataset and the PyTorch implementations of the models from the paper Recognizing Emotion Cause in Conversations.
Stars: ✭ 126 (+800%)
Mutual labels:  causal-inference
stremr
Streamlined Estimation for Static, Dynamic and Stochastic Treatment Regimes in Longitudinal Data
Stars: ✭ 33 (+135.71%)
Mutual labels:  tmle
Ensemble-of-Multi-Scale-CNN-for-Dermatoscopy-Classification
Fully supervised binary classification of skin lesions from dermatoscopic images using an ensemble of diverse CNN architectures (EfficientNet-B6, Inception-V3, SEResNeXt-101, SENet-154, DenseNet-169) with multi-scale input.
Stars: ✭ 25 (+78.57%)
Mutual labels:  ensemble-learning
causal-ml
Must-read papers and resources related to causal inference and machine (deep) learning
Stars: ✭ 387 (+2664.29%)
Mutual labels:  causal-inference
policytree
Policy learning via doubly robust empirical welfare maximization over trees
Stars: ✭ 59 (+321.43%)
Mutual labels:  causal-inference
causeinfer
Machine learning based causal inference/uplift in Python
Stars: ✭ 45 (+221.43%)
Mutual labels:  causal-inference
pycobra
python library implementing ensemble methods for regression, classification and visualisation tools including Voronoi tesselations.
Stars: ✭ 111 (+692.86%)
Mutual labels:  ensemble-learning
Shapley regressions
Statistical inference on machine learning or general non-parametric models
Stars: ✭ 37 (+164.29%)
Mutual labels:  statistical-inference
Skin Lesions Classification DCNNs
Transfer Learning with DCNNs (DenseNet, Inception V3, Inception-ResNet V2, VGG16) for skin lesions classification
Stars: ✭ 47 (+235.71%)
Mutual labels:  ensemble-learning
SyntheticControlMethods
A Python package for causal inference using Synthetic Controls
Stars: ✭ 90 (+542.86%)
Mutual labels:  causal-inference
causalnlp
CausalNLP is a practical toolkit for causal inference with text as treatment, outcome, or "controlled-for" variable.
Stars: ✭ 98 (+600%)
Mutual labels:  causal-inference
stackgbm
🌳 Stacked Gradient Boosting Machines
Stars: ✭ 24 (+71.43%)
Mutual labels:  ensemble-learning
CausalityTools.jl
Algorithms for causal inference and the detection of dynamical coupling from time series, and for approximation of the transfer operator and invariant measures.
Stars: ✭ 45 (+221.43%)
Mutual labels:  causal-inference
handson-ml
도서 "핸즈온 머신러닝"의 예제와 연습문제를 담은 주피터 노트북입니다.
Stars: ✭ 285 (+1935.71%)
Mutual labels:  ensemble-learning

R/drtmle

Travis-CI Build Status AppVeyor Build Status Coverage Status CRAN CRAN downloads Project Status: Active - The project has reached a stable, usable state and is being actively developed. MIT license DOI

Nonparametric estimators of the average treatment effect with doubly-robust confidence intervals and hypothesis tests

Author: David Benkeser


Description

drtmle is an R package that computes marginal means of an outcome under fixed levels of a treatment. The package computes targeted minimum loss-based (TMLE) estimators that are doubly robust, not only with respect to consistency, but also with respect to asymptotic normality, as discussed in Benkeser, et al. (2017). This property facilitates construction of doubly-robust confidence intervals and hypothesis tests.

The package additionally includes methods for computing valid confidence intervals for an inverse probability of treatment weighted (IPTW) estimator of the average treatment effect when the propensity score is estimated via super learning, as discussed in van der Laan (2014).


Installation

Install the current stable release from CRAN via

install.packages("drtmle")

A developmental release may be installed from GitHub via devtools with:

devtools::install_github("benkeser/drtmle")

Usage

Doubly-robust inference for the average treatment effect

Suppose the data consist of a vector of baseline covariates (W), a multi-level treatment assignment (A), and a continuous or binary-valued outcome (Y). The function drtmle may be used to estimate E[E(YA=a0,W)] for user-selected values of a0 (via option a_0). The resulting targeted minimum loss-based estimates are doubly robust with respect to both consistency and asymptotic normality. The function computes doubly robust covariance estimates that can be used to construct doubly robust confidence intervals for marginal means and contrasts between means. A simple example on simulated data is shown below. We refer users to the vignette for more information and further examples.

# load packages
library(drtmle)
#> drtmle: TMLE with doubly robust inference
#> Version: 1.1.0
library(SuperLearner)
#> Loading required package: nnls
#> Loading required package: gam
#> Loading required package: splines
#> Loading required package: foreach
#> Loaded gam 1.20
#> Super Learner
#> Version: 2.0-28
#> Package created on 2021-05-04

# simulate simple data structure
set.seed(12345)
n <- 200
W <- data.frame(W1 = runif(n,-2,2), W2 = rbinom(n,1,0.5))
A <- rbinom(n, 1, plogis(-2 + W$W1 - 2*W$W1*W$W2))
Y <- rbinom(n, 1, plogis(-2 + W$W1 - 2*W$W1*W$W2 + A))

# estimate the covariate-adjusted marginal mean for A = 1 and A = 0
# here, we do not properly estimate the propensity score
fit1 <- drtmle(W = W, A = A, Y = Y, # input data
               a_0 = c(0, 1), # return estimates for A = 0 and A = 1
               SL_Q = "SL.npreg", # use kernel regression for E(Y | A = a, W)
               glm_g = "W1 + W2", # use misspecified main terms glm for E(A | W)
               SL_Qr = "SL.npreg", # use kernel regression to guard against
                                   # misspecification of outcome regression
               SL_gr = "SL.npreg", # use kernel regression to guard against
                                  # misspecification of propensity score
               returnModels = TRUE # for visualizing fits later
              )
# print the output
fit1
#> $est
#>            
#> 0 0.1752271
#> 1 0.2866095
#> 
#> $cov
#>              0            1
#> 0 9.039683e-04 4.591974e-05
#> 1 4.591974e-05 8.823850e-03

# get confidence intervals for marginal means
# truth is E[Y(1)] = 0.29, E[Y(0)] = 0.15
ci_fit1 <- ci(fit1)
# print the output
ci_fit1
#> $drtmle
#>     est   cil   ciu
#> 0 0.175 0.116 0.234
#> 1 0.287 0.102 0.471

# get confidence intervals for ate
# truth is E[Y(1)] - E[Y(0)] = 0.14
ci_ate1 <- ci(fit1, contrast = c(-1, 1))
# print the output
ci_ate1
#> $drtmle
#>                   est    cil   ciu
#> E[Y(1)]-E[Y(0)] 0.111 -0.081 0.304

This method requires estimation of additional univariate regressions to ensure doubly robust confidence intervals and hypothesis tests. The method for estimation are input via SL.Qr and SL.gr or glm.Qr and glm.gr if parametric models are desired). These additional fits can be visualized by the plot method for drtmle.

layout(t(1:3))
plot(fit1, ask = FALSE)

Inference for super learner-based IPTW

The package additionally includes a function for computing valid confidence intervals about an inverse probability of treatment weight (IPTW) estimator when super learning is used to estimate the propensity score.

# fit iptw
fit2 <- adaptive_iptw(Y = Y, A = A, W = W, a_0 = c(0, 1),
                      SL_g = c("SL.glm", "SL.mean", "SL.step.interaction"),
                      SL_Qr = "SL.npreg")
#> Loading required package: nloptr
#> Warning: UNRELIABLE VALUE: One of the 'future.apply' iterations
#> ('future_lapply-1') unexpectedly generated random numbers without declaring so.
#> There is a risk that those random numbers are not statistically sound and the
#> overall results might be invalid. To fix this, specify 'future.seed=TRUE'. This
#> ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-
#> CMRG method. To disable this check, use 'future.seed = NULL', or set option
#> 'future.rng.onMisuse' to "ignore".
#> Warning: UNRELIABLE VALUE: One of the 'future.apply' iterations
#> ('future_lapply-1') unexpectedly generated random numbers without declaring so.
#> There is a risk that those random numbers are not statistically sound and the
#> overall results might be invalid. To fix this, specify 'future.seed=TRUE'. This
#> ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-
#> CMRG method. To disable this check, use 'future.seed = NULL', or set option
#> 'future.rng.onMisuse' to "ignore".
#> Warning: UNRELIABLE VALUE: One of the 'future.apply' iterations
#> ('future_lapply-1') unexpectedly generated random numbers without declaring so.
#> There is a risk that those random numbers are not statistically sound and the
#> overall results might be invalid. To fix this, specify 'future.seed=TRUE'. This
#> ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-
#> CMRG method. To disable this check, use 'future.seed = NULL', or set option
#> 'future.rng.onMisuse' to "ignore".
#> Warning: UNRELIABLE VALUE: One of the 'future.apply' iterations
#> ('future_lapply-1') unexpectedly generated random numbers without declaring so.
#> There is a risk that those random numbers are not statistically sound and the
#> overall results might be invalid. To fix this, specify 'future.seed=TRUE'. This
#> ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-
#> CMRG method. To disable this check, use 'future.seed = NULL', or set option
#> 'future.rng.onMisuse' to "ignore".
# print the output
fit2
#> $est
#>            
#> 0 0.1740064
#> 1 0.2424139
#> 
#> $cov
#>              0            1
#> 0 8.554246e-04 8.969435e-05
#> 1 8.969435e-05 2.235191e-02

# compute a confidence interval for margin means
ci_fit2 <- ci(fit2)
# print the output
ci_fit2
#> $iptw_tmle
#>     est    cil   ciu
#> 0 0.174  0.117 0.231
#> 1 0.242 -0.051 0.535

# compute a confidence interval for the ate
ci_ate2 <- ci(fit2, contrast = c(-1, 1))
# print the output
ci_ate2
#> $iptw_tmle
#>                   est    cil   ciu
#> E[Y(1)]-E[Y(0)] 0.068 -0.229 0.366

Issues

If you encounter any bugs or have any specific feature requests, please file an issue.


Citation

After using the drtmle R package, please cite the following:

@Manual{drtmlepackage,
  title = {drtmle: Doubly-Robust Nonparametric Estimation and Inference},
  author = {David Benkeser},
  note = {R package version 1.0.0},
  doi = {10.5281/zenodo.844836}
}

@article{benkeser2017improved,
  year  = {2017},
  author = {Benkeser, David C and Carone, Marco and van der Laan, Mark J
    and Gilbert, Peter B},
  title = {Doubly-robust nonparametric inference on the average
    treatment effect},
  journal = {Biometrika},
  volume = {104}, number = {4},
  pages = {863–880},
  doi = {10.1093/biomet/asx053}
}

License

© 2016- David C. Benkeser

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

The MIT License (MIT)

Copyright (c) 2016- David C. Benkeser

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].