Skip to main content

Chapter 12 Spatial Heterogeneity and Regression

One of the challenges of spatial data is that we may encounter exceptions to stationary processes. There may be, for example, parameter variability across the study area. When we have homogeneity, everything is the same everywhere; in terms of our regression equation, the parameters are constant. But as we illustrated via an interaction term in Chapter 11, that may not be the case. We can encounter situations where a particular input has a different effect in parts of our study area. In this chapter we explore this issue and a number of solutions that have been proposed to deal with it. It goes without saying that having extreme heterogeneity creates technical problems for estimation. If everything is different everywhere, we may have to estimate more parameters than we have data for.
One way of dealing with this is by imposing some form of structure, for example partitioning data for the United States to fit a separate model for Southern and Northern counties. Unlike data partition, full spatial regimes also imply using different coefficients for each subset of the data, but you fit everything in one go. This is essentially the same as running as many models as subsets you have. As [Anselin (2007)] highlights, this corrects for heterogeneity but does not explain it. We can then test whether this was necessary, using a Chow test comparing the simpler model with the one where we allow variability. Of course, we can also include spatial dependence in these models.
Another way of dealing with heterogeneity is by allowing continuous variation, rather than discrete (as when we subset the data), of the parameters. A popular method for doing this is geographically weighted regression (GWR). This is a case of a local regression where you try to estimate a different set of parameters for each location and these parameters are obtained from a subset of observation using kernel regression. In traditional local regression we select the subset in the attribute space (observations with similar attributes); in GWR the local subset is defined in a geographical sense using a kernel (remember how we used kernels for density estimation to define a set of "neighbours"). We are estimating regression equations based on nearby locations as specified by our kernel, and this produces a different coefficient for each location. As with kernel density estimation, you can distinguish between fixed bandwidth and adaptive bandwidth.
For this chapter we will need to load the following packages:
library(tidyr)
library(dplyr)
# Packages for handling spatial data and for geospatial carpentry
library(sf)
library(sp)
library(spdep)
# Packages for regression and spatial regression
library(spatialreg)
# Packages for mapping and visualisation
library(tmap)
library(ggplot2)
# Packages with spatial datasets
library(geodaData)
# For geographicaly weighted regression
library(spgwr)