Source-linked AI summary

GWmodel: an R Package for Exploring Spatial Heterogeneity using Geographically Weighted Models

Isabella Gollini, Binbin Lu, Martin Charlton, Christopher Brunsdon, Paul Harris

arXiv:1306.0413v2stat.AP

TL;DR

GWmodel addresses spatial heterogeneity when a universal model is inadequate but localized calibration may better describe regional patterns. It implements geographically weighted models and demonstrates their exploratory use across summary statistics, PCA, regression, collinearity handling, and prediction. The package’s locally compensated ridge regression applies location-specific ridge corrections only where local condition numbers exceed a user-specified threshold.

  • Problem

    Global models may describe spatial data poorly when the underlying process is heterogeneous or non-stationary, motivating localized analysis.

  • Method

    GWmodel uses distance-weighted moving-window calibration and provides basic and robust GW summary statistics, PCA, regression, prediction, and locally compensated ridge regression.

  • Results

    The package demonstrates GW analyses of spatial heterogeneity and introduces locally compensated ridge regression with varying ridge parameters applied only where local collinearity exceeds a threshold.

  • Takeaways & Limitations

    GWmodel offers a coherent exploratory framework for interrogating spatial heterogeneity, local collinearity, bandwidth choice, and related GW modelling decisions.

  • Takeaways & Limitations

    GW regression does not provide a coherent inferential framework, so hypothesis tests such as local pseudo t-values should be viewed only as exploratory.

Abstract

from arXiv · show

Spatial statistics is a growing discipline providing important analytical techniques in a wide range of disciplines in the natural and social sciences. In the R package GWmodel, we introduce techniques from a particular branch of spatial statistics, termed geographically weighted (GW) models. GW models suit situations when data are not described well by some global model, but where there are spatial regions where a suitably localised calibration provides a better description. The approach uses a moving window weighting technique, where localised models are found at target locations. Outputs are mapped to provide a useful exploratory tool into the nature of the data spatial heterogeneity. GWmodel includes: GW summary statistics, GW principal components analysis, GW regression, GW regression with a local ridge compensation, and GW regression for prediction; some of which are provided in basic and robust forms.

1. Introduction

GW models address spatial heterogeneity by calibrating localized models around target locations rather than assuming one universal model. GWmodel packages these exploratory techniques, including basic and robust methods across several GW analyses.

  • GW models use moving-window weighting to fit localized models at target locations when a global model poorly describes spatial data.Neighboring observations receive distance-decay weights controlled by a bandwidth.
  • The package emphasizes exploratory analysis by mapping model outputs to investigate spatial heterogeneity before subsequent statistical analysis.Mapped outputs can help direct later spatial or non-spatial analyses.
  • GWmodel includes GW summary statistics, GW PCA, GW regression, locally compensated ridge regression, and spatial prediction.Some methods are available in basic and robust forms.
  • The paper presents the package through example data, distance and kernel choices, summary statistics, PCA, regression, and methods for local collinearity.The structure also covers prediction and other extensions.

2. Data sets

GWmodel provides five example data sets spanning census, election, and house-price applications. The paper focuses on DubVoter and EWHP to demonstrate its GW models.

  • GWmodel includes five example data sets: Georgia, LondonHP, USelect, DubVoter, and EWHP.They cover US county census data, London and England-Wales house prices, and election-related data.
  • LondonHP contains 372 London house-price observations from 2001 combined with hedonic contextual variables.The variables reflect property characteristics and local household income conditions.
  • USelect contains 3,111 US counties with 2004 presidential-election results and five census variables.The election outcome has three classes: Bush winner, Kerry winner, and Borderline.
  • DubVoter contains 322 Greater Dublin Electoral Divisions with voter turnout and eight census-based social-structure percentage variables.Voter turnout is used as the dependent variable in the paper’s regression examples.
  • The DubVoter predictors measure migration, public housing, social class, unemployment, education, and three adult age groups.The variables include DiffAdd, LARent, SC1, LowEduc, Age18_24, Age25_44, and Age45_64, among others.
  • EWHP contains 519 England-and-Wales house-price observations from 1999 with structural, property-type, construction-period, and floor-area variables.The paper uses it for GW regression as a spatial predictor.

3. Distance matrix, kernel and bandwidth

GWmodel constructs local weighting matrices from distance metrics, kernel functions, and bandwidths. These choices determine how observations contribute to each local calibration.

  • Each GW calibration point has a geographical weighting matrix determined by distance type, kernel function, and bandwidth.The matrix differs across model calibration locations.
  • GWmodel supports Euclidean, Manhattan, other Minkowski, and great-circle distance metrics.Minkowski distance uses p = 2 for Euclidean distance and p = 1 for Manhattan distance.
  • The package provides six kernel functions, including a global-model kernel that assigns unit weight to every observation.The global model is therefore represented as a special GW case.
  • Gaussian and exponential kernels decrease weights continuously with distance, while box-car, bi-square, and tri-cube kernels assign zero weight beyond bandwidth b.Bi-square and tri-cube additionally decrease weights with distance before reaching b.
  • Bandwidth b controls local scale; fixed bandwidths suit regular samples, whereas adaptive bandwidths maintain sufficient and constant local information for irregular samples.Bandwidths may be user-specified or selected automatically through an objective function such as cross-validation.
  • For EWHP, distances can be calculated within a GW model function or precomputed with gw.dist to save computation when fitting multiple models.The example specifies Euclidean distance.

