Description Usage Arguments Details Value References Examples

View source: R/knnImputation.R

`rhoKNN`

uses the KNN approach to estimate the probabilities of the disease status in case of three categories.

1 2 3 4 5 6 7 8 |

`X` |
a numeric design matrix. |

`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` |
an integer value/vector, which indicates the number of nearest neighbors. It should be less than the number of the verification subjects. |

`type` |
a distance measure. |

`trace` |
switch for tracing estimation process. Default |

`type`

should be selected as one of `"eucli"`

, `"manha"`

, `"canber"`

, `"lagran"`

, `"mahala"`

corresponding to Euclidean, Manhattan, Canberra, Lagrange and Mahalanobis distance. In practice, the selection of a suitable distance is typically dictated by features of the data and possible subjective evaluations. For example, if the covariates are heterogeneous with respect to their variances (which is particularly true when the variables are measured on heterogeneous scales), the choice of the Mahalanobis distance may be a good choice.

For the number of nearest neighbors, a small value of `K`

, within the range 1-3, may be a good choice. In general, the choice of `K`

may depend on the dimension of the feature space, and propose to use crossâ€“validation to find `K`

in case of highâ€“dimensional covariate. See `CVknn`

.

`rhoKNN`

returns a list containing the following components:

`values` |
estimates of the probabilities. |

`X` |
a design model matrix. |

`K` |
the number of nearest neighbors. |

`type` |
the chosen distance. |

To Duc, K., Chiogna, M., Adimari, G. (2016): Nonparametric Estimation of ROC Surfaces Under Verification Bias. https://arxiv.org/abs/1604.04656v1. Submitted.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
data(EOC)
XX <- cbind(EOC$CA125, EOC$CA153, EOC$Age)
Dna <- preDATA(EOC$D, EOC$CA125)
Dvec.na <- Dna$Dvec
## Euclidean distance, K = 1
out.ecul.1nn <- rhoKNN(XX, Dvec.na, EOC$V, K = 1, type = "eucli")
## Manhattan distance, K = 1
out.manh.1nn <- rhoKNN(XX, Dvec.na, EOC$V, K = 1, type = "manha")
## Canberra distance, K = 3
out.canb.1nn <- rhoKNN(XX, Dvec.na, EOC$V, K = 3, type = "canber")
## Lagrange distance, K = 3
out.lagr.1nn <- rhoKNN(XX, Dvec.na, EOC$V, K = 3, type = "lagran")
## Mahalanobis distance, K = c(1,3)
out.maha.13nn <- rhoKNN(XX, Dvec.na, EOC$V, K = c(1,3), type = "mahala")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.