CVknn {bcROCsurface} | R Documentation |
This function calculates the estimated cross-validation prediction error for K nearest-neighbor regression and returns a suitable choice for K.
CVknn(X, Dvec, V, K.list = NULL, type = "eucli", plot = FALSE)
X |
a numeric design matrix, which used in |
Dvec |
a n * 3 binary matrix with three columns, corresponding to the three classes of the disease status. In row i, 1 in column j indicates that the i-th subject belongs to class j, with j = 1, 2, 3. A row of |
V |
a binary vector containing the verification status (1 verified, 0 not verified). |
K.list |
a list of candidate values for K. If |
type |
a type of distance, see |
plot |
if |
Data are divided into two groups, the first contains the data corresponding to V = 1, whereas the second contains the data corresponding to V = 0. In the first group, the discrepancy between the true disease status and the KNN estimates of the probabilities of the disease status is computed by varying K
from 1 to the number of verification subjects, see To Duc et al. (2016). The optimal value of K
is the value that corresponds to the smallest value of the discrepancy.
A suitable choice for K is returned.
To Duc, K., Chiogna, M., Adimari, G. (2016): Nonparametric Estimation of ROC Surfaces Under Verification Bias. https://arxiv.org/abs/1604.04656v1. Submitted.
data(EOC) XX <- cbind(EOC$CA125, EOC$CA153, EOC$Age) Dna <- preDATA(EOC$D, EOC$CA125) Dvec.na <- Dna$Dvec CVknn(XX, Dvec.na, EOC$V, type = "mahala", plot = TRUE)