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.
EconStatsCraft › 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.
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.
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.
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.
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}
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.
| If you see this | It means | Do this |
|---|---|---|
| Moran I near zero | No global clustering, or opposite-sign clusters cancelling | Check local indicators before concluding |
| I negative and significant | A chequerboard: neighbours differ systematically | Real, and much rarer than positive clustering |
| Results changing with the weights matrix | Expected. W is an assumption | Report several and say which was chosen and why |
| Some units having no neighbours | Islands under a contiguity rule | They contribute nothing. Use k-nearest instead |
| I positive on the raw variable only | Geography, not model misspecification | Test the residuals |
| Very small n | The -1/(n-1) null matters | Use permutation inference |
Spatial regression, for modelling the dependence this test detects. Autocorrelation, the time-series analogue.
Spatial regression · Heckman selection · Instrumental variables (2SLS) · Difference-in-differences · Staggered difference-in-differences · Regression discontinuity · Matching & weighting · Oaxaca–Blinder decomposition
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
World map · Bivariate map · Flow map · India - state map · India - district map
Descriptive statistics · Summary by group · Two-way table · Classical statistical tests
Multiple regression (OLS) · Logit / Probit · Tobit (censored) · Truncated regression · Multinomial logit · Ordered logit / probit · Quantile regression · Poisson / Negative binomial
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
Yield curve (Nelson–Siegel / Svensson) · Dynamic factor model · Dynamic regression (ARIMAX) · Structural VAR · VAR · Granger causality · Cointegration · VECM · ARDL & bounds test
Panel regression · Panel cointegration tests · Heterogeneous panel: Mean Group & PMG · Gravity model of trade · Dynamic panel GMM · Panel diagnostics · Panel unit-root tests
Principal components (PCA) · Factor analysis · Cluster analysis
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
Spatial autocorrelation · Spatial regression · Heckman selection · Instrumental variables (2SLS) · Difference-in-differences · Staggered difference-in-differences · Regression discontinuity · Matching & weighting · Oaxaca–Blinder decomposition
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)
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
Monte Carlo experiment · F-test, Wald & Chow · Structural breaks & stability
Regression vs machine learning · Ridge / Lasso / Elastic Net · Random forest · Gradient boosting
EconStatsCraft rigorous, plain-spoken econometrics
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.
Pick the example closest to your question. You get a spreadsheet with the right columns and a few rows showing the expected format - replace the numbers with your own, then paste or upload it back.
Copy the header row from the table above (or from the downloaded template), put your own rows underneath, and paste the whole thing here. It is checked against the layout before anything is imported.
Or click a row in the preview below.
For a units or notes row.
Search every source at once. World Bank indicators need countries and years; everything else loads in one click.
Loading the catalogue…
The engine stays loaded, so this is quick - and it leaves your open tab and panel layout alone.
⌘/Ctrl+Enter runs the current analysis. ⌘/Ctrl+P exports the session as a PDF. Esc closes this.
In the Notebook: Enter starts a new block and
Shift+Enter a new line inside one; Backspace at the start
joins back into the paragraph above; / on an empty line inserts anything.
⌘/Ctrl+B, I, E, H and
M apply bold, italic, code, highlight and maths.
#, ##, -, 1., > and
``` at the start of a line convert it.
Sign in to run unlimited analyses.
Scroll to pan · Esc to close