Local Geographically Weighted Regression (GWR)

Statistics
Introduced by
Brunsdon, Fotheringham & Charlton
Year
1996
Type
Spatially varying coefficient regression
Family
GIS / spatial

What does it do?

Local Geographically Weighted Regression (GWR) fits a separate regression at each location in the study area, so that the coefficients can vary across space.

Observations near a location receive larger weights than distant ones, which lets the estimated relationships shift geographically instead of being forced into one global estimate. The method was introduced by Brunsdon, Fotheringham and Charlton (1996) to explore spatial nonstationarity.

The intuition behind the method

Imagine running an ordinary regression, but instead of fitting one equation for the whole map, fitting a slightly different equation centred on each location. Observations close to that location carry more weight than those far away, so the coefficients reflect the local data. The output is a surface of coefficients: the effect of income on house prices might be strong in one part of a city and weak in another. A single global model would average these differences away. The weighting scheme is loosely based on kernel regression.

History

Geographically Weighted Regression was introduced by Brunsdon, Fotheringham and Charlton in 1996 as a method for exploring spatial nonstationarity in regression relationships. The 1996 paper set out the weighting approach and its link to kernel regression, discussed the choice of spatial weighting function, and proposed Monte Carlo tests of whether a global model is adequate and of whether individual coefficients are stable over geographic space. The method was later treated at book length by Fotheringham, Brunsdon and Charlton in 2002. Its wide use in quantitative geography and regional science followed these publications.

When to use it

Use GWR when theory or exploratory analysis suggests that the effect of a predictor may differ across locations, for example when the link between employment and commuting time is expected to differ between urban and rural areas. It requires a continuous outcome, georeferenced observations, and enough data that each local weighted regression can be estimated. Do not use GWR when the relationships are plausibly stationary across space, because a global model is simpler and easier to interpret. Avoid it when the sample is small or when the bandwidth would leave too few effective observations at many locations, and when predictors are highly collinear, since collinearity can be more severe within local subsets. It is also not the right tool when only a single average effect is required.

Limitations and considerations

  • Each local fit uses only the observations weighted near the location, so collinearity among predictors can be worse within local subsets and can make local coefficients unstable where data are sparse.
  • A separate weighted least squares problem is solved at every calibration point, so computation grows with the number of locations and observations.
  • Results depend strongly on the bandwidth: a large bandwidth over-smooths and hides local variation, while a small one produces noisy coefficient surfaces.
  • Local t-values cannot be interpreted one by one, because many local tests are run at once and their significance must be adjusted for multiple comparisons.
  • The estimator is weighted least squares for a linear model, so binary or count outcomes require extensions beyond the standard form.

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

Strengths

  • Explicitly models spatial nonstationarity, showing how the estimated relationships change across the study area.
  • Produces coefficient maps that communicate geographic patterns to audiences without a statistical background.
  • Reveals regional differences that a single global regression would average out.
  • The adaptive bandwidth option accommodates uneven data density without the researcher fixing a distance by hand.
  • AICc gives one criterion that can be compared across candidate bandwidths and model specifications.

Applications

  • House price modelling: mapping how the value of an extra bedroom or of proximity to a park varies across a city.
  • Public health geography: identifying areas where socioeconomic deprivation is most strongly associated with disease rates.
  • Environmental science: examining whether land-use predictors of air quality differ between industrial and residential zones.
  • Educational research: testing whether school-level resources have spatially uneven effects on student achievement.
  • Urban planning: locating neighbourhoods where transport access is most strongly related to employment.
  • Criminology: mapping how demographic factors relate to crime rates differently across a metropolitan area.

How it works

How it works

1

At each location i with coordinates (u_i, v_i), GWR fits a regression in which every coefficient beta_k may take a different value. The model is y_i = beta_0(u_i,v_i) + sum_k beta_k(u_i,v_i) x_ik + epsilon_i, so the result is a map of coefficients rather than a single table.

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

A spatial kernel assigns a weight w_ij to each observation j when the model is estimated at location i. The Gaussian form w_ij = exp(-d_ij^2 / b^2) is shown here, where d_ij is the distance between i and j and b is the bandwidth. Nearby observations receive weights close to 1 and distant ones weights close to 0. The choice of weighting function is itself a modelling decision.

