For each value in the prediction vector xtest
, one of the closest k
values in the prediction vector xtrain
is randomly chosen and its observed
value in ytrain
is returned. Note that xtrain
and xtest
must be both either
numeric, logical, or factor-valued. ytest
can be of any type.
Arguments
- xtrain
Vector with predicted values in the training data. Must be numeric, logical, or factor-valued.
- xtest
Vector as
xtrain
with predicted values in the test data. Missing values are not allowed.- ytrain
Vector of the observed values in the training data. Must be of same length as
xtrain
.- k
Number of nearest neighbours (donors) to sample from.
- seed
Integer random seed.