Spatial Statistics
Spatial statistics is really three subjects wearing one name, and the distinction is not decoration — it decides what the data even are. Areal data attach a value to a region, so there are no coordinates at all, only which regions touch which; the model lives on a graph. Geostatistical data are measured at points in continuous space, where distance is meaningful and the object of interest is the surface between the observations. Point-process data have no attached value: the locations themselves are the outcome, and the question is whether they cluster. Fit the wrong family to your data and the answer is not merely imprecise, it is about a different quantity.
What unifies them is the reason to bother. Nearby things resemble each other, so treating observations as independent throws away information and, for rare events in small areas, leaves rate estimates dominated by sample size rather than risk. The Bayesian response is the one used throughout this collection: put the dependence in a prior and let the model borrow strength — from neighbours on a graph, from a covariance function across distance, or from an intensity surface. A recurring theme is being careful about what is genuinely identified: a smoothed map that looks decisive can rest on an assumption the data cannot check, so several of these examples end in an exceedance probability or a sensitivity analysis rather than a single number.
The arc runs foundations first, then the two methodological branches — the epidemiologist's conditional autoregression and the economist's simultaneous one — then geostatistics and point processes, then time, and finally a real application. That last step is the point of the rest: the same machinery, at national scale, used to ask whether the American “disability belt” is an artefact of age, of small-county noise, or of testing three thousand hypotheses at once — and whether it is spreading. It is none of the three, and it is not.
The prior that does the work on a graph. For areal data the whole model rests on one construction. A CAR prior says each region’s value, given all the others, is normal with a mean equal to the average of its neighbours — dependence specified locally, one region at a time, which is what makes it computable on a graph of three thousand counties. The version used almost everywhere here is the intrinsic one, ICAR, which is improper: it constrains only the differences between neighbours and says nothing about the overall level, so the whole field can slide up or down without changing its probability. That is harmless as a prior and fatal if left alone, which is why an ICAR field is always accompanied by a sum-to-zero constraint — the level belongs to the intercept, and without the constraint the two are unidentified and the sampler crawls along the ridge between them. The BYM model then adds an ordinary independent random effect alongside the spatial one, so the data can decide how much of the variation is genuinely spatial and how much is just region-level noise.
How to read a variogram. Geostatistics replaces the graph with distance, and the object that summarises it is the variogram: average squared difference between pairs of observations, plotted against how far apart they are. It normally rises and then flattens, and its three features are the vocabulary of the whole field. The nugget is the intercept — the variance still present at zero distance, which is measurement error plus whatever varies at a finer scale than the sampling. The sill is the plateau, the total variance once points are far enough apart to be unrelated. The range is the distance at which it gets there, so it is the honest answer to “how far does the correlation reach?”. Fitting a covariance function — usually a Matérn, whose extra smoothness parameter controls how rough the surface is allowed to be — is fitting those three numbers, and kriging is what you do with them afterwards.
Why a spatial coefficient is not a marginal effect. This is the trap in the econometric branch and it is easy to walk into. In a spatial-autoregressive model the outcome in one region depends on the outcomes of its neighbours, which in turn depend on theirs — so changing one region’s covariate changes that region, then its neighbours, then their neighbours, and some of the effect returns to where it started. The coefficient β is not the answer to “what happens if this county’s income rises?”. The LeSage–Pace decomposition gives the quantities that are: a direct effect (the average impact on the region itself, including the feedback that comes back to it), an indirect effect or spillover (the total impact on everywhere else), and their sum, the total effect. Reporting β alone systematically understates the answer, which is the single most common error in applied spatial econometrics.
Two caveats that apply to every map here. The first is the modifiable areal unit problem: for areal data the regions are an administrative accident, and both the strength of a correlation and sometimes its sign can change if the same underlying data are aggregated to different boundaries. Nothing in the model can detect this, because the model never sees anything but the boundaries it was given. The second is edge effects. Regions and points at the boundary of the study area have neighbours that were never observed, so they are systematically less informed than interior ones — which for point processes means a naive clustering statistic will find spurious sparseness at the edges unless it is corrected. Neither is a flaw to be fixed so much as a fact to be stated, and both are reasons to prefer an exceedance probability over a point estimate when the conclusion is going to be drawn on a map.
What the data are, what a variogram pins down, and whether the belt is real
A is a schematic — it illustrates a distinction rather than reporting a result. B and C are committed notebook output, from the geostatistics and disability-belt projects.
A is the distinction the whole section turns on. Areal data have no coordinates at all — only an adjacency graph, so “distance” is a number of steps and the model is a prior over that graph. Geostatistical data live in continuous space, where distance is real and the quantity of interest is the surface between the samples. Point-process data carry no value whatsoever: the locations are the outcome, and the question is whether they cluster more than chance allows. Fitting the wrong family is not a loss of precision, it is an answer to a different question.
B is a caution about the tool the geostatistics branch depends on. All five curves are
fitted to the same zinc measurements; they differ only in where the empirical variogram was cut
off and how the bins were weighted. The fitted range runs from 278 m to 896 m —
more than threefold — and R’s gstat lands at 450 m in the middle of that spread.
Marked on the primary fit are the three numbers that make up the vocabulary: the nugget
at zero distance (0.00 here), the sill it flattens to (0.60), and the practical
range at which it effectively gets there (833 m). The reassuring part is what does not
move: the kriged surfaces from these fits agree to 0.99 and their leave-one-out errors
to about 0.01, because range and sill trade off along a ridge the predictor is nearly blind to. Quote a
range as a finding and you are over-reading; use it to krige and you are fine.
C is the capstone, and it is built as an elimination rather than a claim. A band of high disability receipt across Appalachia and the Deep South could be an artefact of four things, and each has a statistic that settles it. Not age: standardising for it barely moves the geography (correlation 0.954), and the share aged 55–64 explains only 14% of the variance in crude rates. Not small-county noise: the spatially structured standard deviation, 0.47, dominates the unstructured 0.20, and smoothing changes the ranking almost not at all (0.999). Not multiple testing, though this is the one that bites — an uncorrected scan flags 401 counties when about 155 of 3,099 would be flagged by chance, and Benjamini–Hochberg leaves 239, so the belt survives but its headline size shrinks by roughly a third. And it is not spreading: over two decades of panel data the edges do not advance. Four candidate explanations, four rejections, and the map is left standing.
How the seven examples relate
Grouped by what kind of data they take. The two areal branches answer the same question in different traditions and are worth reading against each other.
Areal — a value per region
No coordinates, only a neighbour graph. Two traditions, one data type.
1 · Foundationsweights, Moran’s I, and the CAR / BYM family — the epidemiologist’s route 2 · Multivariate CARtwo correlated outcomes sharing one spatial component 3 · SAR / SEMthe econometrician’s route — and why β is not a marginal effectPoints in continuous space
Where distance is real — and where the locations are themselves the outcome.
4 · Geostatisticsvariograms and kriging, which turns out to be Gaussian-process regression 5 · Point processesPoisson and log-Gaussian Cox — modelling the pattern itselfAdding time, then reality
The same machinery with a temporal dimension, then at national scale.
6 · Space-time CARKnorr-Held ANOVA — space, time, and the interaction between them 7 · The disability beltthe whole toolkit on SSDI and SSI across 3,099 countiesParts 1 and 3 are the pair to read together: a conditional autoregression and a simultaneous one are different models of the same areal data, arrived at from epidemiology and from economics, and they disagree about what a coefficient means. Part 7 uses both.
Areal Foundations — Weights, Autocorrelation & the CAR Family
The entry point, and the machinery everything downstream reuses. Regions have no coordinates,
only a neighbour graph, and North Carolina's SIDS rates show why that matters:
raw standardised ratios span 0 to 4.7 across 100 counties, mostly sample size
rather than risk. Moran's I confirms the structure is real — with a wrinkle
worth naming, since the statistic depends on how the weights are normalised (0.21 binary, 0.23
row-standardised, the same number spdep reports). The Besag–York–Mollié
model then splits risk into a spatially structured effect with a CAR prior and an unstructured
one, smoothing the raw spread of 0.78 down to 0.44 while keeping the high-risk
band. Three engines agree on the covariate effect — +0.42 from scratch,
+0.41 in PyMC, +0.40 in CARBayes, with relative-risk maps correlating
0.996 — and the map becomes a decision through an
exceedance probability: 7 counties elevated with confidence, not merely
elevated on a point estimate.
Joint Disease Mapping — the Shared-Component CAR
Two related outcomes on one geography, and a question a single map cannot answer:
is the geography of risk stable? The shared-component model splits each
outcome's spatial risk into a common field and an outcome-specific one, so
the overlap becomes a number. North Carolina SIDS in 1974–78 and 1979–84 correlate just
0.21 raw — almost all of it small-area noise — but 73% and
87% of each period's spatial signal is shared, for a cross-period correlation
of 0.78. The high-risk core persists; only a small residue moves. The example
also refuses to oversell that split: simulating from a known shared fraction of 0.50
returns anything from 0.14 to 0.86, so the fraction is close to unidentified
while the correlation is about twice as stable — which is exactly why the from-scratch,
PyMC and CARBayes engines land at 0.78, 0.65 and 0.53 with heavily overlapping
intervals rather than on a single number.
Spatial Econometrics — Lag, Error, and Spillovers
The economist's branch, and a different philosophy: put the neighbour graph in the
regression rather than in a random effect. A spatial lag makes
a region's outcome depend on its neighbours' outcomes — a genuine spillover; a
spatial error treats the same W as a nuisance cleaning up omitted factors.
Same matrix, opposite meanings. On Anselin's Columbus crime data the lag
parameter is 0.39 from scratch, 0.41 in PyMC, 0.42 in spatialreg.
The payoff is that coefficients stop being the answer: because a change propagates through the
spatial multiplier, income's coefficient of −1.09 conceals a total effect of −1.82
once the spillover is counted, and both engines agree to two decimals. The choice between the
two specifications is settled by the robust Lagrange-multiplier tests
(adjRSerr p = 0.83 against adjRSlag p = 0.053) and AIC (SAR 375 < SEM 377 < OLS 383),
which both favour the lag — a statistical verdict, not a causal licence.
Geostatistics — Variograms and Kriging
The other kind of spatial data: measurements at continuous coordinates rather
than regions, where distance is meaningful and the object of interest is the surface
between the observations. The variogram estimates how similarity
decays with distance; kriging predicts the unmeasured locations and, crucially,
attaches a variance to every one — the honest uncertainty map, darkest at the samples and
brightest in the gaps. On the Meuse floodplain's 155 soil samples, adding a distance-to-river
trend cuts leave-one-out error from 0.402 to 0.383, with gstat
agreeing at 0.393 and 0.378. The example also refuses to overstate the variogram: the fitted
range runs from 278 m to 896 m purely with the binning and weighting choices,
while the surfaces still agree to 0.99 — a fitted range describes the fit, not the soil. And it
closes the loop with the rest of the collection: kriging is Gaussian-process
regression, the same equations under a different vocabulary, agreeing to 0.985 once
PyMC's kernel conventions are matched.
Spatial Point Processes — CSR, Intensity, and Cox Processes
The third kind of spatial data, where the locations themselves are the outcome
and there is no attached value at all. Ripley's K tests 3,604 Barro Colorado
Island trees against complete spatial randomness and rejects it emphatically. An
inhomogeneous Poisson intensity then ties density to elevation and gradient,
but its smooth surface cannot reproduce the fine clumping — and its standard errors assume an
independence the Ripley test has already disproved. The log-Gaussian Cox process
fixes both by adding a latent field (SD 1.28), which on a grid is exactly the
areal Poisson-CAR model: disease mapping applied to a point pattern. The cost of ignoring it is
quantified rather than asserted — kppm returns the same coefficients as
ppm but standard errors 10.7×, 10.8× and 11.4× wider, so the
clustering changes the uncertainty rather than the estimate.
Spatiotemporal Modelling — the Space-Time CAR
The method capstone, where the spatial arc meets the time-series one. A region-by-year count panel splits into a spatial main effect — which counties run high, averaged over time — a temporal main effect shared by every county, and optionally an interaction for trajectories that depart from it. Taught on real Georgia geography with a simulated process, so recovery can be checked rather than asserted: against a known truth, all three engines return the covariate at 0.29 (true 0.30) and recover the spatial map at corr 0.99 and the epidemic-style temporal wave at 1.00. The PyMC cross-check also earns its place as a lesson in geometry — a default random-walk prior left both chains hitting maximum tree depth with ESS under 100, while an explicit non-centred version reached r-hat 1.010 and ESS 406, and drew nearly seven times as many samples in half the time.
View example →The Disability Belt — a Spatial Application
The arc turned on a real question, at national scale. Across 3,099 counties and 7.0 million SSDI beneficiaries, the Appalachian and Deep South "disability belt" is tested against every alternative explanation in turn. It is not age — age-standardisation leaves the geography almost unchanged (correlation 0.954; the 55–64 share explains 14% of variance), and Buchanan County, VA still runs at 4.2× what its own age structure predicts. It is not small-county noise — BYM smoothing puts the spatial SD at more than double the unstructured one. It is not a multiple-testing artefact, though that one costs something: an uncorrected LISA reports 401 hotspot counties where 239 survive false-discovery control. A spatial-lag model puts ~70% of poverty's association in the spillover term, and the two programmes separate as their statutes predict — means-tested SSI binds harder to poverty, insurance-based DI carries the larger spatial multiplier. Over five snapshots from 2004 to 2024 the belt is entrenched, not expanding: level dwarfs trend in both engines, and the core is stable to slightly receding.
View example →