13.4 Spatial Statistics & Pattern Analysis: Spatial Autocorrelation, Hot Spots & Regression
Key Takeaways
- Spatial statistics incorporates coordinate space and spatial relationships directly into statistical equations, separating first-order effects (spatial variation in mean intensity) from second-order effects (spatial dependence and interaction between neighbors).
- The Spatial Weights Matrix ($W$) formalizes spatial interactions using contiguity (Rook or Queen), distance bands, or $k$-nearest neighbors, with row-standardization scaling weights to prevent sampling density bias.
- Global Moran's $I$ evaluates whether an entire dataset exhibits spatial autocorrelation, returning an index value, $z$-score, and $p$-value that classify the overall distribution as clustered, dispersed, or random.
- Local spatial statistics isolate localized spatial patterns: Anselin Local Moran's $I$ detects clusters (High-High, Low-Low) and spatial outliers (High-Low, Low-High), while Getis-Ord $G_i^*$ identifies statistically significant hot spots and cold spots.
- Spatial regression models overcome Ordinary Least Squares (OLS) failures caused by spatially autocorrelated residuals: Spatial Lag models capture contagion/spillover, Spatial Error models address unobserved spatial covariates, and Geographically Weighted Regression (GWR) models spatial non-stationarity.
13.4 Spatial Statistics & Pattern Analysis: Spatial Autocorrelation, Hot Spots & Regression
Quick Summary: Classical aspatial statistics assumes that sample observations are independent and identically distributed (i.i.d.). In geographic reality, this assumption is routinely violated because spatial data exhibits spatial dependence, clustering, and heterogeneity. Spatial statistics incorporates geographic space, proximity, and topological adjacency directly into mathematical equations. Analysts utilize global metrics like Global Moran's $I$ to quantify dataset-wide spatial autocorrelation, local metrics like Getis-Ord $G_i^*$ and Anselin Local Moran's $I$ to identify statistically significant hot spots and spatial outliers, and spatial regression techniques (Spatial Lag, Spatial Error, and Geographically Weighted Regression) to resolve spatial autocorrelation violations in Ordinary Least Squares (OLS) modeling.
1. First-Order vs. Second-Order Spatial Effects
When analyzing spatial distributions, observed patterns are driven by two distinct statistical processes:
FIRST-ORDER EFFECT (Large-Scale Trend) SECOND-ORDER EFFECT (Local Interaction)
-------------------------------------- ---------------------------------------
• Variation in the mean (intensity) across • Mutual attraction, repulsion, or
space driven by exogenous factors. contagion between neighboring points.
• Example: Tree density varying with an • Example: Seed dispersal clustering near
elevation or precipitation gradient. parent trees; contagious disease spread.
[High Density] ---> [Low Density] * * * * * *
(Continuous environmental drift) * * * * * * * *
(Localized clustering/interaction)
- First-Order Effects (Intensity / Trend): Represent large-scale spatial variation in the expected value or mean of a variable across space. First-order processes are driven by external environmental or structural gradients (e.g., agricultural crop yield declining across a soil moisture gradient, or housing prices varying with regional accessibility to an urban central business district).
- Second-Order Effects (Spatial Dependence / Interaction): Represent small-scale spatial correlation resulting from direct interaction, attraction, or competition between the observations themselves (e.g., infectious disease transmission between adjacent neighborhoods, retail clustering driven by agglomeration economies, or spatial repulsion among competing territorial predators).
2. Conceptualizing Spatial Relationships: The Spatial Weights Matrix ($W$)
To compute spatial statistics, the geographic relationships between features must be quantified mathematically into an $N \times N$ Spatial Weights Matrix ($W$), where $N$ is the number of features in the dataset. Each cell $w_{ij}$ quantifies the spatial influence of feature $j$ on feature $i$ ($w_{ii} = 0$, as a feature does not influence itself).
Contiguity: ROOK (Edge Only) Contiguity: QUEEN (Edge or Corner Vertex)
+-----------+-----------+-----------+ +-----------+-----------+-----------+
| | Neighbor | | | Neighbor | Neighbor | Neighbor |
| | (Edge) | | | (Corner) | (Edge) | (Corner) |
+-----------+-----------+-----------+ +-----------+-----------+-----------+
| Neighbor | TARGET | Neighbor | | Neighbor | TARGET | Neighbor |
| (Edge) | FEATURE | (Edge) | | (Edge) | FEATURE | (Edge) |
+-----------+-----------+-----------+ +-----------+-----------+-----------+
| | Neighbor | | | Neighbor | Neighbor | Neighbor |
| | (Edge) | | | (Corner) | (Edge) | (Corner) |
+-----------+-----------+-----------+ +-----------+-----------+-----------+
Spatial Weights Conceptualizations
- Polygon Contiguity:
- Rook Contiguity: Features share a common linear boundary segment (edge) of non-zero length. Touching at a single point does not establish adjacency (resembles a chess rook moving horizontally/vertically).
- Queen Contiguity: Features share a common boundary edge OR a common corner vertex (resembles a chess queen moving in all directions). Widely preferred for administrative polygon data.
- Distance-Based Relationships:
- Fixed Distance Band (Threshold Sphere of Influence): Every feature within a critical threshold distance $d$ is assigned $w_{ij} = 1$; features beyond $d$ receive $w_{ij} = 0$. The threshold distance must be chosen such that every feature has at least one neighbor.
- Inverse Distance Weighting ($1/d_{ij}$ or $1/d_{ij}^2$): Continuous spatial decay where every feature influences every other feature, but influence diminishes with distance.
- $k$-Nearest Neighbors ($k$-NN):
- Each feature is linked to exactly its $k$ closest neighbors, regardless of distance. Essential for datasets with highly variable spatial densities (e.g., combining densely packed urban census tracts with expansive rural tracts).
Row Standardization
In raw contiguity matrices, a polygon bounded by 12 neighbors receives a total weight of 12, whereas a peripheral polygon bounded by only 2 neighbors receives a total weight of 2. This imbalance distorts statistical testing.
Row Standardization scales the weights so that the sum of each row in the matrix equals $1$:
Row standardization converts the neighborhood calculation into a local weighted average, ensuring that features located in dense clusters do not exert disproportionate mathematical leverage over features located on the study area periphery.
3. Global Spatial Autocorrelation: Global Moran's $I$ & General $G$
Global Spatial Autocorrelation tests whether an entire spatial dataset exhibits a pattern that is statistically clustered, dispersed, or random under the null hypothesis of Complete Spatial Randomness (CSR).
Global Moran's $I$
Global Moran's $I$ is the standard metric for spatial autocorrelation, evaluating feature locations and continuous attribute values simultaneously:
Where $x_i$ is the attribute value of feature $i$, $\bar{x}$ is the mean of the attribute, and $w_{ij}$ is the spatial weight between features $i$ and $j$.
CLUSTERED PATTERN RANDOM PATTERN DISPERSED PATTERN
High values near High; No spatial pattern; Checkerboard configuration;
Low values near Low. values mixed randomly. dissimilar values neighbor.
+---+---+---+ +---+---+---+ +---+---+---+
| 9 | 8 | 9 | | 9 | 1 | 8 | | 9 | 1 | 9 |
+---+---+---+ +---+---+---+ +---+---+---+
| 8 | 9 | 8 | | 2 | 9 | 1 | | 1 | 9 | 1 |
+---+---+---+ +---+---+---+ +---+---+---+
| 1 | 2 | 1 | | 8 | 2 | 9 | | 9 | 1 | 9 |
+---+---+---+ +---+---+---+ +---+---+---+
Moran's I > 0 (z > +1.96) Moran's I ≈ E(I) (z ≈ 0) Moran's I < 0 (z < -1.96)
Interpretation of Moran's $I$
The theoretical expected value under the null hypothesis of spatial randomness is:
As $N$ grows large, $E(I)$ approaches zero.
- $I > E(I)$ with significant positive $z$-score ($z > +1.96, p < 0.05$): Clustered pattern. Features with similar high or low values are spatially aggregated.
- $I \approx E(I)$ with $z$-score near zero ($p > 0.05$): Random distribution. The null hypothesis cannot be rejected.
- $I < E(I)$ with significant negative $z$-score ($z < -1.96, p < 0.05$): Dispersed / Competitive pattern. Features with dissimilar values neighbor each other, forming a checkerboard or competitive spatial structure.
High/Low Clustering (General $G$)
While Moran's $I$ detects overall clustering, it does not reveal whether the clustering is driven by clusters of high values or clusters of low values. The Getis-Ord General $G$ statistic resolves this ambiguity:
- High General $G$ (positive $z$-score): Spatial clustering of high values dominates the study area.
- Low General $G$ (negative $z$-score): Spatial clustering of low values dominates the study area.
4. Local Spatial Statistics: Anselin Local Moran's $I$ & Getis-Ord $G_i^*$
Global statistics can mask localized clusters. A dataset might display zero global autocorrelation because localized hot spots and cold spots cancel each other out. Local spatial statistics evaluate spatial autocorrelation around each individual feature.
Anselin Local Moran's $I$ (Cluster and Outlier Analysis)
Developed by Luc Anselin in 1995, Local Moran's $I$ deconstructs Global Moran's $I$ into individual contributions for each feature $i$, categorizing statistically significant features ($p < 0.05$) into four distinct quadrants:
High Attribute Value (x_i > x_mean)
^
|
HIGH-LOW (HL) | HIGH-HIGH (HH)
Spatial Outlier | Hot Spot Cluster
(High value surrounded | (High value surrounded
by Low neighbors) | by High neighbors)
|
<------------------------------------+------------------------------------>
Low Neighbor Lag (Wx < x_mean) | High Neighbor Lag (Wx > x_mean)
|
LOW-LOW (LL) | LOW-HIGH (LH)
Cold Spot Cluster | Spatial Outlier
(Low value surrounded | (Low value surrounded
by Low neighbors) | by High neighbors)
|
v
Low Attribute Value (x_i < x_mean)
- High-High (HH): A statistically significant cluster of high values surrounded by high values (Hot Spot Cluster).
- Low-Low (LL): A statistically significant cluster of low values surrounded by low values (Cold Spot Cluster).
- High-Low (HL): A spatial outlier—a feature with a high value surrounded primarily by features with low values (e.g., an affluent gated enclave in a distressed urban corridor).
- Low-High (LH): A spatial outlier—a feature with a low value surrounded primarily by features with high values (e.g., an abandoned industrial parcel inside a high-rent commercial zone).
Getis-Ord $G_i^*$ (Hot Spot Analysis)
The Getis-Ord $G_i^*$ statistic calculates a standard normal $z$-score and $p$-value for each feature, determining whether the local sum of values for a feature and its neighbors is statistically different from the expected global sum:
- Statistically Significant Positive $z$-score ($z > +1.96, p < 0.05$): Hot Spot. High values are clustered together. A $z$-score $> +2.58$ indicates 99% statistical confidence.
- Statistically Significant Negative $z$-score ($z < -1.96, p < 0.05$): Cold Spot. Low values are clustered together. A $z$-score $< -2.58$ indicates 99% statistical confidence.
- $z$-score near zero: Not statistically significant. Observed local values reflect random spatial variation.
[!IMPORTANT] Difference Between $G_i$ and $G_i^*$:
- $G_i^*$ (with star): Includes the target feature itself in the local neighborhood sum ($w_{ii} > 0$). This is the standard tool used in hot spot analysis.
- $G_i$ (without star): Excludes the target feature $i$ from its own neighborhood calculation, evaluating only the surrounding neighbors.
5. Spatial Regression: OLS Diagnostics to GWR
Linear regression models relationships between a dependent variable ($Y$) and one or more explanatory variables ($X$).
Ordinary Least Squares (OLS) Regression and Assumptions
Classical OLS regression relies on critical statistical assumptions: linearity, homoscedasticity (constant variance of residuals), normal distribution of residuals, and independence of residuals:
The Multicollinearity Trap: Variance Inflation Factor (VIF)
When explanatory variables are highly correlated with one another, the model suffers from multicollinearity, which destabilizes coefficient estimates and inflates standard errors.
- Diagnostic Metric: Variance Inflation Factor (VIF).
- Rule of Thumb: Any explanatory variable with a VIF $> 7.5$ (or conservatively $> 10$) indicates severe redundancy and must be systematically eliminated from the regression equation.
Testing OLS Residuals for Spatial Autocorrelation
Following OLS execution, an analyst must run Global Moran's $I$ on the regression residuals ($\epsilon$):
- If residuals exhibit a random spatial distribution ($p > 0.05$), the OLS assumption of independent errors is satisfied, and the model is statistically valid.
- If residuals exhibit statistically significant spatial clustering ($p < 0.05$), the independence assumption is violated! The OLS standard errors are underestimated, $t$-statistics are artificially inflated, and variables may appear statistically significant when they are not (Type I Error).
When OLS residuals are spatially autocorrelated, the analyst must transition to spatial regression modeling.
+---------------------------------------------------------------------------------+
| SPATIAL REGRESSION DECISION WORKFLOW |
+---------------------------------------------------------------------------------+
| Run Ordinary Least Squares (OLS) Regression |
| Check Multicollinearity: Ensure all explanatory variable VIF values < 7.5 |
+---------------------------------------------------------------------------------+
|
v
Test OLS Residuals (ε) using Global Moran's I
-----------------------------------------------------------------------------------
Is Moran's I on residuals statistically significant (p < 0.05)?
|
+---> NO --> OLS Model is valid and reliable! Conclude analysis.
|
+---> YES --> Independence assumption violated! Consult Lagrange Multipliers:
|
+--> Robust LM (Lag) significant? --> Fit SPATIAL LAG MODEL
+--> Robust LM (Error) significant? --> Fit SPATIAL ERROR MODEL
+--> Relationships vary spatially? --> Fit GWR MODEL
Spatial Autoregressive Models: Spatial Lag vs. Spatial Error
- Spatial Lag Model (Spatial Autoregressive Model):
- Equation: $Y = \rho W Y + X\beta + \epsilon$
- Mechanism: Adds a spatially lagged dependent variable ($W Y$) as an explanatory factor, where $\rho$ is the spatial autoregressive parameter.
- When to Use: When the physical phenomenon exhibits direct spatial contagion, diffusion, or behavioral spillover (e.g., crime spilling across adjacent precinct borders, or home sale prices directly influenced by neighboring home sale prices).
- Spatial Error Model:
- Equation: $Y = X\beta + \lambda W \epsilon + u$
- Mechanism: Models spatial autocorrelation directly within the error term, where $\lambda$ represents the spatial error coefficient.
- When to Use: When spatial clustering in residuals is caused by unobserved, omitted spatial variables or spatial boundary mismatch (e.g., unmeasured microclimatic factors influencing agricultural yield, or unmodeled neighborhood school quality).
Geographically Weighted Regression (GWR)
Traditional regression models assume spatial stationarity—the premise that the relationship between explanatory variables and the dependent variable is constant everywhere across the study area.
In reality, relationships vary across space, a condition known as spatial non-stationarity (e.g., income may strongly predict housing price in a suburban market but have a weak relationship in an agricultural rural district). Geographically Weighted Regression (GWR) resolves this by fitting a local regression equation for every feature location $(u_i, v_i)$:
GWR calculates local parameter estimates by weighting neighboring observations using a moving spatial kernel (fixed bandwidth or adaptive bandwidth based on sample density). Rather than producing a single global coefficient, GWR produces continuous maps of local $\beta$ coefficients, $t$-statistics, and local $R^2$ values.
6. Summary Comparison of Spatial Regression Models
| Regression Model | Mathematical Formulation | Autoregressive Component | Primary Diagnostic Condition |
|---|---|---|---|
| Ordinary Least Squares (OLS) | $Y = X\beta + \epsilon$ | None (assumes independent errors). | Baseline linear model; residuals must exhibit random spatial distribution (Moran's $I$ $p > 0.05$). |
| Spatial Lag Model | $Y = \rho W Y + X\beta + \epsilon$ | Dependent variable lag ($\rho W Y$). | Significant Robust Lagrange Multiplier (Lag); presence of direct spatial spillover/diffusion. |
| Spatial Error Model | $Y = X\beta + \lambda W \epsilon + u$ | Disturbance/error lag ($\lambda W \epsilon$). | Significant Robust Lagrange Multiplier (Error); unmeasured environmental/omitted variables. |
| Geographically Weighted Regression (GWR) | $Y_i = X_i \beta(u_i, v_i) + \epsilon_i$ | Local spatial kernel bandwidth weighting. | Spatial non-stationarity (Koenker Breusch-Pagan test significant); coefficients vary across space. |
7. Practical Geospatial Scenario: Urban Public Health Epidemiology
Analytical Problem
A state health agency investigates childhood asthma hospitalization rates across 400 census tracts. The epidemiologist fits an initial OLS model with three predictors: PM2.5 air pollution concentration, median household income, and proximity to major highways.
Execution and Diagnosis
- Multicollinearity Screening: The analyst checks the VIF table. PM2.5 has a VIF of 1.8, income has a VIF of 2.3, and highway proximity has a VIF of 1.5. Because all values are well below 7.5, multicollinearity is ruled out.
- Residual Diagnostic: The analyst extracts the OLS residuals ($\epsilon$) and runs Global Moran's $I$. The test returns $I = 0.42$, $z = 8.65$, $p < 0.0001$. Residuals are highly clustered in space, violating the OLS independence assumption.
- Model Selection: Lagrange Multiplier diagnostics reveal that the Robust LM (Error) is highly significant ($p < 0.001$), while Robust LM (Lag) is non-significant ($p = 0.38$). This demonstrates that clustering is caused by unmodeled regional covariates (such as older housing stock with mold and lead paint) rather than contagious person-to-person transmission.
- Remediation: The team executes a Spatial Error Model. The spatial autoregressive parameter $\lambda$ absorbs the error dependence, standard errors stabilize, and the resulting parameter coefficients accurately reflect true environmental risk factors.
8. Common Exam Traps & Pitfalls
[!CAUTION] Exam Trap 13.4.1: Confusing Hot Spots with Spatial Outliers. Exam questions frequently test whether an analyst can distinguish between Getis-Ord $G_i^$ and Anselin Local Moran's $I$. **Getis-Ord $G_i^$ only identifies Hot Spots (High-High) and Cold Spots (Low-Low)**. It cannot identify spatial outliers. If a question asks which tool isolates an anomalous high value surrounded by low values (High-Low) or a low value surrounded by high values (Low-High), the correct answer is Anselin Local Moran's $I$ (Cluster and Outlier Analysis).
[!CAUTION] Exam Trap 13.4.2: Ignoring OLS Residual Autocorrelation. A standard exam question asks: "An analyst runs an OLS regression model with an $R^2$ of 0.88, but Global Moran's $I$ on the residuals yields a $z$-score of +6.5 ($p < 0.001$). Can the model results be trusted?" The answer is No. When residuals are spatially autocorrelated, the assumption of independent errors is violated. Standard errors are biased downward, causing false positives in hypothesis testing. The model specification should be reconsidered; depending on the process and objective, a spatial error, spatial lag, other structured model, or revised covariate specification may be appropriate.
[!CAUTION] Exam Trap 13.4.3: Variance Inflation Factor (VIF) Threshold. Treat VIF as a diagnostic rather than a universal pass/fail law. Values above 10 are commonly flagged as severe, while some software uses lower guidance such as 7.5. Investigate redundant predictors and revise, combine, or justify them in context.
A crime analyst performs a spatial statistical study on burglaries across urban census tracts. The Global Moran's I test yields an index value of +0.48, a z-score of +7.2, and a p-value of 0.0001. How should the analyst interpret these results?
An urban planner is evaluating property tax reassessments to detect gentrification patterns. The goal is to identify anomalous individual residential parcels having very high assessed valuations that are surrounded predominantly by low-valuation properties. Which spatial statistics geoprocessing tool is specifically designed to isolate these features?
A spatial data scientist fits an Ordinary Least Squares (OLS) regression model to predict residential water consumption. Two explanatory variables—total household occupants and number of bathroom fixtures—yield Variance Inflation Factor (VIF) values of 12.4 and 10.8, respectively. Furthermore, Global Moran's I performed on the OLS residuals yields a p-value of 0.002. What dual corrective actions must the analyst take?