[ANN] SpatialEconometrics.jl — spatial and panel econometrics, and a question about the name

I have been building SpatialEconometrics.jl, a spatial and structural econometrics suite, and I am posting it here before registering rather than after — partly for feedback on the package, and partly because of a specific question about the name that I would rather the community answer than decide for myself. More on that at the end.

What it does

Estimation, rather than exploratory analysis. The package fits spatial models and reports the diagnostics that tell you which model you should have fitted:

using SpatialEconometrics, Random, LinearAlgebra

W = make_rook_weights(20)                       # 20×20 grid → 400 units
rng = MersenneTwister(42); N = 400
X = randn(rng, N, 2)
y = (I - 0.5 * W) \ (2.0 .+ X * [1.5, -0.8] .+ 0.5 .* randn(rng, N))

# Which specification does the data actually want?
lms = lm_tests(y, hcat(ones(N), X), W)
lms.robust_lag      # 278.55, p < 1e-4
lms.robust_error    #   4.43, p = 0.035
# Both reject at 5%; the robust lag statistic is two orders of magnitude
# larger, which is what points to SAR rather than SEM.

m = fit_spatial(SAR(), W, X, y; varnames = ["income", "density"])
spatial_effects(m)  # direct, indirect and total effects

Coverage, grouped rather than listed exhaustively:

  • Cross-section and panels — SAR, SDM and SEM by concentrated ML; static panels with one- and two-way fixed effects using the Lee–Yu transformation or direct QML with bias correction; dynamic spatial panels with the Yu–de Jong–Lee correction for Nickell bias.
  • When ML will not do — GS2SLS for SARAR panels with endogenous regressors, and Arellano–Bond / Blundell–Bond GMM with the Windmeijer correction, Hansen J and the AR(1)/AR(2) tests.
  • Higher-order and heterogeneous — SLX, SAC/SARAR, SDEM; regime models with SKATER regionalization; spatial probit and ordered probit by both linearized GMM and Albert–Chib Gibbs; eigenvector spatial filtering and RE-ESF; GWR and multiscale GWR.
  • Related things econometricians need next to these — PPML and negative binomial gravity models with high-dimensional fixed effects, Driscoll–Kraay and Conley spatial HAC covariances, GRAS and cross-entropy matrix balancing for SAM/MRIO work, model selection (AIC/BIC, LR, Vuong, Wald, common factor), Monte Carlo and power analysis, and LaTeX/CSV/Markdown output.

There is a @formula interface over all of it with slag(), fe() and endo() terms, so a Durbin panel with two-way effects and an instrumented regressor is one line. Weight matrices come from coordinates, k-NN, distance bands or a grid, and GeoDa GAL/GWT files round-trip exactly.

Optional extensions load automatically: Makie for diagnostic plots, Turing for Bayesian estimation.

How it relates to SpatialDependence.jl

SpatialDependence.jl is the package for exploratory spatial data analysis — polygon contiguity, Getis-Ord, local Geary, significance adjustment, choropleth mapping. If that is your work, use it; this package does none of it.

The overlap is Moran’s I, Geary’s c, local Moran and the distance/k-NN weight constructors. I kept my own because the LM specification tests have no counterpart there and are regression diagnostics rather than ESDA, because the estimators want SparseMatrixCSC directly for Chebyshev traces and log|I − ρW|, and because the Monte Carlo routines call these statistics inside replication loops where permutation inference is both a different basis and far too slow. I would be glad to contribute the LM battery upstream if the maintainer wants it; it is self-contained.

Status, and what is actually checked

This is a new package and I want to be straightforward about what that means.

492 test assertions across 26 testsets pass on Julia 1.10, 1.13 and nightly, across Linux, macOS and Windows — 527 with the two optional extensions installed. Of the 20 areas in the validation table, four carry full Monte Carlo studies and the rest check parameter recovery against a known DGP; the cross-sectional SDM study gives ρ̂ = 0.595 against a true 0.600, mean SE 0.0324 against an empirical SD of 0.0328, and 95% coverage of 0.96. Several tail computations are checked against exact closed forms rather than against another implementation. Every exported name has a docstring and the documentation builds with no warning exemptions.

What it does not have is history. The repository is days old and I am its only maintainer.

AI disclosure

I used a generative AI coding tool (Anthropic’s Claude) to draft the module code, the test suite, the documentation and the examples. I am stating that plainly here as well as in the README, because I would rather you know it upfront than discover it. The specifications are mine and come from the literature cited in the README; the numbers are checked by the test suite and the Monte Carlo studies above. I mention it because it is relevant to how you would want to review the package, not as a disclaimer.

The question about the name

SpatialEconometrics claims an entire subfield. That was raised in the registry review, fairly, and the General registry is a shared resource where good names are scarce. A broad name invites an expectation of community stewardship that a single-maintainer package days old cannot yet claim.

So I would rather ask than assume:

  1. Is SpatialEconometrics.jl an acceptable name for this, or should it be something narrower — SpatialEconometricsToolkit, or a name scoped to the estimation focus — leaving SpatialEconometrics free for a future community effort?
  2. If the scope looks right, would anyone want to co-maintain? An organization with several owners would answer the stewardship concern far better than my assurances, and I would rather set that up now than after the name is granted.

For context on the substance: I hold a PhD in econometrics, awarded in 1983, and I taught econometrics for several years. Most of what is in the package comes out of that teaching and research experience — which estimators are included, how they are parameterised, and why the LM battery sits at the front of the workflow rather than as an afterthought. That is not a substitute for a track record in this ecosystem, and I am not offering it as one.

Feedback on the econometrics, the API or the name is all welcome, and criticism of any of the three is more useful to me than agreement.

1 Like