Tutorial series · 2 parts

Spatial regression in Python

Model relationships that change across space. The series fits spatial lag and error regression models, then lets coefficients vary by place with geographically weighted regression.

Level
Intermediate to Advanced
Parts
2, all published
Reading time
About 35 minutes

Start with part 1: Spatial regression in Python: OLS diagnostics, spatial lag and spatial error models with spreg

The parts, in order

  1. Part 1 Intermediate 18 min read

    Spatial regression in Python: OLS diagnostics, spatial lag and spatial error models with spreg

    Fit spatial regression models in Python with PySAL's spreg on real West Yorkshire house prices: test the OLS residuals for spatial autocorrelation, read the Lagrange Multiplier diagnostics, fit spatial lag and spatial error models, compare them by AIC and log-likelihood, interpret direct, indirect and total impacts, and check how much the spatial weights matter.

  2. Part 2 Advanced 17 min read

    Geographically weighted regression in Python: GWR and MGWR with mgwr

    Fit geographically weighted regression (GWR) and multiscale GWR (MGWR) in Python with the mgwr package on real West Yorkshire house prices: choose the bandwidth by AICc, map local coefficients with a multiple-testing correction, read local R² and local collinearity, and compare against global OLS, spatial lag and spatial error models.

All tutorial series