spreg
PySAL Spatial Econometric Regression in Python
What it is and what it does
spreg is a Python package for estimating simultaneous autoregressive spatial regression models, part of the PySAL ecosystem. It addresses the statistical modeling of spatial processes where observations are not independent but interact with neighboring observations—a common scenario in geography, economics, and environmental science. The package builds on established scientific Python libraries (numpy, pandas, scikit-learn, scipy) and integrates with libpysal for spatial data structures.
The package is designed for researchers and practitioners who need to move beyond standard regression when spatial autocorrelation is present in their data. It handles the computational complexity of fitting models where the outcome at one location depends on outcomes at nearby locations, which violates the independence assumption of ordinary regression and requires specialized estimation techniques.
Use it for:
- Model house prices or property values where neighboring properties influence each other through spatial spillover effects
- Estimate regional economic growth where neighboring regions' economies interact and influence each other
- Analyze disease or pollution incidence across geographic areas accounting for spatial clustering and diffusion
- Study crime rates in neighborhoods where crime in adjacent areas affects local crime patterns
- Model agricultural yields or environmental variables across spatial fields with spatial correlation
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
spreg estimates simultaneous autoregressive spatial regression models for processes where observations interact with one another.
Yes, if you are modeling spatial data with autocorrelation. The package is actively maintained, has low install friction, carries a permissive BSD 3-Clause license, and integrates cleanly with numpy, pandas, scikit-learn, and scipy. No known vulnerabilities. Requires Python 3.12 or later, which may constrain legacy environments. Suitable for academic and applied spatial econometric work.
Install
spreg on PyPI
pip
pip install spreguv
uv add spregpoetry
poetry add spregInstalling spreg
Before you install
Low friction installation with a pure-Python wheel. Active maintenance: last commit 2026-07-27, released 18 days ago. Requires Python 3.12 or later.
License in practice
BSD 3-Clause permissive license allows commercial and private use with attribution and liability disclaimer.
Quickstart
pip install spreg
import spreg
from libpysal import weights
from spreg import OLS
# model = OLS(y, X, w=weights_matrix)
Requires Python 3.12 or later.
Verify before relying
- Whether the package supports spatial lag and spatial error models specifically, or other SAR variants
- Performance characteristics or scalability limits for large spatial datasets
- Availability and completeness of documentation beyond the repository README
Package facts
| License | BSD 3-Clause (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — libpysal, numpy, pandas, scikit-learn, scipy |
| Maintenance | actively maintained — 18 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 137,298/month — #11,372 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: spreg-1.9.1-py3-none-any.whl
Keywords: spatial econometrics, regression, statistics, spatial modeling
Tags
More GIS packages
Shapely provides Python tools for creating,…
permissive · top 1,000 on PyPI
pyprojpyproj provides a Python interface to PROJ,…
permissive · top 1,000 on PyPI
geopandasGeoPandas extends pandas DataFrames to handle…
permissive · top 1,000 on PyPI
geopygeopy is a Python client for geocoding and…
permissive · top 5,000 on PyPI
pyogrioPyogrio provides fast, bulk-oriented read and…
permissive · top 5,000 on PyPI
h3h3 provides Python bindings to Uber's H3…
permissive · top 5,000 on PyPI
spintSpInt calibrates spatial interaction models…
permissive · top 15,000 on PyPI
splotsplot creates static and interactive…
permissive · top 15,000 on PyPI
pysalPySAL is a meta-package that bundles 29 spatial…
permissive · top 15,000 on PyPI
spglmFits Gaussian, Poisson, QuasiPoisson, and…
permissive · top 15,000 on PyPI
esdaesda computes global and local spatial…
permissive · top 15,000 on PyPI
mgwrCalibrates multiscale and traditional…
permissive · top 15,000 on PyPI
linearmodelsProvides panel regression, instrumental…
unclear · top 15,000 on PyPI
spoptSpopt solves spatial optimization problems…
permissive · top 15,000 on PyPI
archProvides ARCH/GARCH volatility models, unit…
unclear · top 5,000 on PyPI
gstoolsGSTools provides geostatistical tools for…
copyleft · top 15,000 on PyPI