rknn | R Documentation |
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.
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)
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. |
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
.
A numeric vector:
dknn
returns the probability density,
pknn
returns cumulative probabilities (distribution function),
qknn
returns quantiles,
and rknn
generates random deviates.
and \rolf
Cressie, N.A.C. (1991) Statistics for spatial data. John Wiley and Sons, 1991.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.