Formula
w_{ij} = \exp\!\left(-\tfrac{d_{ij}^2}{b^2}\right)
3

The local coefficients are obtained by weighted least squares: beta-hat(u_i, v_i) = (X^T W_i X)^{-1} X^T W_i y, where W_i is the diagonal matrix of kernel weights for location i. The same calculation is repeated at every calibration point, which produces the full set of local estimates.

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

The bandwidth b controls how quickly weights decay with distance and largely determines how smooth the coefficient surface is. An adaptive bandwidth, defined by a fixed number of nearest neighbours k, adjusts to uneven data density, whereas a fixed distance bandwidth b suits roughly even density. In practice the bandwidth is chosen by searching over candidate values and keeping the one that minimises a criterion, most commonly the corrected Akaike Information Criterion (AICc) or cross-validation prediction error. When an adaptive bandwidth is used, the same search is carried out over k.

5

Model fit is compared using the residual sum of squares, AICc and local R-squared values, which can be mapped. Monte Carlo tests address whether the variation in local coefficients exceeds what a global model would produce, and whether individual coefficients are stable over space. These tests are the basis for judging whether spatial nonstationarity is genuine rather than a product of sampling variation.

Common pitfalls

  • Reading local coefficients as causal effects without addressing confounding or omitted variables, which spatial variation in coefficients does not resolve.
  • Keeping a fixed distance bandwidth when observation density varies strongly across the study area; an adaptive bandwidth is usually the safer choice in that case.
  • Reporting local significant locations based on unadjusted t-values, which inflates the number of apparent findings.
  • Confusing GWR with global spatial regression models such as the spatial lag and spatial error models. GWR addresses heterogeneity in the coefficients, not spatial dependence in the outcome or the error term.
  • Applying GWR to small samples, where many local subsets contain too few observations for stable estimates.

Frequently asked questions

How does GWR differ from a global spatial regression model?

A global spatial lag or spatial error model adds spatial structure to a single set of coefficients to account for spatial dependence in the outcome or the error. GWR instead estimates a separate set of coefficients at each location to capture heterogeneity in the relationships themselves. The two approaches address different spatial problems.

What bandwidth should I choose?

Let the data guide the choice by minimising AICc or cross-validation prediction error over a set of candidate bandwidths. Use an adaptive bandwidth (a fixed number of nearest neighbours) when observation density is uneven, and a fixed distance bandwidth when density is roughly uniform.

Are local coefficient t-values reliable for hypothesis testing?

Not on their own. GWR fits a local model at every location, so applying a conventional significance threshold to each local t-value produces many false positives. The method's own remedy is Monte Carlo testing: the 1996 paper proposes Monte Carlo tests of whether the data are better described by a global model and of whether individual coefficients are stable over geographic space. Simple multiple-comparison corrections such as Bonferroni or the false discovery rate can serve as rough screens. Neighbouring local fits share most of their observations, so the local tests are strongly correlated; Bonferroni is then very conservative, and the nominal error rate of an FDR procedure is harder to interpret. Treat the results of such corrections as indicative only.

How many observations do I need?

No single minimum applies. The number of observations needed depends on the number of predictors and on how many observations carry substantial weight at each location under the chosen bandwidth. Before relying on local estimates, inspect the local statistics, such as the sum of weights at each location, and treat locations with few effective observations or unstable coefficients with caution. Small datasets carry the greatest risk.

What software runs GWR?

The GWmodel package in R and the mgwr Python library are commonly used open-source implementations. ArcGIS Spatial Statistics and GeoDa also provide GWR tools that do not require programming.

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. Brunsdon, C., Fotheringham, A. S., & Charlton, M. E. (1996). Geographically weighted regression: a method for exploring spatial nonstationarity. Geographical Analysis, 28(4), 281-298.

    Open DOI reference
  3. Applied Spatial Statistics and Econometrics Data Analysis in R by Katarzyna Kopczewska (2021), chapter 6, pp. 292, 298 and 304