nearest {truh} | R Documentation |
Nearest neighbor computation for the TRUH statistic
Description
For a given d
dimensional vector \mathbf{y}
, this function finds the nearest neighbor of \mathbf{y}
in
a n\times d
matrix \mathbf{U}
.
Usage
nearest(y, U, n, d)
Arguments
y |
a |
U |
a |
n |
the sample size. |
d |
dimension of each sample. |
Value
d1 - nearest neighbor of
\mathbf{y}
in\mathbf{U}
d2 - nearest neighbor of d1 in
\mathbf{U}
See Also
Examples
library(truh)
n = 100
d = 3
set.seed(1)
y = rnorm(3)
set.seed(2)
U = matrix(rnorm(n*d),nrow=n,ncol=d)
out = nearest(y,U,n,d)
[Package truh version 1.0.0 Index]