DR-Learner | R Documentation |
DR_RF is an implementation of the DR-learner with Random Forests (Breiman 2001) as the base learners.
DR_RF( feat, tr, yobs, predmode = "propmean", nthread = 0, verbose = FALSE, trunc_level = 0.02, prop.forestry = list(relevant.Variable = 1:ncol(feat), ntree = 500, replace = TRUE, sample.fraction = 0.5, mtry = ncol(feat), nodesizeSpl = 11, nodesizeAvg = 33, nodesizeStrictSpl = 2, nodesizeStrictAvg = 1, splitratio = 1, middleSplit = FALSE, OOBhonest = TRUE), tau.forestry = list(relevant.Variable = 1:ncol(feat), ntree = 1000, replace = TRUE, sample.fraction = 0.7, mtry = round(ncol(feat) * 17/20), nodesizeSpl = 5, nodesizeAvg = 6, nodesizeStrictSpl = 3, nodesizeStrictAvg = 1, splitratio = 1, middleSplit = TRUE, OOBhonest = TRUE), mu.forestry = list(relevant.Variable = 1:ncol(feat), ntree = 1000, replace = TRUE, sample.fraction = 0.7, mtry = round(ncol(feat) * 17/20), nodesizeSpl = 5, nodesizeAvg = 6, nodesizeStrictSpl = 3, nodesizeStrictAvg = 1, splitratio = 1, middleSplit = TRUE, OOBhonest = TRUE), pseu.forestry = list(relevant.Variable = 1:ncol(feat), ntree = 1000, replace = TRUE, sample.fraction = 0.7, mtry = round(ncol(feat) * 17/20), nodesizeSpl = 5, nodesizeAvg = 6, nodesizeStrictSpl = 3, nodesizeStrictAvg = 1, splitratio = 1, middleSplit = TRUE, OOBhonest = TRUE) )
feat |
A data frame containing the features. |
tr |
A numeric vector with 0 for control and 1 for treated variables. |
yobs |
A numeric vector containing the observed outcomes. |
predmode |
Specifies how the two estimators of the second stage should be aggregated. Possible types are "propmean," "control," and "treated." The default is "propmean," which refers to propensity score weighting. |
nthread |
Number of threads which should be used to work in parallel. |
verbose |
TRUE for detailed output, FALSE for no output. |
trunc_level |
Level at which to truncate the estimated propensity scores this ensures that the predicted propensity scores are bounded between trunc_level < p_score < 1-trunc_level. Default is .02. |
prop.forestry, tau.forestry, mu.forestry, pseu.forestry |
A list containing the
hyperparameters for the
|
An object from a class that contains the CATEestimator
class. It should be used with one of the following functions:
EstimateCATE
, CateCI
, and CateBIAS
. The object has at least the
following slots:
|
A copy of feat. |
|
A copy of tr. |
|
A copy of yobs. |
|
Function call that creates the CATE estimator. This is used for different bootstrap procedures. |
Soeren R. Kuenzel
Edward Kennedy (2020). Optimal doubly robust estimation of heterogeneous causal effects. https://arxiv.org/abs/2004.14497
Other metalearners:
M-Learner
,
S-Learner
,
T-Learner
,
X-Learner
require(causalToolbox) # create example data set simulated_experiment <- simulate_causal_experiment( ntrain = 1000, ntest = 1000, dim = 10 ) feat <- simulated_experiment$feat_tr tr <- simulated_experiment$W_tr yobs <- simulated_experiment$Yobs_tr feature_test <- simulated_experiment$feat_te # create the CATE estimator using Random Forests (RF) xl_rf <- X_RF(feat = feat, tr = tr, yobs = yobs) tl_rf <- T_RF(feat = feat, tr = tr, yobs = yobs) sl_rf <- S_RF(feat = feat, tr = tr, yobs = yobs) ml_rf <- M_RF(feat = feat, tr = tr, yobs = yobs) xl_bt <- X_BART(feat = feat, tr = tr, yobs = yobs) tl_bt <- T_BART(feat = feat, tr = tr, yobs = yobs) sl_bt <- S_BART(feat = feat, tr = tr, yobs = yobs) ml_bt <- M_BART(feat = feat, tr = tr, yobs = yobs) cate_esti_xrf <- EstimateCate(xl_rf, feature_test) # evaluate the performance. cate_true <- simulated_experiment$tau_te mean((cate_esti_xrf - cate_true) ^ 2) ## Not run: # create confidence intervals via bootstrapping. xl_ci_rf <- CateCI(xl_rf, feature_test, B = 500) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.