dr_oos: Out-of-sample prediction with DR-learner

View source: R/dr_learner.R

dr_oosR Documentation

Out-of-sample prediction with DR-learner

Description

This function produces out-of-sample predictions of conditional average treatment effects (CATEs) using the DR-learner (Kennedy, 2020). It executes steps 1 to 4 of algorithm 1 in Knaus (2020) as part of the dr_learner.

Usage

dr_oos(
  y,
  w,
  x,
  xnew,
  ml_w = list(create_method("forest_grf")),
  ml_y = list(create_method("forest_grf")),
  ml_tau = list(create_method("forest_grf")),
  cf_mat = NULL,
  compare_all = TRUE,
  nfolds = 5,
  path = NULL,
  quiet = TRUE
)

Arguments

y

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

xnew

Covariate matrix of test sample.

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.

ml_tau

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

cf_mat

Optional logical matrix with k columns of indicators representing the different folds (for example created by prep_cf_mat). Otherwise created internally.

compare_all

Relevant multiple treatments: If FALSE, only comparisons to first treatment considered.

nfolds

Number of folds used in cross-validation of ensemble weights (default nfolds=5).

path

Optional path to save the ensemble objects for later processing. IATE objects saved in new subfolder Comparisonij where i is the index of the control and j of the treated group.

quiet

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

Value

cates

Returns a n x number of comparisons matrix (one column in case of binary treatment) containing the predicted CATEs.

APO

APO_dml object containing the underlying nuisance parameters etc.

ATE

ATE_dml object containing the underlying doubly robust score.

References

  • Kennedy, E. H. (2020). Optimal doubly robust estimation of heterogeneous causal effects. arXiv preprint arXiv:2004.14497. http://arxiv.org/abs/2004.14497

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


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