Source-linked AI summary
The GWmodel R package: Further Topics for Exploring Spatial Heterogeneity using Geographically Weighted Models
Binbin Lu, Paul Harris, Martin Charlton, Chris Brunsdon
TL;DR
The paper addresses spatial heterogeneity when global models describe spatial data poorly by presenting local geographically weighted models in the GWmodel R package. It demonstrates moving-window weighting across GW exploratory, regression, testing, discriminant-analysis, and bandwidth-selection methods, with Irish and US election data. The study extends a companion treatment of basic and robust GW models while noting limitations associated with multiple testing and local collinearity.
Problem
Global stationary models may poorly describe spatial data when localised fits provide better descriptions in some regions.
Method
The study presents GWmodel functions that estimate local models with moving-window weighting and demonstrate GW PCA, advanced regression, non-stationarity tests, GW DA, and bandwidth selection.
Results
The study demonstrates these GW methods using General Election data from the Republic of Ireland and the US.
Takeaways & Limitations
GWmodel provides a collection of local models and tools for exploring spatial heterogeneity through mapped local parameters and outputs.
Takeaways & Limitations
GW regression analyses can face high-order multiple-inference problems and local collinearity concerns.
Abstract
from arXiv · showhide
In this study, we present a collection of local models, termed geographically weighted (GW) models, that can be found within the GWmodel R package. A GW model suits situations when spatial data are poorly described by the global form, and for some regions the localised fit provides a better description. The approach uses a moving window weighting technique, where a collection of local models are estimated at target locations. Commonly, model parameters or outputs are mapped so that the nature of spatial heterogeneity can be explored and assessed. In particular, we present case studies using: (i) GW summary statistics and a GW principal components analysis; (ii) advanced GW regression fits and diagnostics; (iii) associated Monte Carlo significance tests for non-stationarity; (iv) a GW discriminant analysis; and (v) enhanced kernel bandwidth selection procedures. General Election data sets from the Republic of Ireland and US are used for demonstration. This study is designed to complement a companion GWmodel study, which focuses on basic and robust GW models.
1. Introduction
The study presents local geographically weighted models in GWmodel for exploring spatial heterogeneity when global models describe spatial data poorly. It demonstrates GW exploratory methods, regression extensions, significance testing, discriminant analysis, and bandwidth selection using Irish and US election data.
- Motivation: GW models provide localised fits for regions where spatial data are poorly described by a global stationary model.They use moving-window weighting to estimate local models at target locations.
- Motivation: Mapped GW parameters and outputs support exploratory assessment of spatial heterogeneity and can direct further statistical analysis.The paper frames GW modelling as an exploratory tool rather than only a final modelling procedure.
- Contributions: GWmodel provides GW PCA, advanced GW regression fits and diagnostics, Monte Carlo tests for non-stationarity, GW discriminant analysis, and enhanced bandwidth selection.The study uses all of these functions in its demonstrations.
- Relation to companion work: The paper complements a companion GWmodel study focused on basic and robust GW models.The companion work also addressed collinearity in GW regression.
- Study design: The study demonstrates its methods with General Election data from the Republic of Ireland and the US.The Irish and US data sets provide the main empirical settings for the paper's case studies.
- Reproducibility: Reproducible R commands are provided for the analyses presented throughout the study.The commands accompany the paper's demonstrations.
2. Context, the weighting matrix and the study data sets
GW methods adapt global statistics and models to local spatial contexts through distance-based weighting. The section explains how kernels and bandwidths control local influence, and introduces the Irish and US election data used in the demonstrations.
- GW framework: GW methods investigate spatial heterogeneity by fitting locally adapted versions of global statistics or models.Examples include local variability, relationships, and spatial dependence.
- GW framework: A moving window calibrates each local model at a location using neighbouring observations weighted by a distance-decay kernel.Each calibration location receives its own weighted data subset and local model.
- Bandwidth: Small bandwidths produce more rapidly varying results, whereas large bandwidths make local results increasingly close to the global solution.Bandwidth therefore controls the spatial scale of the fitted model.
- Weighting matrix: The weighting matrix is determined by the distance metric, kernel function, and kernel bandwidth.GWmodel permits Minkowski distances, including Euclidean distance when p = 2.
- Kernel functions: Box-car and bi-square kernels may use fixed or adaptive distances, while Gaussian and exponential kernels are continuous and use all data with distance-decaying weights.Box-car and bi-square weighting can suffer discontinuity, although an all-data bi-square bandwidth can reduce this problem.
- Bandwidth selection: Bandwidths may be user-specified, selected automatically using cross-validation or related approaches, or guided by automated selection.GWmodel provides automated bandwidths for several GW methods, including regression, GW DA, and GW PCA.
3. Exploration with GW summary statistics and GW PCA
This section presents GW summary statistics and GW PCA as exploratory tools for revealing spatial heterogeneity before or alongside subsequent GW analyses. Applications to Greater Dublin show locally varying correlations, component structure, and dimensionality, with Monte Carlo tests assessing whether observed spatial variation differs from chance.
- GW summary statistics: GW summary statistics provide locally weighted means, standard deviations, and correlations that can identify spatial variability and guide subsequent GW PCA or regression analyses.The statistics use kernel-based geographic weights for attributes evaluated at each location.
- GW PCA: GW PCA computes localized component variances, loadings, and scores, which are mapped to identify spatial changes in multivariate data structure.The method assesses how effective dimensionality varies spatially and how original variables influence each local component.
- GW correlations: The turnout–LARent relationship is non-stationary, strongest in central and south-west Dublin, while many northern relationships are unusually weak.Turnout tends to be low where local-authority renting tends to be high in the strongest areas.
- GW correlations: LARent and unemployment show consistently strong positive correlations in three distinct areas of Greater Dublin.The correlations assess local collinearity between two independent variables in a subsequent GW regression.
- GW PCA: 61.6% of the variation is accounted for by the first two global components, mainly representing older and affluent residents, respectively.The local PTV map varies spatially, with higher percentages in southern and central Dublin and lower percentages in the north; local PTV is generally higher than the global 61.6%.
4. Mixed model building for GW regression
Mixed GW regression combines globally fixed and locally varying relationships, allowing different coefficients to be treated as stationary or non-stationary. The Dublin example uses Monte Carlo testing to select global terms before fitting the mixed model.
- GWmodel includes basic, robust, generalised, mixed, heteroskedastic, and locally compensated ridge GW regression functions.
- Mixed GW regression: Mixed GW regression treats some coefficients as global and the remainder as local, while assuming the local coefficients vary at the same spatial rate.
- Model selection: An alternative stepwise procedure tests global and locally varying combinations and selects the model with minimum AIC, but it is computationally expensive.
- Testing non-stationarity: Monte Carlo testing compares observed coefficient variability with randomized results to assess whether each relationship is spatially non-stationary.
- Dublin example: In the Dublin example, the Intercept, DiffAdd, LARent, LowEduc, Age25_44, and Age45_64 variables were fixed globally at the 95% level.
- Dublin example: The mixed model produced less variable geographically varying coefficients than the basic model, with the clearest Unempl coefficient-surface differences in north-western and south-western Dublin.
5. Further GW regression topics
The section extends GW regression with multiple-hypothesis testing, local collinearity diagnostics, and heteroskedastic fits. These tools address simultaneous testing and spatially varying collinearity while comparing adjusted significance surfaces and model coefficients.
- Multiple hypothesis tests: GW regression supports multiple-hypothesis adjustments using Benjamini-Hochberg, Benjamini-Yekutieli, Bonferroni, and Fotheringham-Byrne approaches.The first three are standard approaches, whereas Fotheringham-Byrne is specifically designed for GW regression.
- Multiple hypothesis tests: GW regression requires many simultaneous t-tests because each location has a separately weighted local model, increasing multiple-inference concerns.The resulting issue is a heightened likelihood of increased type I errors.
- Multiple hypothesis tests: The Fotheringham-Byrne adjustment produces p-values from zero to one, unlike standard adjustments that reduce values to zero or one.The mapped results show unadjusted values similar to Benjamini-Hochberg and Benjamini-Yekutieli, while Bonferroni and Fotheringham-Byrne produce similar results.
- Heteroskedastic fits: The heteroskedastic GW model produces little difference from the basic model’s Unempl coefficient surface, making a stationary error variance appear reasonable.The section also demonstrates fitting a heteroskedastic covariance matrix.
6. GW Discriminant Analysis
GW discriminant analysis extends discriminant analysis to settings where relationships between categorical outcomes and predictors vary across space. It localises the discrimination rule to provide a spatially varying investigative tool.
- GW discriminant analysis: GW discriminant analysis models and predicts a categorical dependent variable when relationships with independent variables vary across space.The method provides a useful investigative tool by localising the discrimination rule.
- GW discriminant analysis: GW discriminant analysis provides a local alternative to global discriminant analysis, analogous to the relationship between GW regression and regression.The paper notes that discriminant analysis and GW discriminant analysis offer alternatives to logistic regression and GW logistic regression.
6.1. GW discriminant analysis
GW discriminant analysis replaces stationary discriminant-analysis estimates with geographically weighted means and covariances. Local LDA or QDA models can therefore be obtained at any location, with bandwidth selected by cross-validation.
- Discriminant analysis: Discriminant analysis assigns an observation to the category with the maximum posterior probability among k possible categories.The formulation uses training observations labelled by category and category-specific probability functions.
- LDA and QDA: LDA assumes an identical covariance matrix across categories, whereas QDA allows a different covariance matrix for each category.Both approaches assume multivariate normal distributions for the categories.
- GW discriminant analysis: GW DA replaces stationary means and covariance estimates with geographically weighted estimates in both LDA and QDA discrimination rules.This produces a local LDA or QDA model at any location (u, v).
- Bandwidth selection: Bandwidth selection uses cross-validation by identifying the bandwidth that minimises the proportion of incorrect assignments when an observation is removed.The leave-one-out error proportion is denoted P≠i.
6.2. Example: GW discriminant analysis
Using US election data, the example compares global DA with GW DA classifications against the observed county-level election results. GW DA provides a small accuracy improvement and a spatial pattern marginally closer to the true classifications.
- Spatial classification patterns: The global model predicts only one county in the ‘Borderline’ category, while the election was more competitive in areas such as Wisconsin and Maine.The actual presidential election results are mapped at county level, with Bush winning most counties.
- Classification results: GW DA classifications appear marginally closer to the true election results than classifications from standard DA.The comparison is shown by mapping the actual results, DA classifications, and GW DA classifications.
R > lda.SDF <- SpatialPolygonsDataFrame(Sr = polygons(USelect2004),
The code prepares classification outputs for the 2004 US election, including predicted classes and confusion-matrix-related calculations.
- The workflow calls confusion.matrix on observed winners and lda.pred$class.
- It references lda.pred$class and gwda.ab$SDF$group.predicted in calculations normalized by nrow(USelect2004@data).
- The classification labels are Borderline, Bush, and Kerry.
R > spplot(USelect2004, "winner", key.space = "right",
The figure presents the 2004 US presidential election results alongside classification maps from DA and GW DA, with correct classifications overlaid for both models.
- The election-results map is titled “Results of the 2004 US presidential election.”
- Figure 7 displays the 2004 US presidential election results and classification results using DA and GW DA.
- The DA map labels classification results and overlays the correct classifications.
- The GW DA map labels classification results and overlays the correct classifications.
7. Enhanced kernel bandwidth selection
The enhanced bandwidth-selection procedures inspect complete cross-validation functions rather than relying only on an automatically selected bandwidth. A GW PCA example selects N = 131, where the CV function has a clear minimum, while identifying a strongly skewed score distribution and a potentially erroneous extreme observation.
- Bandwidth-selection tools: GWmodel provides CV bandwidth functions and location-specific CV score-data functions for several GW models, although GW DA contribution support was still to be coded.
- Bandwidth-selection tools: GWmodel includes automatic bandwidth-selection functions for generalized GW regression, GW DA, GW PCA, basic GW regression, and locally compensated ridge GW regression.
- Bandwidth-function assessment: The authors recommend checking the full bandwidth function before using an optimal bandwidth in a GW model.
- Bandwidth-function assessment: The procedures investigate multiple minima and assess whether outlying observations adversely affect bandwidth-function behavior.
- GW PCA example: In the GW PCA example, the CV bandwidth function reaches a clear minimum at N = 131.
8. Concluding remarks
The study and its companion demonstrate GWmodel techniques for investigating spatial heterogeneity. The GW paradigm supports examining how model parameters and outputs vary across space.
- The study and its companion demonstrate a wide range of spatial-heterogeneity investigation techniques using the GWmodel R package.
- The covered topics include GW summary statistics, GW principal component analysis, GW regression, and GW Discriminant Analysis.
- GW modelling provides a toolkit for exploring changes in statistical-model parameters and outputs across space.