Session 3 โ€” Introduction to Spatial Regression

OLS with spatial data ยท residual autocorrelation ยท the spatial lag Wy ยท spatial lag model (SAR) and its impacts ยท spatial error model (SEM) ยท diagnostics and model choice

Session 2 asked whether nearby values resemble one another. Session 3 asks the regression question: how should a regression model change when observations are spatially dependent?

The starting point is ordinary least squares (OLS). If, after adjusting for covariates, the residuals of neighbouring areas still resemble each other, the model has left something spatial unexplained. There are two classic ways to put spatial dependence into the model, and they tell different scientific stories:

The sessionโ€™s emphasis is conceptual: what ฯ and ฮป mean, why SAR coefficients cannot be read like OLS coefficients, and how to reason about model choice. No estimator derivations.

Slides: โ€œsession_3_v0-1.pdfโ€ (Qinyun Lin, 9 October 2026, 10:15โ€“12:00).

Learning goals (slide 4): by the end of the session you should be able to

  1. recognize why spatial dependence can matter in regression;
  2. distinguish spatial lag (SAR) from spatial error (SEM) conceptually;
  3. interpret what ฯ and ฮป represent, without deriving estimators;
  4. diagnose residual spatial autocorrelation and think about model choice.

Optional viewing: Luc Anselin, Applied Spatial Regression Analysis (YouTube playlist, 13 lectures). A step-by-step introduction to spatial regression; it also covers more advanced topics than STA530. The lectures that match a section are linked in a Watch box at the end of that section; the full list is on Resources.

Residuals. eแตข = yแตข โˆ’ ลทแตข, the part of the outcome the covariates did not explain. OLS assumes the errors are independent of each other.

The spatial lag from Session 2. With a row-standardized weights matrix W, (Wy)แตข = ฮฃโฑผ wแตขโฑผ yโฑผ is the average of area iโ€™s neighbours. See 2.8.

Geometric series. 1 + ฯ + ฯยฒ + ฯยณ + โ€ฆ = 1/(1 โˆ’ ฯ) when |ฯ| < 1. The matrix version explains SAR feedback.

3.1 OLS with spatial data: the assumption that can fail

In short. Ordinary regression assumes that what the model misses (the residuals) is unrelated between observations. With areas, neighbouring residuals are often alike, which makes standard errors too small and can bias the results.

The familiar model:

\[ y = X\beta + \varepsilon . \]

Key assumption here: after accounting for X, there is no remaining spatial dependence in the errors. Spatial data give a reason to doubt that: the slide shows the same regression equation with two very different residual maps, one that looks random and one with clear clusters of positive and negative residuals.

Figure 1: Two residual maps from the same kind of regression, simulated. Left: residuals scattered at random, residual Moranโ€™s I near 0, the OLS assumption looks fine. Right: positive residuals cluster in some regions and negative in others, residual Moranโ€™s I is high, so something spatial was left out of the model.

Why it matters:

  • Standard errors. With positively autocorrelated residuals, neighbouring areas carry overlapping information. OLS treats them as independent, so it typically understates the uncertainty: standard errors too small, p-values too small.
  • Bias. If the spatial pattern comes from a spatial process in the outcome (SAR) or from an omitted spatially patterned confounder, the coefficients themselves can be biased.
  • Science. Clustered residuals say the model has missed something that is organised in space.

โ€œIf I include enough covariates, spatial dependence goes away.โ€ Sometimes, if the covariates capture the spatial process. But clustered residuals can remain after adjustment, and the next step is to ask why (3.2), not to add variables blindly.

On the exam, be able to say: OLS assumes no remaining spatial dependence in the errors after accounting for X. Spatially autocorrelated residuals mean understated uncertainty and possibly biased coefficients.

3.2 After adjustment, neighbouring residuals are similar: what could it mean?

In short. If residuals still cluster after adjustment, ask why: outcomes spreading between areas, a missing spatially patterned factor, or a wrongly specified model.

The slideโ€™s example: area-level cardiovascular mortality modelled with age structure, income, smoking prevalence and urbanicity. After adjustment, neighbouring areas still have similar residuals. Possible explanations:

