causalDML: This function estimates the average potential outcomes and...

View source: R/average_effects.R

causalDMLR Documentation

This function estimates the average potential outcomes and average treatment effects using Double Machine Learning (DML).

Description

An implementation of Double Machine Learning based method as they are discussed by Chernozhukov et al. (2018) and reviewed in Knaus (2020). It is tailored for program evaluation with potentially multiple treatments estimates average potential outcomes and average treatment effects.

Usage

causalDML(
  y,
  w,
  x,
  ml_w = list(create_method("forest_grf")),
  ml_y = list(create_method("forest_grf")),
  cf = 5,
  cv = 5,
  cl = NULL,
  norm = 2,
  weights = FALSE,
  path = NULL,
  quiet = TRUE
)

Arguments

y

Numeric vector containing the outcome variable.

w

Treatment vector. Provide as factor to control ordering of the treatments, otherwise program orders treatments in ascending order or alphabetically.

x

Covariate matrix.

ml_w

List of methods to be used in ensemble estimation of propensity score. Methods can be created by create_method. Default is an untuned honest regression_forest.

ml_y

List of methods to be used in ensemble estimation of outcome regression. Methods can be created by create_method. Default is an untuned honest regression_forest.

cf

Number of cross-fitting folds for DML (default 5).

cv

Number of cross-validation folds when estimating ensemble if more than one method is defined in ml_w and/or ml_y (default 5).

cl

If not NULL, vector with cluster variables

norm

Controls normalization of IPW weights. 0: no normalization, 1: overall normalization, 2: normalization in each cross-fitting fold separately (default).

weights

If TRUE, prediction weights of the outcome nuisance extracted and saved (requires to provide a path).

path

Optional path to save the ensemble objects of each cross-fit for later inspection.

quiet

If FALSE, ensemble estimators print method that is currently running.

Value

List of an APO_dml and an ATE_dml object.

Author(s)

Michael C. Knaus

References

  • Chernozhukov, V., Chetverikov, D., Demirer, M., Duflo, E., Hansen, C., Newey, W., &Robins, J. (2018). Double/Debiased machine learning for treatment and structuralparameters.The Econometrics Journal,21(1), C1-C68

  • Knaus, M. C. (2020). Double machine learning based program evaluation under unconfoundedness. arXiv preprint arXiv:2003.03191.http://arxiv.org/abs/2003.03191

Examples

# Generate data
n = 50
p = 10
X = matrix(rnorm(n * p), n, p)
W = rbinom(n, 1, 0.5)
Y = pmax(X[, 1], 0) * W + X[, 2] + pmin(X[, 3], 0) + rnorm(n)

# Run causal DML
cDML = causalDML(Y, W, X)

# Show average potential outcome estimates
summary(cDML$APO)

# Show average tretment effect estimates
summary(cDML$ATE)


MCKnaus/causalDML documentation built on Aug. 19, 2023, 5:47 p.m.