Statistics Glossary → GWR (Geographically Weighted Regression)
GWR (Geographically Weighted Regression)analysis
Geographically weighted regression: instead of assuming a relationship is the same across the whole area, it fits local regressions at each location that give more weight to nearby observations, showing how the coefficients change from place to place.
Concept
Ordinary (global) regression summarises the effect of a predictor with a single coefficient for the whole study area. Yet many relationships vary in space: the effect of income on educational attainment may be one thing in large cities and another in rural regions. Geographically weighted regression (GWR) estimates a separate set of coefficients at each location to answer 'is this relationship the same everywhere?'.
At each location, a weighted least squares regression is fitted that gives high weight to nearby observations and low weight to distant ones: y_i = β₀(u_i, v_i) + Σ β_k(u_i, v_i)·x_ik + e_i. The kernel function sets how the weights decline with distance, and the bandwidth sets how far they reach. The bandwidth is usually chosen from the data with a criterion such as AICc; a small bandwidth gives very local and jumpy results, a large one results close to the global regression. Multiscale GWR (MGWR) gives each predictor its own bandwidth.
The result is a map of coefficients and should be read as exploratory: since a separate test is run at each location, the significance of local coefficients needs a multiple-testing correction, and strong local multicollinearity among the predictors can make the coefficients unstable. Whether GWR is truly better than the global model should be tested with the AICc difference or F tests, and whether the coefficients really vary with permutation tests.
When to use it
- When the effect of a predictor is thought to change from region to region and this variation is to be mapped (house prices, health indicators, educational attainment, crop yield).
- If the predictors may act at different scales (one local, one regional), use MGWR; if the relationship is the same everywhere but the outcome or error is dependent between neighbours, use SAR or the spatial error model.
- If the outcome is binary or a count, generalised versions such as geographically weighted logistic or Poisson regression are needed.
An everyday example
A researcher explains university entrance exam success in Turkey's 81 provinces by household income and pupils per teacher. Global regression gives one coefficient for the effect of income. GWR estimates a separate coefficient for each province and might produce a map showing, for instance, that income matters weakly in western provinces and strongly in eastern ones. This finding hints at where support programmes might be most effective.
Parameters in MerQur
Dependent variable, Predictors (X), Latitude, Longitude
Concept: The dependent and explanatory variables are as in ordinary regression; the coordinates give each observation's location, and the weights of the local regressions are computed from distances between these locations.
Everyday example: In the province example the dependent variable is exam success and the predictors are household income and pupils per teacher; each province's centre coordinates determine who is close to whom.
What it does: The variables of the model and the point coordinates.
Effect on the result: All local estimates change.
On the validation data: Georgia: PctBach ~ PctRural + PctPov + PctBlack (n = 159); also Columbus (n = 49) and Boston (n = 506).
Bandwidth type (Adaptive k neighbours / Fixed constant radius)
Concept: A fixed bandwidth uses the same radius everywhere; an adaptive bandwidth widens or narrows at each location to include a set number of nearest neighbours. If the density of observations varies a lot from place to place, the adaptive bandwidth gives more balanced results.
Everyday example: A fixed 200 km radius covers many of the small, densely packed western provinces but only a few of the large eastern ones. An adaptive bandwidth removes this imbalance by giving each province's local regression, say, its 30 nearest provinces.
What it does: In the adaptive bandwidth, the distance to the k-th nearest neighbour at each point becomes the bandwidth (adapts to data density); in the fixed bandwidth the same radius is used everywhere.
Effect on the result: Local coefficients, the effective number of parameters (ENP) and the model fit measures change.
On the validation data: Bisquare, AICc: adaptive k = 93 (AICc 896.350, ENP 14.36); fixed 211020.8 m (AICc 894.973, ENP 16.51).
Kernel (Bisquare / Gaussian / Exponential / Tricube / Boxcar)
Concept: The kernel function sets how an observation's weight declines with distance. Kernels such as bisquare give zero weight to observations outside the bandwidth; the Gaussian kernel reduces the weight smoothly and never excludes any observation completely.
Everyday example: With a bisquare kernel, provinces near Ankara enter its local regression strongly, those near the edge of the bandwidth weakly, and those beyond it not at all. With a Gaussian kernel, even distant provinces enter with a very small weight.
What it does: The weight function: bisquare (1-(d/b)²)², gaussian exp(-(d/b)²/2), exponential exp(-d/b), tricube (1-(d/b)³)³, boxcar 1 (d < b).
Effect on the result: The bandwidth and all local estimates change.
On the validation data: Adaptive, AICc: bisquare k = 93, gaussian 23, exponential 19, tricube 92, boxcar 46; AICc 896.35; 890.74; 886.14; 897.34; 891.27, respectively. In boxcar MerQur includes the k-th neighbour (46); GWmodel and the hand calculation give 47.
→ Kernel (weighting) function (Gaussian, bisquare, Epanechnikov)
Bandwidth criterion (AICc / AIC / BIC / CV (cross-validation))
Concept: The bandwidth is chosen by a criterion that balances fit against complexity. AICc is an information criterion corrected against overfitting in small samples; cross-validation (CV) judges how well each observation is predicted when it is itself left out.
Everyday example: If the bandwidth is too small, each province's regression rests on only a few neighbours and the coefficient map turns into a noisy patchwork. AICc chooses a bandwidth that adds detail to the map only when prediction genuinely improves.
What it does: The criterion that selects the bandwidth. For all criteria and bandwidth types, a coarse grid and then a refined search are performed (integer in adaptive); the fixed-bandwidth search space lies between the smallest distance at which at least k+1 observations remain in every local regression and 2 times the largest distance.
Effect on the result: The selected bandwidth and therefore the whole result change.
On the validation data: In adaptive bisquare, AIC and BIC select bandwidth 6 (ENP 150.6 and 159; "at the range boundary" and "ENP ≥ n/2" warnings), CV 147. Gaussian AIC 6 (ENP 47.9; warning "AIC can go to minus infinity at a small bandwidth"), BIC and CV 62.
Manual bandwidth
Concept: The bandwidth can also be given by the researcher instead of being chosen from the data. This is useful when there is a theoretical expectation about scale, or when testing how sensitive the results are to the bandwidth.
Everyday example: If education policies are thought to differ at the scale of regional directorates (about 10 provinces), the bandwidth can be set to 10 neighbours. Comparing results with 10, 20 and 40 neighbours shows how much the patterns on the map depend on the bandwidth.
What it does: If 0 is entered, the bandwidth is selected automatically; in adaptive the value is rounded to an integer (49 instead of 49.46 and the note "rounded to 49 neighbours"), in fixed it is a distance.
Effect on the result: The bandwidth is determined independently of the criterion; with a manual bandwidth the criterion has no effect.
On the validation data: 90 (RSS 2090.1253, AICc 896.4628, tr(S) 14.9251), 209267.689, 87308.298, 49.46: all summary values and the observation-level β, SE, t and local R² are reported. The 3 values below k+1 raise an error ("between 5 and 159").
Model (GWR single bandwidth / MGWR covariate-specific bandwidths)
Concept: Classical GWR uses one bandwidth for all predictors; multiscale GWR (MGWR) chooses a bandwidth for each predictor. This makes it possible to tell that some relationships are very local and others nearly global.
Everyday example: The effect of income may vary by region while the effect of pupils per teacher is the same across the country. MGWR shows this by choosing a small bandwidth for income and a large one, covering all provinces, for the teacher ratio.
What it does: MGWR (Fotheringham, Yang and Kang 2017) selects a separate bandwidth for each variable (by back-fitting).
Effect on the result: The bandwidths, local coefficients and AICc change; in MGWR the local SE is given with the MGWR definition of Fotheringham et al. (2017) (a note is written). The Monte Carlo box is disabled in MGWR.
On the validation data: With raw variables the bandwidths are 57 / 142 / 157 / 157 (AICc 899.28). In the z-scored example 101 / 101 / 117 / 157 (AICc 297.070).
Distance (Automatic / Geographic great circle / Projected Euclidean)
Concept: Distance is computed as flat-map (Euclidean) distance for projected coordinates and as great-circle distance, which accounts for the Earth's curvature, for latitude-longitude degrees.
Everyday example: If the coordinates of the 81 provinces are in degrees, great-circle distance should be used; treating degrees as flat coordinates overstates east-west distances relative to north-south ones.
What it does: In automatic selection, if the coordinates are in the degree range (|latitude| ≤ 90, |longitude| ≤ 180) and the column name is geographic, great-circle (sphere, Earth radius 6371 km) distance is used, otherwise Euclidean. When the geographic option is forced, a range check is made.
Effect on the result: The distances, therefore the bandwidth and all estimates change.
On the validation data: Georgia X/Y (metres, Euclidean; the model in the interpretation): bandwidth 93, AICc 896.350. The 'Latitude/Longitud' columns are automatically treated as geographic, and great-circle distance gives bandwidth 92 (AICc 896.361). If the same degree values are forced to projected Euclidean and used as if planar, no transformation is made, the longitude scale is distorted and bandwidth 104 (AICc 895.336) results; this use is not recommended. Columbus X/Y is projected (bandwidth 24). If the UTM metre values are forced 'geographic', an explicit error is raised.
→ Distance measure (Euclidean, Manhattan, Gower, great-circle)
Monte Carlo test of local coefficient variability (slow) and Number of permutations
Concept: Local coefficients vary somewhat by chance alone. The permutation test shuffles the coordinates at random and refits GWR to answer 'how much would the coefficients vary if there were no spatial pattern?'; if p is small, the coefficient is concluded to genuinely vary in space.
Everyday example: If, when the provinces' locations are shuffled at random, the spread of the income coefficient across provinces exceeds that in the real data in only 2% of 199 shuffles, the finding that the income effect varies by region is reliable.
What it does: The coordinates are permuted and the SD of the local coefficients is recomputed; p is the proportion of permutations in which the SD exceeds the observed one. The user's criterion and search space (the bandwidth itself in manual bandwidth) are used in the permutations.
Effect on the result: Only adds p values.
On the validation data: Bisquare 93, p at 199 permutations (intercept, PctRural, PctPov, PctBlack) = (.020, .151, .563, .201).
Example on real data
Data: Fotheringham et al. 2002 Georgia county data, R GWmodel
Variables: dependent PctBach (share with a bachelor degree), predictors PctRural, PctPov, PctBlack, coordinates Y and X (159 counties, metres)
- Question: In the 159 counties of Georgia, does the relationship of the share with a bachelor degree (PctBach) with rurality, poverty and the share of the Black population change from place to place? GWR fits a local regression weighted by the neighbours in each county.
- Bandwidth selection: With the adaptive bisquare kernel, the bandwidth with the smallest AICc is 93 neighbours; each local model uses about 58% of the counties.
- Result / model fit: GWR R² = 0.589 (adjusted 0.533), AICc = 896.35; compared with global OLS (R² = 0.485, AICc = 908.32), ΔAICc = 11.97 > 3, so GWR is preferred. Leung F2 = 2.10, p = .004 also shows that GWR gives a significant improvement.
- Local coefficients: Rurality is negative and significant in every county (median -0.104, range -0.188 to -0.071). The effect of poverty ranges from -0.519 to -0.077 and is significant in 39% of the counties with the multiple-testing corrected criterion. The coefficient of the Black population share changes sign (-0.069 to 0.131) and is significant in only 3.1%.
- Stationarity test: By Leung F3, the intercept (p < .001) and rurality (p < .001) coefficients are not spatially stationary; for poverty (p = .41) there is no evidence of variation by place.
- Diagnostics: Local VIF is at most 3.89 and the condition number at most 17.55 (threshold 30); the local coefficients are not affected by multicollinearity. The GWR residuals show no spatial autocorrelation (Moran I = -0.0035, p = .940).
- APA: GWR (adaptive bisquare, bandwidth = 93 by AICc, N = 159): R² = .59, adjusted R² = .53, AICc = 896.35 (OLS 908.32); Leung F2 = 2.10, p = .004.
Related concepts
Monte Carlo p-valueBandwidth (kernel smoothing)Kernel (weighting) function (Gaussian, bisquare, Epanechnikov)Distance measure (Euclidean, Manhattan, Gower, great-circle)Information criteria (AIC, AICc, BIC)Weighted least squares (WLS)CovariateOrdinary least squares (OLS)
The numbers in the examples are MerQur's output on independent, publicly available validation data; see the MerQur Technical Note for details.