knn.reg(train, test = NULL, y, k = 3, algorithm=c("kd_tree",
"cover_tree", "brute"))
Value
knn.reg returns an object of class
"knnReg" or "knnRegCV"
if test data is not supplied.
The returnedobject is a list containing at least the following components:
call
the match call.
k
number of neighbours considered.
n
number of predicted values, either equals test size or train size.
pred
a vector of predicted values.
residuals
predicted residuals. NULL if test is supplied.
PRESS
the sums of squares of the predicted residuals. NULL if test is supplied.
R2Pred
predicted R-square. NULL if test is supplied.
Arguments
train
matrix or data frame of training set cases.
test
matrix or data frame of test set cases. A vector will be interpreted
as a row vector for a single case. If not supplied, cross-validataion will be done.