4. GW summary statistics

GW summary statistics provide localized measures of variability, distributional shape, and association, with robust alternatives for reducing outlier sensitivity. Dublin examples show how these maps reveal spatial variation and diagnose regression issues.

  • GW summary statistics: Basic GW summaries include local means, standard deviations, skew, and Pearson correlations, while robust alternatives include medians, inter-quartile ranges, quantile imbalance, and Spearman correlations.These statistics are calculated at each location using kernel-based weights.
  • GW summary statistics: GW summary statistics are a precursor to GW PCA and GW regression because they identify areas of high variability, relationship non-stationarity, and local collinearity.The diagnostics can motivate closer scrutiny or locally compensated modelling.
  • Robust GW summary statistics: GW quantile imbalance ranges from -1 to 1 and measures the position of the local median between the first and third quartiles.It is zero when the median bisects those quartiles.
  • Example calibration: The Dublin example uses box-car and bi-square kernels with adaptive bandwidth N = 48, approximately 15% of the data.Robust summary statistics use quantiles, whereas robust correlations use the corresponding robust procedure without that quantile option.
  • Example findings: Turnout appears highly variable in central and west Dublin, while turnout–LARent relationships are strongest in central and south-west Dublin.LARent–Unempl correlations are consistently strong and positive in south-west Dublin, where local collinearity is a concern.
  • Example interpretation: Because specification changes can alter perceptions of non-stationary effects, the paper recommends experimenting with model calibration, kernel functions, and bandwidth sizes.This reflects the primarily exploratory role of GW models.

5. GW principal components analysis

GW PCA extends principal components analysis by allowing local means, covariances, eigenvalues, eigenvectors, scores, and loadings to vary across geographic locations. In the Dublin example, basic and robust GW PCA reveal spatially varying dimensionality and variable influence, with robust results differing systematically from basic results.

  • GW PCA methodology: GW PCA models the mean vector and covariance matrix as functions of location, deriving local eigenvalues and eigenvectors from each local covariance matrix.For m variables, it produces m components, eigenvalues, score sets, and loading sets at each observed location.
  • Robust GW PCA: Robust GW PCA estimates each local covariance matrix with the minimum covariance determinant estimator to reduce anomalous observations’ influence.The default robustness parameter is h = 0.75n.
  • Example results: The first three components account for 73.6% of variation in basic PCA and 86.2% in robust PCA.These are whole-map statistics representing Dublin-wide averages, which may not reliably represent local social structure.
  • Bandwidth selection: GW PCA bandwidth selection uses leave-one-out cross-validation, but the number of retained components must currently be specified beforehand.A different optimal bandwidth results for each chosen number of components.
  • Example results: Local PTV varies geographically, with generally higher percentages in the south and lower percentages in the north.Robust PTV is consistently higher than basic PTV, while basic PTV shows greater variation.
  • Example results: The winning variable on the first local component varies geographically, and robust GW PCA shows less variation than basic GW PCA.LowEduc dominates northern and southwestern areas and LARent central Dublin in the basic fit, whereas Age45_64 dominates most areas in the robust fit.

6. GW regression

GW regression explores spatially varying relationships by estimating locally weighted coefficients, with bandwidths selected using prediction or fit criteria and robust variants addressing outliers. In the Dublin example, stepwise AICc selection supports retaining all eight variables, while the LowEduc coefficient varies substantially across space and remains broadly patterned after robust fitting.

  • GW regression methodology: GW regression estimates a separate local coefficient set at each location, giving nearer observations greater influence through geographic weights.The coefficients are estimated by weighted least squares using a kernel-defined weighting matrix.
  • Bandwidth selection: Optimal GW regression bandwidths can minimize leave-one-out cross-validation for prediction accuracy or corrected AIC for prediction accuracy balanced against model parsimony.Corrected AIC accounts for sample size and model complexity.
  • Robust GW regression: Robust GW regression either filters observations with externally studentised residuals exceeding |r_i| > 3 or iteratively down-weights observations with large residuals.The two approaches depend on selected residual cut-offs or down-weighting functions.
  • Model specification: A forward stepwise procedure permanently adds the variable from the best-fitting candidate model, defined by minimum AICc, until all variables are included.The procedure generates 36 GW regressions for the eight-variable Dublin specification.
  • Example results: AICc values continue to fall as variables are added, supporting retention of all eight independent variables for the user-specified bandwidth.The first permanently included variable is Unempl, the second is Age25_44, and the last is LowEduc.
  • Example results: The LowEduc coefficient ranges from -7.67 to 3.41 in the basic fit and from -7.74 to 2.57 in the robust fit, compared with -0.13 globally.The robust fit provides slightly weaker evidence of non-stationarity while preserving the broad spatial pattern.