Explanation Model it points to
A A spatial process links outcomes across areas (one areaโ€™s outcome affects its neighboursโ€™) Spatial lag (SAR)
B An omitted determinant is spatially patterned (pollution, access to care, deprivation not fully measured) Spatial error (SEM)
C Something else: misspecification (wrong functional form, a missing nonlinear term), spatial heterogeneity (the relationship differs across regions), wrong scale Fix the model; heterogeneity models (outside the course)

For cardiovascular mortality, A is hard to defend (deaths in one area do not cause deaths next door). B and C are more plausible.

On the exam, be able to say: Three explanations: a spatial process linking outcomes (SAR), an omitted spatially patterned determinant (SEM), or misspecification/heterogeneity.

3.3 The new ingredient: the spatially lagged outcome Wy

In short. Wy is simply โ€œthe average outcome of my neighboursโ€.

  • W defines who is a neighbour and how much each counts (Session 2).
  • y is the outcome in every area.
  • Wy is the spatially lagged outcome: for each area, a weighted summary of its neighboursโ€™ y.

If W is row-standardized, (Wy)แตข is roughly the average outcome among area iโ€™s neighbours.

Four areas in a row A โ€“ B โ€“ C โ€“ D, rook neighbours, row-standardized:

Area Neighbours wแตขโฑผ y (Wy)แตข
A B 1 10 14
B A, C ยฝ, ยฝ 14 (10 + 18)/2 = 14
C B, D ยฝ, ยฝ 18 (14 + 30)/2 = 22
D C 1 30 18

3.4 The spatial lag model (SAR) and ฯ

In short. SAR adds the neighboursโ€™ average outcome as a predictor: y depends on the y next door. ฯ says how strongly.

Think of it as: Contagion: an areaโ€™s rate rises when its neighboursโ€™ rates rise.

\[ y = \rho W y + X\beta + \varepsilon \]

In words: an areaโ€™s outcome = ฯ times its neighboursโ€™ average outcome + the usual covariate part + noise.

Parameter Meaning
ฯ (rho), spatial dependence How strongly outcomes are linked through W. ฯ = 0 gives back OLS; ฯ > 0 means an areaโ€™s outcome rises with its neighboursโ€™ outcomes
ฮฒ, covariates Association with X, conditional on the spatial process
ฮต, remaining noise Assumed independent

Key idea: y in one area is jointly determined with y in neighbouring areas. y appears on both sides: that is why OLS cannot simply be applied with Wy as an extra covariate (Wy is correlated with ฮต; the model is estimated by maximum likelihood or other methods outside the course).

Mechanisms that make SAR plausible: interaction, diffusion, feedback, where the outcome itself spreads.

Optional, from the Canvas post. Luc Anselinโ€™s lecture series Applied Spatial Regression Analysis goes beyond STA530 in places.

On the exam, be able to say: SAR: y = ฯWy + Xฮฒ + ฮต. ฯ measures how strongly outcomes are linked through W; y is jointly determined across neighbours.

3.5 Why SAR creates feedback: direct, indirect and total impacts

In short. In SAR, changing x in one area spreads to the neighbours and comes back. So the total effect of x is larger than ฮฒ and splits into a direct part (own area, including feedback) and an indirect spillover part (other areas).

Think of it as: A stone dropped in a pond: ripples spread outward and bounce back.

Solve the SAR model for y:

\[ y = (I - \rho W)^{-1} X\beta + (I - \rho W)^{-1}\varepsilon, \qquad (I - \rho W)^{-1} = I + \rho W + \rho^2 W^2 + \rho^3 W^3 + \dots \]

The expansion (the Neumann series, the matrix version of a geometric series) shows how a change spreads:

Term Path
I The areaโ€™s own effect
ฯW One step: to the neighbours
ฯยฒWยฒ Two steps: neighbours of neighbours, including feedback back to the starting area
ฯยณWยณ, โ€ฆ Continued propagation through the network

Intuition. Raise x in area B. That changes y in B, which (through ฯW) changes y in A and C, which feeds back to B, and so on. So ฮฒ is not the complete impact of x.

Toy example (slide 12). Three areas, everyone neighbours with everyone, ฯ = 0.2, ฮฒ = 1, row-standardized

