The raw empirical CDF of nearest-neighbour distances is biased
downward near the edge of the window: a point close to the boundary
may have its true nearest neighbour outside it, so the observed
distance is too large. The reduced-sample (border) correction
removes exactly the points that could be affected at each radius,
G_hat(r) = #{i : d_i <= r and b_i > r} / #{i : b_i > r},
where d_i is the observed nearest-neighbour distance and
b_i the distance from point i to the nearest window edge. The
complete spatial randomness benchmark is
G_csr(r) = 1 - exp(-lambda pi r^2), so G_hat above it
indicates clustering and below it regularity.
References
Diggle, P. J. (2003). Statistical Analysis of Spatial Point Patterns, 2nd edition, Arnold; section 2.3 defines G and section 4.3 the border correction.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
M <- matrix(c(1, 2, 3, 4, 5, 6), nrow = 2)
Nndist(M, V)
#> $G
#> [1] NA NA NA NA NA NA NA NA
#>
#> $G_csr
#> [1] 0.9981326 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [8] 1.0000000
#>
#> $r
#> [1] 1 2 3 4 5 6 7 8
#>
#> $m_used
#> [1] 0 0 0 0 0 0 0 0
#>
#> $estimate
#> [1] 1.732051
#>
#> $lambda_hat
#> [1] 2
#>
#> $n
#> [1] 2
#>
#> $method
#> [1] "Border-corrected nearest-neighbour distance CDF G(r)"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
