Skip to contents

Computes Ripley's K(r) at each user-supplied radius (km), the Besag-centred L(r)-r transformation, and the CSR baseline pi*r^2. Coordinates are projected to km via the small-angle latitude factor; for typical city-scale point patterns this is accurate enough that haversine is unnecessary.

Usage

morie_tps_ripley_k(
  df,
  ds_name = "?",
  radii_km = c(0.25, 0.5, 1, 2, 3, 5),
  max_n = 5000L,
  lat_col = "LAT_WGS84",
  lon_col = "LONG_WGS84"
)

Arguments

df

Incident-level data.frame.

ds_name

Tag for the result title.

radii_km

Numeric vector of radii in km (default 0.25, 0.5, 1, 2, 3, 5).

max_n

Subsample cap (default 5000) to keep the pairwise distance matrix tractable.

lat_col, lon_col

WGS84 column names.

Value

A named list with the per-radius table, intensity, and bounding-box area.

Examples

set.seed(2026)
df <- data.frame(
  LAT_WGS84 = 43.6 + rnorm(80, 0, 0.04),
  LONG_WGS84 = -79.4 + rnorm(80, 0, 0.04)
)
morie_tps_ripley_k(df, radii_km = c(0.5, 1, 2))
#> Ripley's K -- ?
#> ===============
#> Call: morie_tps_ripley_k(df=<80r>) 
#> 
#>   Points used               80
#>   Bounding-box area (km^2)  306.6
#>   Intensity (pts/km^2)      0.261
#>   Radii (km)                0.5, 1, 2
#>   Clustered radii           3
#> 
#> Across 80 point(s) with intensity 0.261 points/km^2, K(r) exceeds the Poisson CSR baseline at 3 of 3 radii (=> clustering at those scales). The Besag L(r)-r ranges from +0.153 to +0.401; positive values indicate clustering, negative values regularity.