Introduction to Geographically Weighted Models
Geographically Weighted Regression (GWR) is a spatial analysis technique that allows relationships between variables to vary across space. Unlike traditional regression models that estimate a single set of coefficients for the entire study area, GWR computes local regression equations for each location in space.
Key Concept: GWR recognizes that spatial processes might not be stationary and allows the relationships between dependent and independent variables to vary across space.
When to Use GWR
- When you suspect relationships between variables vary across space
- When you want to explore spatial heterogeneity in your data
- When you need to account for local variations in your model
- When traditional regression shows spatial autocorrelation in residuals
R Packages for GWR
Several R packages are available for implementing geographically weighted models. Here are the most commonly used ones:
spgwr
The standard package for basic GWR modeling. Provides functions for bandwidth selection, model fitting, and diagnostics.
GWmodel
More advanced package that includes various geographically weighted models beyond regression (PCA, discriminant analysis, etc.).
mgwr
Implements multiscale geographically weighted regression (MGWR) where different bandwidths can be used for different variables.
sf
For handling spatial data (modern replacement for sp package). Often used in conjunction with GWR packages.
Example Code
Basic GWR Example using spgwr
Advanced GWR Example using GWmodel
Multiscale GWR Example using mgwr
Additional Resources
Books
-
Geographically Weighted Regression
by A. Stewart Fotheringham, Chris Brunsdon, Martin Charlton
-
Spatial Regression Models
by Michael Ward and Kristian Gleditsch
Online Resources
-
GWR with R Spatial
Comprehensive guide to GWR implementation in R
-
GWmodel Journal Article
Detailed documentation of the GWmodel package
Videos
-
GWR Tutorial
Step-by-step guide to GWR in R
-
Advanced Spatial Analysis
Includes MGWR and other advanced techniques
Datasets
-
US Census Data
Good for practicing GWR with socioeconomic data
-
Spatial Analysis Lab
Collection of spatial datasets for practice