\[ W = \begin{pmatrix} 0 & 0.5 & 0.5\\ 0.5 & 0 & 0.5 \\ 0.5 & 0.5 & 0\end{pmatrix}. \]

Impact matrix (I โˆ’ ฯW)โปยนฮฒ (rows: y in A, B, C; columns: x in A, B, C):

x in A x in B x in C
y in A 1.023 0.114 0.114
y in B 0.114 1.023 0.114
y in C 0.114 0.114 1.023

If x is 1 unit higher in B: B changes by about +1.02 (direct, including feedback), A and C by about +0.11 each (indirect), total = 1.25.

The slide shows 1.019 and 0.116; the exact inverse gives 1.023 and 0.114. The total, ฮฒ/(1 โˆ’ ฯ) = 1/0.8 = 1.25, is the same either way and is the number to remember.

Impact Definition
Direct Change in the area where x changes, including feedback that returns through neighbours
Indirect (spillover) Change transmitted to other areas through the spatial network
Total Direct + indirect. With row-standardized W, total = ฮฒ/(1 โˆ’ ฯ)
Figure 2: Impacts of raising x by one unit in the centre area (black outline) of a 9 ร— 9 grid, SAR with ฮฒ = 1 and row-standardized queen weights. With ฯ = 0 only the centre changes (this is OLS). As ฯ grows, the change spreads to neighbours and beyond, and feedback raises the centreโ€™s own change (direct impact > 1). The sum of the spillovers can exceed the direct impact.

For SAR, reporting only the raw regression coefficient ฮฒ can be misleading. Report direct, indirect and total impacts (usually averaged over areas).

Try it. Compute the impact matrix for the toy example, then change ฯ.

Optional, from the Canvas post. Luc Anselinโ€™s lecture series Applied Spatial Regression Analysis goes beyond STA530 in places.

On the exam, be able to say: Because of feedback, ฮฒ is not the full effect. Report direct, indirect (spillover) and total impacts; with row-standardized W the total impact is ฮฒ/(1 โˆ’ ฯ).

3.6 Is a SAR story plausible in epidemiology?

In short. Choose SAR only if it is plausible that outcomes truly affect each other across borders: infections yes, cancer deaths hardly.

The equation may fit the data; the scientific mechanism still needs to make sense.

Outcome Genuine cross-area outcome process?
Infectious disease Plausible: cases in one area contribute to transmission into connected areas
Health behaviours Plausible: social interaction or diffusion can cross administrative boundaries
Cancer mortality Hard to defend: neighbouring mortality rates do not โ€œcauseโ€ one another. Similar rates nearby more likely reflect shared, partly unmeasured exposures โ†’ SEM

On the exam, be able to say: SAR fits a genuine cross-area outcome process (infectious disease, diffusion of behaviours). For outcomes such as cancer mortality the mechanism is implausible; correlated errors (SEM) are a better story.

3.7 The spatial error model (SEM) and ฮป

In short. SEM keeps ordinary regression but lets the errors of neighbouring areas be correlated: something unmeasured and spatially smooth is shared. ฮป says how strongly.

Think of it as: Neighbours who share the same weather: their outcomes are alike, not because they affect each other, but because of a common cause nobody measured.

\[ y = X\beta + u, \qquad u = \lambda W u + \varepsilon \]

In words: an ordinary regression, except that the error of each area = ฮป times its neighboursโ€™ errors + fresh noise.

Parameter Meaning
ฮป (lambda), error dependence How strongly the unobserved error process is spatially structured
ฮฒ, covariates Regression associations after accounting for correlated errors. Interpreted as in OLS: no spillover impacts
ฮต, innovation The remaining independent error

Here neighbouring y values are not on the right-hand side. The dependence sits in the error u.

What creates spatially correlated errors? Unmeasured influences that are similar in nearby areas:

Source Why it is spatial
Air pollution Varies smoothly across neighbouring areas but is incompletely measured
Healthcare access Catchment areas and service environments cross administrative boundaries
Built environment Unmeasured features of nearby areas resemble one another
SES / context Area-level social conditions are rarely captured by one covariate

SEM can be viewed as modelling residual spatial structure that X did not explain.

