Spatial Regime Models
Coefficients that differ across groups of units, with SKATER regionalization.
SpatialEconometrics.SpatialRegimeModels.ChowRegimeTest — Type
ChowRegimeTestTest of coefficient equality across regimes, returned by regime_chow_test.
Fields: stat, df, p_value, and the two log-likelihoods ll_pooled and ll_regime. Failing to reject means the pooled model is adequate and the regime split is not buying anything.
If the regimes came from skater_regimes rather than from outside knowledge, this p-value is optimistic: the split was chosen using the same data it is being tested on.
SpatialEconometrics.SpatialRegimeModels.ExogenousRegimes — Type
ExogenousRegimes(labels)Regime membership supplied directly, as an integer label per unit.
Use this when the grouping is known in advance — states, planning regions, pre- and post-reform periods. When it is not, skater_regimes derives spatially contiguous regimes from the data instead.
Examples
fit_spatial_regime(W, X, y, ExogenousRegimes(region_id))SpatialEconometrics.SpatialRegimeModels.SpatialRegimeModel — Type
SpatialRegimeModelA spatial regime model, returned by fit_spatial_regime: coefficients are allowed to differ across groups of units rather than being held constant over the whole map.
A discrete alternative to GWR — where fit_gwr lets coefficients vary smoothly with location, this estimates one set per regime, which is easier to interpret and test when the groups are meaningful. Use regime_chow_test to ask whether the split is warranted.
SpatialEconometrics.SpatialRegimeModels.fit_spatial_regime — Function
fit_spatial_regime(W, X, y, regimes; spatial_lag=true, varnames=nothing, method=ChebyshevApprox())Fit a spatial regime model where coefficients vary across regimes: y = ρWy + Xr βr + ε (spatiallag=true) y = Xr βr + ε (spatiallag=false)
Each regime gets its own intercept and slope coefficients. Anselin (1988, 1990).
SpatialEconometrics.SpatialRegimeModels.regime_chow_test — Function
regime_chow_test(pooled_model, regime_model)Likelihood ratio test for structural stability across spatial regimes. H₀: coefficients are equal across all regimes.
SpatialEconometrics.SpatialRegimeModels.skater_regimes — Function
skater_regimes(W, X, n_regimes; min_size=1, rng=Random.default_rng())Spatially constrained clustering via SKATER minimum spanning tree partitioning. Returns an ExogenousRegimes assignment with n_regimes contiguous groups, each guaranteed to be a connected region of W.
A minimum spanning tree is built over the contiguity graph with edge weights given by Euclidean distance between the standardised rows of X. The tree is then split n_regimes - 1 times, each time choosing the edge whose removal most reduces the within-group sum of squared deviations.
min_size is the smallest admissible region; cuts that would leave a smaller component are skipped. Raise it when the regions feed a regime regression, which needs enough units per region to identify its own coefficients.
Assunção et al. (2006) "Efficient regionalization techniques for socio‐economic geographical units using minimum spanning trees."