spglm
Sparse Generalized Linear Models
Decision gist · record as of 2026-08-14
Yes, if you are working with sparse generalized linear models in a spatial statistics context (especially within PySAL). Install with caution if you need robust estimation of ill-conditioned data—the package's direct normal-equation solver is not the most numerically stable approach; Statsmodels is better for that. No known vulnerabilities and active maintenance make it a safe dependency.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low friction: pure Python wheel with four standard dependencies (numpy, scipy, libpysal, spreg).
- Actively maintained as of July 2026 with no known vulnerabilities.
License · maintenance · safety
BSD 3-Clause (permissive) — BSD 3-Clause permissive license allows commercial and private use with attribution; no restrictions on derivative works.
last release 2023-10-25 (1024 days) · last repo commit 2026-07-07 · 37 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 103,036 downloads/mo, #12,832 on PyPI
Alternatives
Verify before relying
pip install spglm
import spglm
from spglm.glm import GLM
model = GLM(y, X, family=spglm.family.Gaussian())
results = model.fit()- Whether the package is actively used in production spatial analysis workflows beyond PySAL ecosystem.
- Performance characteristics and scalability limits for very large sparse matrices.
- Availability and completeness of documentation beyond the homepage.
What it is and what it does
spglm is a lightweight, sparse-compatible implementation of generalized linear modeling adapted from Statsmodels. It provides estimation of Gaussian, Poisson, QuasiPoisson, and Logistic regression models using iteratively weighted least squares (IWLS), designed specifically for the sparse design matrices that arise in spatial interaction and geographic weighted regression problems. The package trades some diagnostic breadth for computational efficiency and sparse-matrix support, making it a specialized tool for spatial statistics rather than a general-purpose GLM framework.
The package depends on numpy, scipy, libpysal, and spreg, and is maintained as part of the PySAL ecosystem. It supports Python 3.9 and later and installs with low friction. The implementation solves least-squares normal equations directly rather than using pseudo-inverse methods, which the authors note is less robust for ill-conditioned data; for more comprehensive GLM functionality they recommend the original Statsmodels package.
Use it for
- Fit Poisson or Logistic models to sparse spatial interaction matrices in transportation or migration studies.
- Estimate geographic weighted regression (GWR) components with sparse design matrices.
- Perform QuasiPoisson regression when overdispersion is present in count data.
- Compute GLM diagnostics (residuals, fitted values, deviance) for sparse regression problems.
- Build spatial statistical models as part of a PySAL-based analysis pipeline.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are working with sparse generalized linear models in a spatial statistics context (especially within PySAL).
Install with caution if you need robust estimation of ill-conditioned data—the package's direct normal-equation solver is not the most numerically stable approach; Statsmodels is better for that. No known vulnerabilities and active maintenance make it a safe dependency.
Install
spglm on PyPI
Before you install
Low friction: pure Python wheel with four standard dependencies (numpy, scipy, libpysal, spreg). Actively maintained as of July 2026 with no known vulnerabilities.
Requires Python 3.9 or later.
License in practice
BSD 3-Clause permissive license allows commercial and private use with attribution; no restrictions on derivative works.
Quickstart
pip install spglm
import spglm
from spglm.glm import GLM
model = GLM(y, X, family=spglm.family.Gaussian())
results = model.fit()
Verify before relying
- Whether the package is actively used in production spatial analysis workflows beyond PySAL ecosystem.
- Performance characteristics and scalability limits for very large sparse matrices.
- Availability and completeness of documentation beyond the homepage.
Package facts
| License | BSD 3-Clause permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packageslibpysalnumpyscipyspreg |
| Maintenance | Actively maintained 1,024 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 103,036 / month, #12,832 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: GIS |
Evidence: spglm-1.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “sparse generalized linear models”
- spglmFits Gaussian, Poisson, QuasiPoisson, and Logistic generalized linear…
- glumglum is a high-performance Python library for fitting generalized…
- dask-glmDistributed generalized linear model fitting using Dask for parallel…
Give your agent the search over MCP, or paste the wish link into any chat.
More GIS packages
Shapely provides Python tools for creating, manipulating, and analyzing 2D geometric objects (points, lines, polygons) using the GEOS library, with both scalar and vectorized NumPy-based operations.
pyproj provides a Python interface to PROJ, enabling cartographic projections and coordinate system transformations for geospatial applications.
GeoPandas extends pandas DataFrames to handle geographic data, combining pandas operations with shapely geometry and spatial analysis capabilities that would otherwise require a spatial database.
Install it if you work with geographic data in Python and want to avoid setting up a spatial database or learning a separate GIS tool.
geopy is a Python client for geocoding and distance calculation that converts addresses to coordinates and vice versa using multiple web-based geocoding services, and computes geodesic and great-circle distances between geographic points.
Install it if you need geocoding or distance calculations in your application.
Pyogrio provides fast, bulk-oriented read and write access to vector spatial data formats (Shapefile, GeoPackage, GeoJSON, etc.) via GDAL/OGR bindings, typically for use with GeoPandas GeoDataFrames.
h3 provides Python bindings to Uber's H3 geospatial indexing library, converting geographic coordinates into hierarchical hexagonal grid cells and performing spatial operations on them.
See also glum · gmr · mgwr · qdldl · spint · statsmodels · dask-glm · linearmodels · spreg · tabmat