# rknn

0th

Percentile

##### Theoretical Distribution of Nearest Neighbour Distance

Density, distribution function, quantile function and random generation for the random distance to the $k$th nearest neighbour in a Poisson point process in $d$ dimensions.

Keywords
distribution, spatial
##### Usage
dknn(x, k = 1, d = 2, lambda = 1)
pknn(q, k = 1, d = 2, lambda = 1)
qknn(p, k = 1, d = 2, lambda = 1)
rknn(n, k = 1, d = 2, lambda = 1)
##### Arguments
x,q
vector of quantiles.
p
vector of probabilities.
n
number of observations to be generated.
k
order of neighbour.
d
dimension of space.
lambda
intensity of Poisson point process.
##### Details

In a Poisson point process in $d$-dimensional space, let the random variable $R$ be the distance from a fixed point to the $k$-th nearest random point, or the distance from a random point to the $k$-th nearest other random point.

Then $R^d$ has a Gamma distribution with shape parameter $k$ and rate $\lambda * \alpha$ where $\alpha$ is a constant (equal to the volume of the unit ball in $d$-dimensional space). See e.g. Cressie (1991, page 61).

These functions support calculation and simulation for the distribution of $R$.

##### Value

• A numeric vector: dknn returns the probability density, pknn returns cumulative probabilities (distribution function), qknn returns quantiles, and rknn generates random deviates.

##### References

Cressie, N.A.C. (1991) Statistics for spatial data. John Wiley and Sons, 1991.

• dknn
• pknn
• qknn
• rknn
##### Examples
x <- seq(0, 5, length=20)
densities <- dknn(x, k=3, d=2)
cdfvalues <- pknn(x, k=3, d=2)
randomvalues <- rknn(100, k=3, d=2)
deciles <- qknn((1:9)/10, k=3, d=2)
Documentation reproduced from package spatstat, version 1.23-2, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.