knnBi: Calculate the distance to the k'th nearest neighbour for a...

Description Usage Arguments Value Examples

View source: R/bandwidth_selection.R

Description

Calculate the distance to the k'th nearest neighbour for a given bivariate data set, on a given grid.

Usage

1

Arguments

data

The data set, a nx2-matrix.

grid

The grid, a dx2-matrix.

k

The number of neighbours.

Value

A vector of length d containing the distance to the k'th nearest neighbour for each grid point.

Examples

1
2
3
4
data <- cbind(rnorm(100), rnorm(100))
grid <- cbind(c(-1, 0, 1), c(-1, 0, 1))
k <- 10
knnBi(data, grid, k)

hotneim/lgde documentation built on May 17, 2019, 4:52 p.m.