Computes local Moran's Ii for each neighbourhood given a k-NN spatial weights graph on centroid lat/long, with HH / LL / HL / LH quadrant classification.
Usage
morie_tps_local_morans_i(
df,
hood_col = "HOOD_158",
ds_name = "?",
k_neighbours = 5L,
top_n = 20L,
lat_col = "LAT_WGS84",
lon_col = "LONG_WGS84"
)Examples
set.seed(2026)
df <- data.frame(
HOOD_158 = sample(letters[1:15], 300, replace = TRUE),
LAT_WGS84 = 43.6 + runif(300, 0, 0.2),
LONG_WGS84 = -79.4 + runif(300, 0, 0.2)
)
morie_tps_local_morans_i(df, top_n = 5L)
#> LISA (local Moran's Ii) -- ?
#> ============================
#> Call: morie_tps_local_morans_i(df=<300r>, hood_col=HOOD_158, k=5)
#>
#> Spatial unit HOOD_158
#> Neighbourhoods 15
#> Hot spots (HH) 5
#> Cold spots (LL) 2
#> HL outliers (high-in-low) 3
#> LH outliers (low-in-high) 5
#>
#> LISA identified 5 hot-spot (HH) and 2 cold-spot (LL) neighbourhood(s) on a k=5-NN graph (n=15). HL outliers (high count surrounded by low neighbours) = 3, LH = 5. Top neighbourhood by local Ii: 'm' with Ii=+0.811.