cre {CRE} | R Documentation |
Causal rule ensemble
Description
Performs the Causal Rule Ensemble on a data set with a response variable, a treatment variable, and various features.
Usage
cre(y, z, X, method_params = NULL, hyper_params = NULL, ite = NULL)
Arguments
y |
An observed response vector. |
z |
A treatment vector. |
X |
A covariate matrix (or a data frame). Should be provided as numerical values. |
method_params |
The list of parameters to define the models used, including:
|
hyper_params |
The list of hyper parameters to fine-tune the method, including:
|
ite |
The estimated ITE vector. If given both the ITE estimation steps
in Discovery and Inference are skipped (default: |
Value
An S3 object composed by:
M |
the number of Decision Rules extracted at each step, |
CATE |
the data.frame of Conditional Average Treatment Effect decomposition estimates with corresponding uncertainty quantification, |
method_params |
the list of method parameters, |
hyper_params |
the list of hyper parameters, |
rules |
the list of rules (implicit form) decomposing the CATE. |
Note
If
intervention_vars
are provided, it is important to note that the individual treatment effect will still be computed using all covariates.
Examples
set.seed(123)
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.5,
ite_method ="aipw",
learner_ps = "SL.xgboost",
learner_y = "SL.xgboost")
hyper_params <- list(intervention_vars = NULL,
offset = NULL,
ntrees = 20,
node_size = 20,
max_rules = 50,
max_depth = 3,
t_decay = 0.025,
t_ext = 0.025,
t_corr = 1,
stability_selection = "vanilla",
cutoff = 0.6,
pfer = 1,
B = 20,
subsample = 0.5)
cre_results <- cre(y, z, X, method_params, hyper_params)