Skip to main content

Impulso

Release Build status codecov Commit activity License

Bayesian Vector Autoregression (VAR) in Python.

🚧 Experimental — under heavy development. This project is an experiment in AI-driven software development. The vast majority of the code, tests, and documentation were written by AI (Claude Code). Humans direct architecture, priorities, and design decisions, but have not reviewed most of the code line-by-line. Treat this accordingly — there will be bugs, rough edges, and things that don't work.

We currently have some availability for consulting on how Bayesian modelling, vector autoregressions, and impulso can be integrated into your team's macroeconomic and financial forecasting work. If this sounds relevant, book an introductory call. These calls are for consulting inquiries only. For technical usage questions and free community support, please use GitHub Discussions and the documentation.

Overview

impulso provides a modern, Pythonic interface for Bayesian Vector Autoregression modeling. Built on PyMC, it enables full posterior inference for VAR models with informative priors, structural identification, impulse response analysis, and forecast error variance decomposition.

Core Pipeline

The library follows an immutable, type-safe pipeline:

VARData → VAR.fit() → FittedVAR → .set_identification_strategy() → IdentifiedVAR
  • VARData: Validated time series data (endogenous/exogenous variables + DatetimeIndex)
  • VAR: Model specification (lags, priors, exogenous variables)
  • FittedVAR: Reduced-form posterior estimates with forecasting capabilities
  • IdentifiedVAR: Structural VAR with impulse responses, FEVD, and historical decomposition

Key Features

  • Full Bayesian inference via PyMC (NUTS sampling, automatic diagnostics)
  • Minnesota priors for regularization in high-dimensional VARs
  • Flexible identification schemes: Recursive (Cholesky), sign restrictions
  • Forecasting: Point forecasts, credible intervals, and scenario analysis
  • Impulse response functions (IRFs) with uncertainty quantification
  • Forecast error variance decomposition (FEVD)
  • Historical decomposition of variables into structural shocks
  • Dynamic multipliers: Response of endogenous variables to exogenous (VARX) drivers
  • Extensible protocols: Plug in custom priors, samplers, and identification schemes
  • Type-safe: Frozen Pydantic models with full type hints

Installation

pip install impulso

Or with uv:

uv pip install impulso

Faster sampling with nutpie

For significantly faster NUTS sampling, install with the optional nutpie backend:

pip install "impulso[nutpie]"

Or with uv:

uv add impulso --extra nutpie

When nutpie is installed, it is used automatically as the default sampler. You can also select the backend explicitly:

from impulso.samplers import NUTSSampler

sampler = NUTSSampler(nuts_sampler="nutpie")   # or "pymc"
fitted = var.fit(data, sampler=sampler)

Quick Start

import pandas as pd
from impulso import VARData, VAR

# Load your time series data
df = pd.read_csv("data.csv", index_col="date", parse_dates=True)

# Create validated VAR data
data = VARData.from_df(df, endog_vars=["gdp", "inflation", "interest_rate"])

# Specify and fit a VAR(4) model with Minnesota prior
var = VAR(lags=4, prior="minnesota")
fitted = var.fit(data)

# Generate forecasts
forecast = fitted.forecast(steps=12)
forecast.plot()

# Structural identification and impulse responses
identified = fitted.set_identification_strategy("cholesky")
irf = identified.impulse_response(steps=20)
irf.plot()

# Forecast error variance decomposition
fevd = identified.fevd(steps=20)
fevd.plot()

Documentation

Full documentation, tutorials, and API reference: https://thomaspinder.github.io/impulso

Development

See CLAUDE.md for development setup, testing, and contribution guidelines.

License

MIT License. See LICENSE for details.

Citation

If you use impulso in your research, please cite:

@software{impulso,
  author = {Pinder, Thomas},
  title = {impulso: Bayesian Vector Autoregression in Python},
  year = {2026},
  url = {https://github.com/thomaspinder/impulso}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

impulso-0.0.8.tar.gz (573.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

impulso-0.0.8-py3-none-any.whl (100.3 kB view details)

Uploaded Python 3

File details

Details for the file impulso-0.0.8.tar.gz.

File metadata

  • Download URL: impulso-0.0.8.tar.gz
  • Upload date:
  • Size: 573.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for impulso-0.0.8.tar.gz
Algorithm Hash digest
SHA256 0f2e1185c1d3cdaa12791de5c6a1ecf6ccf40811927288d0d3f3ef7d6391430f
MD5 afc0382b098fb4943cc49d751a4925cc
BLAKE2b-256 25d2adb5bc724916010c66c78403efb235e9847c4b05944c660851c1a4edc1ff

See more details on using hashes here.

File details

Details for the file impulso-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: impulso-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 100.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for impulso-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 252dcee04c9dde4307a1670b125712130607327cb5b38d987cc307c5d8477ce5
MD5 bfbd5f20ffb9a53358f2d66170dd983d
BLAKE2b-256 49406dc139dd7e300c15d2c846ba1b6305a87ba5192fe4cce85c4dc0e80df708

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

This release

0.0.8 This release

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

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