HES 505 Fall 2025: Session 25
By the end of today you should be able to:
Use the spdep package to identify the neighbors of a given polygon based on proximity, distance, and minimum number
Understand the underlying mechanics of Moran’s I and calculate it for various neighbors
Distinguish between global and local measures of spatial autocorrelation
Visualize neighbors and clusters
From Manuel Gimond
Assumes autocorrelation to facilitate prediction
Semivariogram decribes how autocorrelation changes with distance
But what about statistical inference?
Attributes (features) are often non-randomly distributed
Especially true with aggregated data
Affects estimates of precision (and significance)
\[ I = \frac{n}{W} \cdot \frac{\sum_{i=1}^{n}\sum_{j=1}^{n} w_{ij}(x_i - \bar{x})(x_j - \bar{x})}{\sum_{i=1}^{n}(x_i - \bar{x})^2} \]
where \(W = \sum_{i=1}^{n}\sum_{j=1}^{n} w_{ij}\)
How do we define \(I(d)\) for areal data?
What about \(w_{ij}\)?
We can use spdep for that!!
Queen, rook, (and bishop) cases impose neighbors by contiguity
Weights calculated as a \(1/ num. of neighbors\)
\[ E[I] = \frac{-1}{n-1} \]
When \(n\) is large, E[I] approaches 0
But large relative to what?
\[ \mu_{lag} = \beta \times measurement \]
where \(\beta = I\)
We can generate the expected distribution of Moran’s I coefficients under a Null hypothesis of no spatial autocorrelation
Using permutation and a loop to generate simulations of Moran’s I
Pseudo p-value (based on permutations)
Analytically (sensitive to deviations from assumptions)
Using Monte Carlo
Sometimes we want to know about second-order autocorrelation
Is there clustering around different locations (but maybe not everywhere)?
\[ I_i = \frac{(x_i - \bar{x})}{\sum_{k=1}^{n}(x_k - \bar{x})^2/n} \sum_{j=1}^{n} w_{ij}(x_j - \bar{x}) \]
Can identify areas where clustering is great than expected
Proportional to Global Moran’s I
Interpolation assumes autocorrelation
Inference is interested in mechanisms
Tests for mechanisms get confused by autocorrelation
Diagnosing autocorrelation helps plan next steps (Weds)