Teaching the model to think spatially
We kicked this chapter off with a brief disclaimer that it is important to consider spatial structures and incorporate them into the regression modeling process. This is especially important if the underlying data is generated via a geospatial process. Thankfully, there are numerous methods by which you can accomplish this. In this section, we will build spatial structures into our models in two ways. First, we’ll incorporate some of the spatially engineered variables that were constructed in Chapter 7, Spatial Feature Engineering. The second way we will build space into the model is by exploring spatial fixed effects, and we’ll talk more about this later on.
To begin, let’s go ahead and bring the spatially engineered variables into the equation. In the following first step, you’ll rerun the feature engineering process previously conducted to bring in the distance to some common NYC attractions:
- Recreate spatially...