EconStatsCraft › Spatial autocorrelation

Spatial autocorrelation

Is this variable clustered in space, or scattered at random over the map? Moran's I answers it globally, LISA answers it place by place and names the hot spots, the cold spots and the outliers. Run it before any regression on geographic data: if the answer is yes, ordinary standard errors are too small.

What it needs

The intuition

Tobler's first law: everything is related to everything else, but near things more than distant things. Before fitting any spatial model, the question is whether that is true of your data - whether districts with high values sit next to other districts with high values more than chance would produce. Moran's I answers it with a single number that behaves like a correlation coefficient for space.

When to use it

Before any regression on geographic units - districts, states, countries, firms with addresses. If the dependent variable or the residuals are spatially clustered, ordinary standard errors are too small, because two neighbouring observations are not two independent pieces of information.

Where the estimator comes from

Given a spatial weights matrix W with w_{ij} describing how connected i and j are, and z_i=x_i-\bar{x}, I=\frac{n}{\sum_i\sum_j w_{ij}}\cdot\frac{\sum_i\sum_j w_{ij}z_iz_j}{\sum_i z_i^2}. The second factor is a ratio of a weighted cross-product to a variance, which is why I reads like a correlation. Under the null of no spatial association E[I]=-1/(n-1) - NOT zero, which matters in small samples - and a variance is available analytically or by permutation. Geary\'s C uses squared differences instead of cross-products and is more sensitive to local variation; the two usually agree in direction and are inversely related.

The model

I=\frac{n}{S_0}\cdot\frac{\sum_i\sum_j w_{ij}(y_i-\bar y)(y_j-\bar y)}{\sum_i (y_i-\bar y)^2}\qquad E[I]=\frac{-1}{n-1}

What it assumes

Statistical properties

How to read the output

A worked reading

District GDP per capita over 641 Indian districts, with five nearest neighbours and row-standardised weights. Moran's I = 0.7337 against an expected value under the null of -0.0016, giving z = 30.97: emphatically clustered. Note the reference point is -0.0016 and not zero - the expectation of Moran's I under no spatial pattern is -1/(n-1), so with 641 units it is very close to zero but with 16 it would be -0.067, and on a small map that difference is the whole test. Geary's C = 0.2618 against its own null of 1 says the same thing in the other direction. The local decomposition is where the interpretation lives: 89 districts are high-value surrounded by high, 92 are low surrounded by low, exactly two are outliers against their neighbourhoods, and 458 - more than two thirds - are not distinguishable from chance. A map of that statistic shows clusters in a fifth of the country and nothing in the rest, which is a more honest picture than the single global number.

Symptom → diagnosis → what to do

If you see thisIt meansDo this
Moran I near zeroNo global clustering, or opposite-sign clusters cancellingCheck local indicators before concluding
I negative and significantA chequerboard: neighbours differ systematicallyReal, and much rarer than positive clustering
Results changing with the weights matrixExpected. W is an assumptionReport several and say which was chosen and why
Some units having no neighboursIslands under a contiguity ruleThey contribute nothing. Use k-nearest instead
I positive on the raw variable onlyGeography, not model misspecificationTest the residuals
Very small nThe -1/(n-1) null mattersUse permutation inference

Common mistakes

Where to read this properly

See also

Spatial regression, for modelling the dependence this test detects. Autocorrelation, the time-series analogue.

Related Causal

Spatial regression · Heckman selection · Instrumental variables (2SLS) · Difference-in-differences · Staggered difference-in-differences · Regression discontinuity · Matching & weighting · Oaxaca–Blinder decomposition

All analyses

Charts

Line chart · Area chart · Bar chart · Stacked bar · Scatter plot · Bubble chart · Histogram · Box plot · Pie chart · Heat map · Rebased to 100 · Lorenz curve and Gini

Maps

World map · Bivariate map · Flow map · India - state map · India - district map

Explore

Descriptive statistics · Summary by group · Two-way table · Classical statistical tests

Regression

Multiple regression (OLS) · Logit / Probit · Tobit (censored) · Truncated regression · Multinomial logit · Ordered logit / probit · Quantile regression · Poisson / Negative binomial

Time series - one series

Time-varying coefficients (Kalman) · Unit root tests · Correlogram (ACF / PACF) · ARIMA / SARIMA · Rolling-origin cross-validation · Theta method · Unobserved components · STL forecasting · Forecast combination · Markov regime switching · Change frequency (resample) · ARCH / GARCH volatility · Decompose & filter · Spectral analysis · Exponential smoothing · Forecast accuracy

Time series - several series

Yield curve (Nelson–Siegel / Svensson) · Dynamic factor model · Dynamic regression (ARIMAX) · Structural VAR · VAR · Granger causality · Cointegration · VECM · ARDL & bounds test

Panel data

Panel regression · Panel cointegration tests · Heterogeneous panel: Mean Group & PMG · Gravity model of trade · Dynamic panel GMM · Panel diagnostics · Panel unit-root tests

Multivariate statistics

Principal components (PCA) · Factor analysis · Cluster analysis

Marketing research

Conjoint analysis · MaxDiff (best–worst scaling) · TURF - reach of a product line · Price sensitivity (Van Westendorp) · Market basket analysis · Perceptual map · Scale reliability (Cronbach’s alpha) · Key driver analysis

Causal

Spatial autocorrelation · Spatial regression · Heckman selection · Instrumental variables (2SLS) · Difference-in-differences · Staggered difference-in-differences · Regression discontinuity · Matching & weighting · Oaxaca–Blinder decomposition

Finance & risk

Black–Scholes option pricing · Bond price, duration & convexity · Merton distance to default · EMI / home loan planner · CAPM / beta estimation · Multi-factor model · Portfolio optimization · Value at Risk & Expected Shortfall · Performance & drawdown · Time value of money & NPV/IRR · Equity valuation (DDM, FCF, residual income) · Cost of capital (WACC) · Binomial option pricing · Option strategies (payoff & profit) · Forwards, futures & swaps · Credit risk & Basel capital · Extreme value theory (tail risk)

Actuarial

Life table · Life annuity · Life insurance pricing · Chain ladder reserving · Buhlmann credibility · Survival analysis · Mortality graduation · Aggregate loss model · Ruin probability · Multi-state Markov model · Loss severity fitting

Tests & breaks

Monte Carlo experiment · F-test, Wald & Chow · Structural breaks & stability

Machine learning

Regression vs machine learning · Ridge / Lasso / Elastic Net · Random forest · Gradient boosting

Open the workspace →

Starting engine…

EconStatsCraft rigorous, plain-spoken econometrics

Econometrics that explains itself.

Regression, panel data, time series and the whole battery of tests. Every result is followed by a verdict you can defend.

Load a dataset to see it here.