โ€œฯ and ฮป are the same thing in different models.โ€ Both measure spatial dependence, but in different places. ฯ links outcomes (and so changes how ฮฒ is interpreted, through feedback). ฮป links errors (ฮฒ keeps its usual meaning; the dependence mainly affects efficiency and standard errors). Also note: ฯ in SAR is unrelated to the ฯ mixing parameter in BYM2 (Session 4), which shares only the letter.

On the exam, be able to say: SEM: y = Xฮฒ + u, u = ฮปWu + ฮต. ฮป measures spatial dependence in the unexplained part. ฮฒ is read as in OLS (no spillovers).

3.8 SAR vs SEM: same symptom, different story

In short. Both models handle clustered residuals, but tell different stories: contagion between outcomes (SAR) or a shared hidden cause (SEM). The data alone rarely decide; the mechanism should.

Think of it as: Contagion vs shared weather.

Observed symptom: OLS residuals are spatially autocorrelated. Residual autocorrelation alone does not tell you which story is true.

Spatial lag (SAR) Spatial error (SEM)
Equation y = ฯWy + Xฮฒ + ฮต y = Xฮฒ + u, u = ฮปWu + ฮต
Dependence enters through The outcome The error process
Link yแตข โ†”๏ธŽ neighbouring y uแตข โ†”๏ธŽ neighbouring u
Mechanism Interaction, diffusion, feedback / spillovers Spatially patterned omitted processes
Spatial parameter ฯ ฮป
Reading ฮฒ Not the full effect: report direct, indirect, total impacts As in OLS, conditional on X
Epidemiological example Infectious disease spreading between municipalities Air quality shared but poorly measured
Figure 3: Causal diagram: an arrow means โ€œdirectly affectsโ€. Left: SAR, where the outcomes of neighbouring areas affect each other (ฯยทWy). Right: SEM, where there is no arrow between the outcomes; an unmeasured, spatially smooth factor U affects both, so their errors are correlated (ฮป).
The unexplained part of the outcome is strongly spatially structured
An increase in an areaโ€™s outcome raises its neighboursโ€™ outcomes
The covariate effect ฮฒ has to be split into direct and indirect parts
Sixty percent of the variation in the outcome is caused by geography
ฮป describes dependence in the error process: the residual (unexplained) variation is spatially correlated. Outcome-to-outcome effects and impacts belong to SAR. ฮป is not a share of variance explained or caused by space.

Optional, from the Canvas post. Luc Anselinโ€™s lecture series Applied Spatial Regression Analysis goes beyond STA530 in places.

On the exam, be able to say: SAR: dependence in the outcome, ฯ, feedback and spillovers. SEM: dependence in the errors, ฮป, omitted spatially patterned processes. Residual autocorrelation alone does not tell which is true.

3.9 A practical workflow and residual Moranโ€™s I

In short. Fit OLS, check whether the residuals cluster, think about why, compare spatial models, then interpret carefully.

flowchart LR
  A["1 ยท Fit OLS<br/>scientific model<br/>and covariates"] --> B["2 ยท Check residuals<br/>map them; test residual<br/>Moran's I"]
  B --> C["3 ยท Ask why<br/>what mechanism could<br/>create the dependence?"]
  C --> D["4 ยท Compare models<br/>SAR / SEM + diagnostics;<br/>check residuals again"]
  D --> E["5 ยท Interpret carefully<br/>impacts for SAR; no causal<br/>language without causal design"]

Workflow: each arrow means โ€œthenโ€. Not causal. From OLS to spatial regression (slide 19).

Diagnostics support reasoning; they do not replace it.

Residual Moranโ€™s I asks: after fitting the model, is there evidence of remaining spatial autocorrelation? If it is significant:

  • something spatial remains unexplained;
  • it does not tell SAR from SEM by itself;
  • it can also reflect other misspecification or heterogeneity.

An important diagnostic goal for the spatial model: substantially reduce unexplained spatial structure (residual Moranโ€™s I near zero after fitting SAR or SEM).

On the exam, be able to say: Residual Moranโ€™s I detects remaining spatial structure but does not distinguish SAR from SEM, and can reflect misspecification. Diagnostics support reasoning; they do not replace it.

3.10 Lagrange multiplier (LM) tests

In short. LM tests ask whether a lag term or an error term would improve the OLS model. The robust versions help when both look significant.

