Hotspots and Point Patterns
A point pattern records event locations inside an observation window. It differs from areal data: moving a boundary, missing an event, or changing the population at risk can change apparent clustering even when the underlying process does not change.
Prerequisites
Complete spatial autocorrelation. Keep its discipline of defining neighbors, boundaries, and the null before interpreting a statistic.
Learning goals
- Distinguish event points, sampling locations, and values attached to areas.
- Define complete spatial randomness (CSR) conditional on the event count and window.
- Compute a transparent second-order summary with a stated edge treatment.
- Treat local hotspot flags as exploratory multiple tests rather than causes or policy targets.
Window, intensity, and null
The example fixes a square and six observed events. Its conditional CSR null holds fixed and places each event independently and uniformly inside the window. That null assumes homogeneous intensity; known exposure or population variation calls for an inhomogeneous model or an offset, not a “hotspot” label based on raw counts.
For radius , the illustrative estimator is
The calculation uses toroidal distances: opposite window edges wrap together. This fully specified boundary condition removes ordinary edge truncation for the teaching square, but it is rarely physically plausible for a real city. Translation, isotropic, border, or simulation-based corrections answer related but non-identical questions. is reported in metres; values above suggest more close pairs than homogeneous Poisson expectation at that scale.
Worked example
import numpy as np
points = np.array([[20, 20], [24, 22], [27, 18], [72, 70], [76, 72], [74, 77]], dtype=float)
side_m, radius_m = 100.0, 12.0
def toroidal_k(sample):
differences = (sample[:, None, :] - sample[None, :, :] + side_m / 2) % side_m - side_m / 2
distances = np.sqrt((differences ** 2).sum(axis=2))
ordered_pairs = ((distances <= radius_m) & ~np.eye(len(sample), dtype=bool)).sum()
k_value = side_m ** 2 * ordered_pairs / (len(sample) * (len(sample) - 1))
return int(ordered_pairs), k_value
pairs, observed_k = toroidal_k(points)
rng = np.random.default_rng(57)
simulated = np.array([toroidal_k(rng.uniform(0, side_m, size=points.shape))[1] for _ in range(999)])
p_clustered = (1 + np.count_nonzero(simulated >= observed_k)) / (len(simulated) + 1)
counts = [int(((points[:, 0] >= x) & (points[:, 0] < x + 50) &
(points[:, 1] >= y) & (points[:, 1] < y + 50)).sum())
for y in (0, 50) for x in (0, 50)]
print(f"window_m=100x100 events={len(points)} radius_m={radius_m:.0f} boundary=toroidal")
print(f"ordered_close_pairs={pairs} K_m2={observed_k:.0f} L_m={(observed_k / np.pi) ** 0.5:.2f}")
print(f"null=conditional_CSR permutations=999 pseudo_p={p_clustered:.3f} quadrat_counts={counts}")
Expected output:
window_m=100x100 events=6 radius_m=12 boundary=toroidal
ordered_close_pairs=12 K_m2=4000 L_m=35.68
null=conditional_CSR permutations=999 pseudo_p=0.001 quadrat_counts=[3, 0, 0, 3]
The events were deliberately generated as two tight groups. The simulation detects departure from the declared homogeneous null; it does not identify why the groups exist.
From patterns to local hotspots
Getis–Ord statistics and local indicators compare a location and its neighborhood with a reference distribution. Define whether the focal observation is included, how weights are standardized, which alternative is tested, and how many locations are tested. Report adjusted results or an exploratory false-discovery policy alongside effect sizes. A local high-value cluster is not automatically an event-point cluster, an individual risk, an intervention effect, or an optimal service location.
Limitations and common mistakes
- Duplicate coordinates, positional uncertainty, geocoding selection, and event undercounting affect short-range structure.
- Conditioning on ignores uncertainty in the total event count.
- Trying many radii and publishing only the strongest result is multiple testing.
- Raw events can follow population exposure rather than elevated individual risk.
- The toroidal correction is transparent here but inappropriate where opposite borders are not neighbors.
Practice
Write an analysis plan for the same six events with an irregular window and unequal exposure. Specify the null, edge correction, radius set, multiplicity rule, and what evidence would remain purely exploratory.
Next steps
Next, turn sampled values into predictions at unsampled locations in spatial interpolation.
Primary sources
Checked 2026-10-18: B. D. Ripley, The Second-Order Analysis of Stationary Point Processes; A. Getis and J. K. Ord, The Analysis of Spatial Association by Use of Distance Statistics; L. Anselin, Local Indicators of Spatial Association—LISA.