nearest: 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 \(d\) dimensional vector.
U
a \(n\times d\) matrix where \(n\) represents the sample size and
\(d\) is the dimension of each sample.
n
the sample size.
d
dimension of each sample.
Value
d1 - nearest neighbor of \(\mathbf{y}\) in \(\mathbf{U}\)