skillfed

spreg

PySAL Spatial Econometric Regression in Python

spreg v1.9.1 137.3K downloads/30d#11,372 on PyPI90
Permissive license BSD 3-Clause Active released

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 spreg

uv

uv add spreg

poetry

poetry add spreg

Installing 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

Intended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: GIS

Tags

spatial regression modelsautoregressive spatial econometricsspatial modeling pythonsimultaneous autoregressive estimationspatial econometric regressionspatial interaction modelinggis regression analysis
spatial-analysiseconometricsgis

More GIS packages