R/casualknn_tep.R
causalKNN_TEP.Rd
Wraps the causal KNN Regression and the Treatment Effect Projection into one function. The
treatment effect projection step is performed with a Elastic-Net
Sequentially runs knn_index_mat
, knn_optimal_k
,
causalknn_treatment_effect
, and tep_projection_e_net
functions and returns a list
of treatment results and optimal parameters. Since all of the important parameters are returned,
the user can re-run certain functions easily. (i.e. re-running causalknn_treatment_effect
with
a larger K value).
causalKNN_TEP(
DF,
W,
Y,
key,
DF_test,
key_test,
threads = 1L,
knn_index_mat_options = list(k = floor(sqrt(nrow(DF)))),
knn_optimal_k_options = list(N_step = ifelse(knn_index_mat_options$k > 300L,
floor(knn_index_mat_options$k/25), 14L), K_step = ifelse(knn_index_mat_options$k >
300L, 25L, floor(knn_index_mat_options$k/14))),
tep_e_net_options = list(),
verbose = FALSE
)
A data frame of the features (data.frame)
A vector of the treatment indicator (1/0 coded) (integer)
A vector of the outcome values (numeric)
A vector of the indices (integer)
A data frame of the features in the test set (data.frame)
A vector of the indices of the test sample (integer)
The value of number of threads to use (integer)
A list of parameters to pass into knn_index_mat
(list)
A list of parameters to pass into knn_optimal_k
(list)
A list of parameters to pass into tep_projection_e_net
(list)
A boolean flag for verbose output (logical)
A list containing function results (list)
This off-the-shelf implementation does not implement bootstrapping for finding the optimal K value and for the treatment effect projection.