Skip to contents

Formula: \(g(r) = K'(r) / (2 pi r)\). K is estimated with the reduced-sample (border) correction and differentiated by a central difference of half-width h, g_hat(r) = (K_hat(r + h) - K_hat(r - h)) / (2 h) / (2 pi r), which is deterministic – no kernel smoothing and no data-dependent bandwidth rule. Under complete spatial randomness \(K(r) = pi r^2\) so g(r) = 1 at every radius; above one means clustering at that scale and below one regularity

Usage

Pcfunc(points, window, r, h = NULL)

Arguments

points

Point coordinates, n by 2.

window

c(xmin, ymin, xmax, ymax) or an (m, 2) vertex matrix; NULL takes the bounding box of points.

r

Radii, strictly positive.

h

Half-width of the central difference; defaults to one quarter of the smallest radius, which keeps r - h positive.

Value

List with g, r, K, h, estimate, lambda_hat, n.

References

Stoyan, D. & Stoyan, H. (1994). Fractals, Random Shapes and Point Fields, Wiley, chapter 14; Diggle, P. J. (2003). Statistical Analysis of Spatial Point Patterns, 2nd edition, Arnold, section 4.3.

Examples

set.seed(21)
pts <- matrix(runif(400), 200, 2)
round(Pcfunc(pts, window = c(0, 0, 1, 1), r = c(0.05, 0.1, 0.15))$g, 2)   # near 1 under CSR
#> [1] 1.13 0.92 0.98