Skip to contents

Compares the observed \(\hat K(r)\) with envelopes from patterns simulated under complete spatial randomness in the same window. Under CSR in the plane \(K(r) = \pi r^2\), but that holds only on the infinite plane; inside a bounded window the uncorrected estimator is biased downward, so the envelopes are the right reference.

Usage

morie_ripley_csr_test(coords, window = NULL, nsim = 99L, radii = NULL)

Arguments

coords

Numeric matrix of event locations (n x d).

window

Observation region as d (min, max) pairs. Defaults to the bounding box of coords.

nsim

Number of CSR patterns simulated. Default 99.

radii

Radii at which K is evaluated. Defaults to 19 points up to a quarter of the smallest window side.

Value

Named list with statistic, p_value, radii, k_observed, k_mean, k_lower, k_upper, n, nsim, area, method.

Details

The p-value is one maximum deviation over the whole radius range, ranked among the simulations. Reading significance off the radius where the curve leaves a pointwise envelope would be multiple testing.

This is the second-order counterpart of morie_csr_nn_test, which tests the same null through first-order nearest-neighbour distances.

Mirrors morie.fn.mrkcsr on the Python side.

References

Ripley BD (1977). Modelling spatial patterns. Journal of the Royal Statistical Society, Series B, 39(2), 172-212.

Examples

set.seed(1)
morie_ripley_csr_test(matrix(runif(200), 100, 2), nsim = 49)$p_value
#> [1] 0.22