Spatial Regression

A Practical Introduction

Author

Benjamin Reese, Parushya, Sarah Hayes

Published

December 12, 2022

“Everything is related to everything else, but near things are more related than distant things.”

Preface

The central principles of this project highlight the contrasts between spatial regression models and OLS models; showcase the strategies to detect and handle spatial autocorrelation; and discuss applications of spatial regression. This short treatment on spatial regression will show how to create visualizations of spatial data, estimate spatial relationships, and make predictions and inferences based on the results of your spatial models. Further, we will discuss how to avoid incorrect standard errors due to spatial autocorrelation and increase confidence in statistical inference.

In the first chapter, we summarize the basic concepts and methodology of geospatial analysis, map a variable of interest, and introduce the basic concept of spatial autocorrelation. In the second chapter, we discuss spatial autocorrelation in detail. We present formal statistical tests, and how to conduct them in R, for autocorrelation. We cover both global autocorrelation with Moran’s \(I\) statistic and local autocorrelation with Local Moran’s \(I\) or Local Indicators of Spatial Association (LISA). We also introduce spatial modeling and show how it violates the Gauss-Markov assumptions of ordinary least squares. In chapter three, we discuss the two dominant methods used to purge autocorrelation from statistical models: the spatial lag model and the spatial error model. We also cover some more advanced spatial modeling techniques. In chapter four, we return to our applied example and work through a full spatial analysis of the relationship between the rate of college education and the poverty rate in census tracts in Brooklyn, New York. We end by showing how to implement one of the more advanced models presented in chapter three.

Prerequisites

We assume that readers have a basic proficiency in R, data analysis, and introductory probability theory/statistics. While each topic is presented in an applied manner, and the overall mathematical complexity is low, a basic background in statistics is necessary to understand the fundamental concepts discussed throughout this guide. At the most basic level, a working knowledge of the Gauss-Markov assumptions, statistical inference, and programming with library(tidyverse) is needed. Further, some basic experience working with spatial data, library(sf), and making maps would be extremely helpful.

Before following along with the applied example, be sure to install and load the packages below:

## The Following Packages Are Used for the Analysis
library(tidyverse)
library(stringr)
library(readr)
library(sf)
library(spdep)
library(stargazer)
library(spatialreg)
library(patchwork)
library(GWmodel)
library(magrittr)

image source