Skip to main content

neighbayes

Continuous Integration codecov

neighbayes is a Python package for Bayesian estimation of spatial econometric models. Every model is a class, and specified with a Wilkinson formula via formulaic and a PySAL Graph (or any scipy.sparse matrix) for the spatial weights $W$; fit() returns an arviz.InferenceData, so the standard posterior tooling (az.plot_trace, az.compare, az.loo) works without translation (though exercise caution as WAIC/LOO diagnostics aren't valid for spatial models).

import libpysal
from neighbayes.dgp import simulate_sar
from neighbayes.models import OLS, SAR

gdf = simulate_sar(n=400, beta=[1, 0.4, 2.5], rho=0.6, create_gdf=True)
G = libpysal.graph.Graph.build_contiguity(gdf).transform("r")
form = "y ~ -1 + X_0 + X_1 + X_2"

# start with a baseline OLS and test the residuals for spatial dependence
ols = OLS(formula=form, W=G, data=gdf)
ols.fit()
print(ols.spatial_diagnostics_decision(format="ascii"))

# the diagnostics point to SAR here, so fit it and decompose the spillovers
sar = SAR(formula=form, W=G, data=gdf)
sar.fit(draws=2000, chains=4, random_seed=42)
sar.summary()
sar.spatial_effects()

neighbayes provides roughly fifty model classes behind one formula interface, each with a matching simulator in neighbayes.dgp. Every fit comes with Bayesian LM diagnostics (with a decision tree for specification search) and posterior decompositions of direct, indirect, and total effects. Every model (almost) has a custom Gibbs sampler for better mixing (with both numby and jax implementations), but can fall back to PyMC if requested.

Installation

conda install -c conda-forge neighbayes   # or: pip install neighbayes

Requires Python 3.12+. The installation guide covers development installs and the optional JAX backend.

Documentation

Model-by-model user guides, the diagnostics battery, effects interpretation, and the API reference are at pysal.org/neighbayes.

Validation

Every model includes thorough parameter recovery tests, and samplers have been validated against maximum likelihood estimators as well as published results (see docs).

Metadata

Release files for neighbayes 0.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neighbayes 0.0.0
File Size Uploaded Provenance Actions
neighbayes-0.0.0.tar.gz 5.7 MB With provenance Details for neighbayes-0.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neighbayes 0.0.0
File Interpreter ABI Platform Actions
neighbayes-0.0.0-py3-none-any.whl Python 3 none any Details for neighbayes-0.0.0-py3-none-any.whl

Total release size: 6.8 MB

Release files / neighbayes-0.0.0.tar.gz

Download URL neighbayes-0.0.0.tar.gz
Size 5.7 MB
Tags Source
SHA-256 checksum
How to use checksums
bc78ccb7de851d6fb17f544cfc47f0053cca4c13f1a5a8545bf98cf40af7504d
BLAKE2b-256 checksum
How to use checksums
23b70b57b5f95a565918d7203c533f7cd5bbdcc49e560ef7d0913e33d7928258
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / neighbayes-0.0.0-py3-none-any.whl

Download URL neighbayes-0.0.0-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
20c226cdacbe6196d8fc9cf0decadd1f326d3e2c493fd6d9923ec472b79fdbff
BLAKE2b-256 checksum
How to use checksums
9c3644050e234fda8da1d83ebf1844b4fcd02dc750daf9e07c6b26ca9d2ce5f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Security for neighbayes 0.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for neighbayes-0.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page