R/causalknn_treatment.R
causalknn_treatment_effect.Rd
In separate K
value case, supply a vector of two elements to the K
parameter. The first
element of vector will be K
for untreated nearest neighbors, and the second elements will be
the K for treated nearest neighbors. Supply a single value for K otherwise.
causalknn_treatment_effect(
W,
Y,
key,
K,
knn_index_list,
key_test = NULL,
return_outcomes = FALSE,
bootstrap_keys = NULL,
bootstrap_keys_test = NULL
)
A vector of the treatment indicator (1/0 coded) in the training set (integer)
A vector of the outcome values in the training set (numeric)
A vector of the indices of the training set (integer)
Value(s) for K (integer)
A list of the KNN index matrices provided by the knn_index_mat function (list)
A vector of the indices of the test set (Defaults to NULL) (integer)
Whether to return predicted potential (treated/untreated) outcomes (logical)
A vector of the bootstrapped keys for the training set (default to NULL for no bootstrap case) (integer)
A vector of the bootstrapped keys for the test set (default to NULL for no bootstrap case) (integer)
A data.frame of the predicted treatment effect, treatment outcome, and untreated outcome by key (data.frame)
Supply a key_test
if looking to estimate treatment effects for the validation set. Otherwise,
the default value of NULL will instruct the function to estimate treatment effects for the training set.
Allows for bootstrapped case - see the bootstrap vignette.