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
)

Arguments

DF

A data frame of the features (data.frame)

W

A vector of the treatment indicator (1/0 coded) (integer)

Y

A vector of the outcome values (numeric)

key

A vector of the indices (integer)

DF_test

A data frame of the features in the test set (data.frame)

key_test

A vector of the indices of the test sample (integer)

threads

The value of number of threads to use (integer)

knn_index_mat_options

A list of parameters to pass into knn_index_mat (list)

knn_optimal_k_options

A list of parameters to pass into knn_optimal_k (list)

tep_e_net_options

A list of parameters to pass into tep_projection_e_net (list)

verbose

A boolean flag for verbose output (logical)

Value

A list containing function results (list)

Details

This off-the-shelf implementation does not implement bootstrapping for finding the optimal K value and for the treatment effect projection.