Geographically Weighted Regression (GWR)

Statistics
Introduced by
Fotheringham, Brunsdon & Charlton
Year
2002
Type
Local spatial regression

What does it do?

Geographically Weighted Regression (GWR) is a local regression method in which the regression coefficients are allowed to vary across space.

Rather than fitting one global equation, it estimates a separate set of coefficients at each location, so that spatial heterogeneity in the relationships can be examined. A full treatment is given in the 2002 Wiley monograph by Fotheringham, Brunsdon and Charlton, which is cited here.

The intuition behind the method

Imagine running a fresh regression at each point on the map, but giving nearby observations more say than distant ones. The result is a coefficient surface: the strength and even the sign of a predictor's effect can change from one place to another, revealing where a relationship is strong, weak, or reversed.

History

Geographically Weighted Regression is associated with Fotheringham, Brunsdon and Charlton. Their 2002 Wiley monograph, Geographically Weighted Regression: The Analysis of Spatially Varying Relationships, is the reference cited here.

When to use it

Choose GWR when observations carry geographic coordinates and there is reason to think that the effect of a predictor differs from place to place, that is, when the relationships are spatially non-stationary. It is designed for cross-sectional, geo-referenced data with a continuous outcome. Do not use it when coordinates are unavailable, because the distance-based weighting is then undefined; standard OLS regression is the fallback. Local estimates rest on the neighbourhood of observations around each location, so GWR is a poor choice for very small or sparsely located samples, where a global model is more stable. Spatial autocorrelation in the residuals should be checked both before and after fitting, since a local model does not automatically remove it.

Limitations and considerations

  • Requires geographic coordinates for every observation; without them the distance-based weighting cannot be defined.
  • Results are sensitive to the bandwidth, so the kernel type, the selection procedure and its outcome must be reported.
  • Local estimates draw on the observations within each kernel neighbourhood, so they become unstable where data are sparse.
  • The local model does not replace the usual regression assumptions or the check for spatial autocorrelation in the residuals.
  • Collinearity among predictors is a specific risk in GWR. Predictors that are strongly correlated within a neighbourhood can make local coefficients unstable and can produce implausible values. A sign reversal may reflect collinearity rather than a genuine change in the relationship. Check the correlation between predictors locally, and consider removing or combining redundant predictors before interpreting the coefficient surfaces.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Estimates a separate coefficient set at each location, so a predictor's effect can differ in size or sign across the study area.
  • Produces coefficient surfaces that can be mapped, showing where a relationship is strong, weak, or reversed.
  • Can reveal local relationships that a single global regression would average out.

Applications

  • Modelling house prices where the effect of features such as size or location varies across a city.
  • Mapping how environmental or socio-economic drivers of a health or demographic outcome differ across regions.
  • Exploring spatially varying relationships in geography, economics, and the environmental and social sciences.

How it works

How it works

1

At each location (uᵢ, vᵢ) the outcome y is modelled as a linear function of the predictors X, but the intercept and slopes βₖ(uᵢ, vᵢ) are functions of geographic position. This lets each place have its own local relationship rather than sharing one global coefficient. Selecting the optimal functional form of the model, and a version with heteroscedastic random errors, are extensions beyond this basic specification.

Formula
y_i = \beta_0(u_i, v_i) + \sum_{k} \beta_k(u_i, v_i)\, x_{ik} + \varepsilon_i
2

For each location, the coefficients are estimated by weighted least squares, β̂(uᵢ, vᵢ) = (XᵀW(uᵢ,vᵢ)X)⁻¹XᵀW(uᵢ,vᵢ)y. The diagonal weight matrix W(uᵢ,vᵢ) gives larger weights to observations near the target point through a distance-decay kernel. The kernel bandwidth controls how quickly that weight falls off with distance. A fixed kernel uses one distance bandwidth throughout the study area, whereas an adaptive kernel varies the bandwidth so that each neighbourhood contains a set number of observations, which suits unevenly spaced data. The bandwidth is commonly chosen by cross-validation or by minimising an information criterion such as AIC. The kernel type and the selection criterion used should be reported with the results.

Formula
\hat{\beta}(u_i, v_i) = (X^{\top} W(u_i, v_i) X)^{-1} X^{\top} W(u_i, v_i)\, y

Common pitfalls

  • Running GWR on data without coordinates; the model is then undefined and OLS regression should be used instead.
  • Fixing the bandwidth by hand rather than selecting it with a documented criterion such as cross-validation.
  • Reading local coefficients in sparsely observed regions as reliable; estimates there can change considerably with small changes in the data.
  • Treating each local coefficient as if it were tested on its own; many local estimates are produced, so their pattern needs careful interpretation before it is taken as evidence of spatial variation.

Frequently asked questions

How is GWR different from ordinary OLS regression?

OLS estimates one global set of coefficients assumed constant everywhere. GWR relaxes that, estimating coefficients that vary by location, so it can capture spatial heterogeneity that a single global model would miss.

What is the bandwidth and why does it matter?

The bandwidth controls how quickly the weight given to neighbouring observations decays with distance, which determines how local each regression is. A small bandwidth gives very local, more variable estimates; a large one moves towards the global model. It is commonly selected by cross-validation or by an information criterion such as AIC, and the criterion and kernel type used should be reported.

What data do I need for GWR?

You need geo-referenced, cross-sectional data with coordinates (latitude/longitude) for each observation, and a sample large enough that each local neighbourhood contains a reasonable number of observations. Without coordinates GWR cannot run.

What should I do if my data have no coordinates?

GWR is undefined without spatial coordinates. In that case use standard OLS regression, which estimates a single global relationship.

Related methods

Sources

  1. Fotheringham, A. S., Brunsdon, C., & Charlton, M. (2002). Geographically Weighted Regression: The Analysis of Spatially Varying Relationships. Wiley.

    ISBN: 978-0471496168
  2. Kopczewska, K. (2021). Applied Spatial Statistics and Econometrics Data Analysis in R, chapter 6, Geographically weighted regression – modelling spatial heterogeneity (P. Ćwiakowski), p. 289