Chapter 11 Spatial Regression Models
In science one of our main concerns is to develop models of the world, models that help us to understand the world a bit better or to predict how things will develop better. Crime analysis also is interested in understanding the processes that may drive crime. This is a key element in the SARA process (analysis) that forms part of the problem oriented policing approach [186]. Statistics provides a set of tools that help researchers build and test scientific models, and to develop predictions. Our models can be simple. We can think that unemployment is a factor that may help us to understand why cities differ in their level of violent crime. We could express such a model like this:

Surely we know the world is complex and likely there are other things that may help us to understand why some cities have more crime than others. So, we may want to have tools that allow us to examine such models. Like, for example, the one below:

In this chapter we cover regression analysis for spatial data, a key tool for testing models. Regression is a flexible technique that allows you to "explain" or "predict" a given outcome, variously called your outcome, response or dependent variable, as a function of a number of what is variously called inputs, features or independent, explanatory, or predictive variables. We assume that you have covered regression analysis in previous training. If that is not the case or you want a quick refresher, we suggest you consult Appendix B: Regression Analysis (A Refresher) in the website for this book. Our focus in this chapter will be on a series of regression models that are appropriate when your data has a spatial structure.
There is a large and developing field, spatial econometrics, dedicated to developing this kind of models. Traditionally, these models were fit using maximum likelihood, whereas in the last few years we have seen the development of new approaches. There has also been some parallel developments in different disciplines, some of which have emphasised simultaneous autoregressive models and others (such as disease mapping) that have emphasised conditional autoregressive models. If these terms are not clear, do not worry; we will come back to them later on. This is a practical R focused introductory text and, therefore, we cannot cover all the nuisance associated with some of these differences and the richness of spatial econometrics. Here we will just simply introduce some of the key concepts and more basic models for cross-sectional spatial data, illustrate them through a practical example, and later on provide guidance to more in-depth literature.
We need to load the libraries we will use in this chapter. Although there are various packages that can be used to fit spatial regression models, particularly if you are willing to embrace a Bayesian approach, our focus in this chapter will be on
spatialreg. This package contains the estimation functions for spatial cross-sectional models that before were shipped as part of spdep, sphet, and spse. There are various ways of thinking about spatial regression, here we will focus on those that rely on frequentist methods and a spatial weight matrix (to articulate the spatial nature of the data).
# Packages for handling spatial data and for geospatial carpentry
library(sf)
library(sp)
library(spdep)
# Packages for regression and spatial regression
library(arm)
library(effects)
library(spatialreg)
# Packages for mapping and visualisation
library(tmap)
library(ggplot2)
# Packages with spatial datasets
library(geodaData)
Here we will return to the "ncovr" data we have used in previous chapters. This dataset was produced as part of the National Consortium on Violence Research (NCOVR) agenda, a National Science Foundation initiative that was led by Al Blumstein. A piece of work that resulted from this initiative was the paper led by Robert Baller in Criminology, for which this data was compiled [187]. This paper, co-authored by Luc Anselin who is one of the key figures in the field of spatial econometrics, runs and describes spatial regression models of the kind we cover in this chapter with this dataset. It would be helpful, thus, to read that piece in parallel to this chapter.
data("ncovr")