7. GW regression and addressing local collinearity

GWmodel addresses local collinearity in geographically weighted regression by diagnosing spatially varying instability and applying ridge compensation only where needed. The Dublin example shows that local diagnostics can reveal stronger problems than global analysis and guide spatially targeted adjustment.

  • Motivation: Collinearity is especially problematic in GW regression because smaller local samples and spatially varying correlation can create local issues absent from the global model.Local correlations and local VIFs may also miss collinearity involving the intercept.
  • Method: The locally-compensated ridge model varies its ridge parameter across space and applies biased estimation only where the local condition number exceeds a chosen threshold.Locations below the threshold retain the usual unbiased estimator.
  • Diagnostics: 41.07 was the global BKW condition number, indicating global collinearity, while removing DiffAdd and Age25_44 reduced it to 18.69.The BKW condition number is based on the ratio of the largest to smallest singular values after scaling matrix columns.
  • Example: The Dublin data showed local condition numbers from 32.88 to 107.50, indicating substantial local collinearity despite only weak collinearity suggested by global VIFs.Unexpected coefficient sign changes and few significant global predictors also indicated collinearity.
  • Example: The locally compensated fit used bandwidth N = 157 instead of N = 109 for basic GW regression, producing greater smoothing and local condition numbers closer to the global value of 41.07.The mapped adjustments were greatest in central Dublin, while adjusted LARent coefficients generally reduced large basic-model magnitudes and increased smaller ones.

8. GW regression for spatial prediction

GW regression is presented as a spatial predictor that estimates local relationships and prediction uncertainty, with house-price prediction used as an example. In the EWHP case study, GW regression provides the best reported performance, while the house-price–floor-area relationship weakens in rural areas.

  • Prediction framework: GW regression predicts a dependent variable at location s using local parameter estimates and independent-variable values at s.Its prediction variance estimates uncertainty for a single observation, making it directly comparable with kriging prediction uncertainty.
  • EWHP case study: The EWHP demonstration predicts house price, PurPrice, from FlrArea, the retained hedonic variable with the strongest global correlation at ρ = 0.65.The data set contains 519 England-and-Wales house-price observations and nine independent variables, while the demonstration focuses on a subset.
  • Spatial heterogeneity: The GW correlation between house price and floor area tends to weaken in rural areas when mapped using an adaptive bi-square kernel with bandwidth N = 52.The map uses GW summary statistics for PurPrice and FlrArea.
  • Scope boundary: A more complete analysis would calibrate geostatistical or autocorrelation-based predictors for comparison.The paper specifically identifies this comparison as an omitted component of the house-price prediction analysis.
  • Performance assessment: GW regression provides the best set of reported prediction-accuracy and prediction-uncertainty results, with near-exact correspondence between the two global regression results.Prediction accuracy uses RMSPE and MAPE; uncertainty accuracy uses the mean and standard deviation of prediction z-scores.

9. Comparisons with spgwr, gwrr and McSpatial

The paper compares GWmodel with spgwr, gwrr, and McSpatial to identify overlapping and divergent functionality. The comparison is organized in tables covering weighting matrices, GW summary statistics, and several GW regression categories.

  • Package comparison: GWmodel is compared with spgwr, gwrr, and McSpatial to establish where their functions duplicate, strongly resemble, or diverge.The comparison is presented as a series of tables.
  • Comparison categories: The comparison covers weighting matrix specifications, GW summary-statistics functions, and basic GW regression functions.The cited passage introduces these table-based comparison categories.

10. Discussion

The discussion summarizes GWmodel’s coverage of spatial heterogeneity analysis while emphasizing that the package and GW modelling paradigm remain incomplete and evolving. It lists available extensions, omitted functions, and future directions.

  • Demonstrated capabilities: GWmodel demonstrates basic and robust GW summary statistics, GW PCA, and GW regression for investigating spatial heterogeneity.The package also provides extensions for local collinearity and spatial prediction.
  • Omissions and future work: The presentation does not fully describe all functions available in GWmodel, including mixed, heteroskedastic, and discriminant-analysis capabilities.The use of some omitted functions is deferred to elsewhere.
  • Available extensions: The package includes bandwidth-selection functions and functions identifying observations that contribute most to cross-validation scores.These tools cover ggwr.cv, gwr.cv, gwr.lcr.cv, gwpca.cv, and associated contribution functions.
  • Available extensions: GWmodel includes Monte Carlo tests for GW summary statistics, GW regression, and GW PCA to assess departures from global-model behavior attributable to random variation.The tests examine whether aspects of a GW model differ significantly from what could be found under the global model.
  • Available extensions: Additional functions cover generalised GW regression, GW PCA visualization, multivariate-data visualization, multiple-hypothesis adjustment, mixed and heteroskedastic regression, and GW discriminant analysis.These functions are listed among the package capabilities and extensions discussed in the section.
  • Omissions and future work: Future GWmodel iterations are expected to include functions for GW boxplots and GW variograms as the broader modelling paradigm continues to evolve.The discussion also notes emerging models and new uses for existing GW methods.
Loading 1306.0413v2…