Put geography into a regression and “space” almost never means one thing. It hides two different problems that demand different tools, and naming which one you have is the first real modelling decision — get it wrong and everything downstream is quietly invalid.
Two phenomena, not one
Spatial dependence is a property of the covariance of the data: an outcome, or the errors around it, are correlated across nearby units. Tobler’s first law — near things are more related than distant ones — is the informal version. You encode “nearby” in a spatial weights matrix (contiguity, distance bands, or k-nearest-neighbours, usually row-standardised) and then write one of two canonical models:
In the lag model the outcome itself spills over: my value responds to my neighbours’ values, with measuring the strength. Because sits on both sides, a shock anywhere propagates everywhere through the reduced form , so a covariate’s effect splits into a direct part and an indirect (spillover) part — the naïve is no longer the marginal effect. In the error model the spillover lives in omitted, spatially structured factors captured by ; here the coefficients remain consistent under OLS, but the standard errors are wrong and inference is misleading.
The crucial point: in both, the relationship is global. One vector describes the whole map. Space lives in the covariance structure, not in the parameters.
Spatial heterogeneity is the opposite — the parameters themselves move across space:
where are the coordinates of observation . Geographically weighted regression (GWR) estimates a separate, kernel-weighted regression at every location — the bandwidth chosen by AICc or cross-validation — and returns a surface of local coefficients, one per place. There is no single “effect of X”; there is an effect-here and an effect-there. Space now lives in the parameters, not (only) in the covariance.
Telling them apart
- Fit a global OLS and look at the residuals.
- Moran’s I on those residuals tests for leftover spatial structure:
A significant I says “space remains” — but it does not say which kind. Both dependence and unmodelled heterogeneity leave autocorrelated residuals, so Moran’s I is a smoke alarm, not a diagnosis.
3. To discriminate dependence, use the LM (Lagrange multiplier) tests and their robust variants (Anselin’s decision rule): the robust LM-error versus robust LM-lag statistic points you toward SEM or SAR.
4. To detect heterogeneity, ask a different question — does a global model misfit systematically across whole regions? Spatial-regime / Chow-type tests, an AICc improvement of GWR over the global fit, or a patchy local-R² surface are the tells.
Why the distinction is not pedantic
- Model a genuinely varying relationship with a single lag term and you fold the misfit into , then report one averaged coefficient that is true nowhere.
- Model merely neighbour-correlated errors with GWR and you let the coefficients wander to absorb noise, over-fitting a “heterogeneity” surface that is really an artefact.
And they co-occur. A relationship can vary across space and leave neighbour-correlated errors; then you need both — GWR with spatially robust inference, a spatially-varying-coefficient model, or MGWR when different covariates operate at different spatial scales.
The one-line test
Ask: is my neighbour’s value leaking into mine, or does the rule linking X to y change as I move across the map? The first is a covariance problem (spatial dependence); the second is a parameter problem (spatial heterogeneity). The entire modelling chain follows from which answer is yes.