skillfed

spint

SPatial INTeraction models

spint v1.1.0 101.4K downloads/30d#12,940 on PyPI58
Permissive license BSD 3-Clause Active released

What it is and what it does

SpInt is a spatial interaction modeling library that calibrates gravity-type models for analyzing flows between geographic origins and destinations. It implements the Wilson (1971) family of entropy-maximizing models, supporting unconstrained, production-constrained, attraction-constrained, and doubly-constrained variants. All models are fit using iteratively weighted least squares in a generalized linear modeling framework, with results verified against comparable R and statsmodels routines.

The package is designed for researchers studying spatial interaction processes—such as migration, trade, or commuting patterns. It provides Poisson and QuasiPoisson estimation, overdispersion tests, model fit statistics (including Moran's I for spatial autocorrelation), local subset calibration for mappable parameter estimates, and three types of spatial weights (origin-destination contiguity, network-based, and vector distance). Sparse data structures are used for memory efficiency and speed.

Use it for:

  • Calibrate gravity models to predict origin-destination flows (e.g., commuting, migration, or trade volumes) from population and distance data.
  • Test spatial autocorrelation in interaction residuals using vector-based Moran's I to detect model misspecification.
  • Fit production- or attraction-constrained models when total outflows or inflows are known but individual flows must be estimated.
  • Generate mappable local parameter estimates and diagnostics by calibrating models on spatial subsets.
  • Compare overdispersion across Poisson and QuasiPoisson specifications to assess model adequacy for count data.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

SpInt calibrates spatial interaction models (gravity, production-constrained, attraction-constrained, and doubly-constrained) using an entropy-maximizing framework and iteratively weighted least squares, with support for Poisson and QuasiPoisson count models.

Yes. SpInt is actively maintained, has no known vulnerabilities, low install friction, and fills a specialized but well-defined niche in spatial interaction modeling. The BSD 3-Clause license is permissive. Install it if you need to calibrate gravity or constrained spatial interaction models; skip it if your work does not involve origin-destination flow analysis.

Install

spint on PyPI

pip

pip install spint

uv

uv add spint

poetry

poetry add spint

Installing spint

Before you install

Low install friction; pure Python wheel. Actively maintained with a recent release (58 days old) and current Python 3.12+ support. Depends on established scientific stack (numpy, scipy, libpysal, spglm, spreg).

License in practice

BSD 3-Clause permissive license allows commercial and private use with minimal restrictions; attribution required.

Quickstart

pip install spint

import spint
from spint import gravity
# Calibrate a spatial interaction model with your origin-destination flow data

Requires Python 3.12 or later; depends on scipy, numpy, and libpysal for spatial data structures.

Verify before relying

  • Whether local subset calibration produces parameter estimates suitable for direct mapping without post-processing.
  • Performance characteristics when working with large origin-destination matrices or high-dimensional spatial weights.
  • Current status of Spatial Autoregressive (Lag) model implementation listed as 'In Progress'.

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, scipy, spglm, spreg
Maintenance actively maintained — 58 days since the last release
Last repo commit
First released
Downloads 101,387/month — #12,940 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: spint-1.1.0-py3-none-any.whl

Keywords: spatial, statistics

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

Tags

spatial interaction modelinggravity model calibrationconstrained spatial modelsspatial interaction analysisentropy maximizing modelsorigin destination flowsspatial count data
spatial-analysisgravity-modelscount-data

More GIS packages