cre {CRE} | R Documentation |
Performs the Causal Rule Ensemble on a data set with a response variable, a treatment variable, and various features.
cre(y, z, X, method_params = NULL, hyper_params = NULL, ite = NULL)
y |
An observed response vector. |
z |
A treatment vector. |
X |
A covariate matrix (or a data frame). |
method_params |
The list of parameters to define the models used, including:
|
hyper_params |
The list of hyper parameters to finetune the method, including:
|
ite |
The estimated ITE vector. If given both the ITE estimation steps in Discovery and Inference are skipped (default: NULL). |
An S3 object containing:
A number of Decision Rules extracted at each step (M
).
A data.frame of Conditional Average Treatment Effect decomposition
estimates with corresponding uncertainty quantification (CATE
).
A list of Method Parameters (method_params
).
A list of Hyper Parameters (hyper_params
).
An Individual Treatment Effect predicted (ite_pred
).
set.seed(2021)
dataset <- generate_cre_dataset(n = 400, rho = 0, n_rules = 2, p = 10,
effect_size = 2, binary_covariates = TRUE,
binary_outcome = FALSE, confounding = "no")
y <- dataset[["y"]]
z <- dataset[["z"]]
X <- dataset[["X"]]
method_params <- list(ratio_dis = 0.25,
ite_method_dis="aipw",
ps_method_dis = "SL.xgboost",
oreg_method_dis = "SL.xgboost",
ite_method_inf = "aipw",
ps_method_inf = "SL.xgboost",
oreg_method_inf = "SL.xgboost")
hyper_params <- list(intervention_vars = NULL,
offset = NULL,
ntrees_rf = 20,
ntrees_gbm = 20,
node_size = 20,
max_nodes = 5,
max_depth = 3,
t_decay = 0.025,
t_ext = 0.025,
t_corr = 1,
t_pvalue = 0.05,
replace = FALSE,
stability_selection = TRUE,
cutoff = 0.6,
pfer = 0.1,
penalty_rl = 1)
cre_results <- cre(y, z, X, method_params, hyper_params)