LM tests start from the OLS fit and ask whether adding a spatial component is supported:

Test Question
LM-lag Is adding a spatially lagged outcome (ฯWy) supported?
LM-error Is spatial dependence in the errors (ฮป) supported?
Robust LM-lag / robust LM-error Each test made robust to the presence of the other kind of dependence. Useful when both simple LM tests are significant

A common reading: if only one simple test is significant, consider that model; if both are, look at the robust versions and see which remains clearly significant.

For this course (slide 21): know what the tests are asking. Do not memorise formulas, and do not treat p-values as the scientific mechanism. Model choice should combine theory, diagnostics and interpretability. The tests are โ€œuseful, but not a magic decision treeโ€.

Optional, from the Canvas post. Luc Anselinโ€™s lecture series Applied Spatial Regression Analysis goes beyond STA530 in places.

On the exam, be able to say: LM-lag tests for a spatially lagged outcome, LM-error for spatially dependent errors; robust versions are used when both are significant. Know what they ask; combine with theory.

3.11 Which model story fits better?

In short. Pick the model whose story matches the process: a shared, poorly measured environment โ†’ SEM; an outcome that spreads โ†’ SAR.

The slideโ€™s two scenarios:

Scenario Natural starting model Why
A. Neighbouring municipalities share an incompletely measured air-quality environment SEM The dependence comes from an omitted, spatially smooth exposure: correlated errors
B. An infectious outcome diffuses through movement between connected municipalities SAR may be plausible Outcomes in one area directly affect outcomes in connected areas

Real analyses can be less clean. The point is to articulate the assumed process.

Spatial lag (SAR), because uptake itself spreads between areas
Spatial error (SEM), because uptake is shaped by unmeasured factors
OLS, because spatial dependence never affects the estimated ฮฒ
A model with no W, since diffusion is not a geographic process
Social diffusion of behaviour is an outcome-to-outcome process, which is what ฯWy represents. With SAR, remember to report direct and indirect (spillover) impacts instead of ฮฒ alone.

On the exam, be able to say: Shared incompletely measured air quality โ†’ SEM; infectious diffusion between connected areas โ†’ SAR. The point is to state the assumed process.

3.12 Deliberately not covered in STA530

In short. Estimation methods and more advanced spatial models are outside the course.

The slides list what the session leaves out:

  • maximum-likelihood derivations;
  • instrumental variables / generalized method of moments (GMM) estimation;
  • higher-order spatial models;
  • spatial Durbin and SLX models (which add WX, the neighboursโ€™ covariates);
  • geographically weighted regression (GWR) and other spatial heterogeneity models.

The stated goal: understand what spatial dependence means, recognize basic models, and interpret them responsibly โ€” not become spatial econometricians in 90 minutes.

These cover exactly what STA530 leaves out (estimation and the Durbin model). Not needed for the course.

3.13 Take-home messages and key questions

  1. Check geography after regression. Spatial structure can remain after covariate adjustment.
  2. SAR and SEM encode different mechanisms: outcome feedback versus spatially correlated errors.
  3. SAR changes interpretation: direct and indirect impacts matter because of feedback.
  4. Diagnostics are evidence, not answers: use residual checks and tests together with scientific reasoning.

Because y appears on both sides. A change in x in one area changes y there, which changes neighboursโ€™ y through ฯW, which feeds back. The total effect is captured by (I โˆ’ ฯW)โปยนฮฒ; with row-standardized W the total impact is ฮฒ/(1 โˆ’ ฯ), larger than ฮฒ when ฯ > 0.

Because both SAR (outcome dependence) and SEM (error dependence) produce autocorrelated OLS residuals, and so can misspecification or spatial heterogeneity. The diagnostic says something spatial is unexplained, not which mechanism. Theory, LM tests and interpretability have to be combined.

ฯ is the strength of dependence between an areaโ€™s outcome and its neighboursโ€™ outcomes (through Wy). ฮป is the strength of spatial dependence in the error process: how spatially structured the unexplained part is.

OLS treats every area as an independent piece of information. If neighbouring residuals are alike, the effective amount of information is smaller than n, so the true sampling variability of ฮฒฬ‚ is larger than OLS reports: standard errors too small, confidence intervals too narrow, p-values too small.