Skip to main content

Impulso

Release Build status codecov Commit activity License

Bayesian Vector Autoregression (VAR) in Python.

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, with cross-lag scaling by relative variable scale (ADR-0015)
  • Per-variable innovation priors: Override the innovation scale prior for individual variables
  • 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
  • Embeddable VARs: Build a VAR inside an existing PyMC model with VAR.build_in_model, with symbolic observed data or latent endogenous series generated in the model under a stationarity constraint, then wrap the posterior with FittedVAR.from_posterior (see ADR-0016)
  • 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://impulso.quantclimate.com

Development

See AGENTS.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/QuantClimate/Impulso}
}

Metadata

Release files for impulso 0.1.1

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

Source distribution (sdist)

Source distribution for impulso 0.1.1
File Size Uploaded
impulso-0.1.1.tar.gz 1.2 MB Details

Built distribution (wheel)

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

Total release size: 1.4 MB

Release files / impulso-0.1.1.tar.gz

Download URL impulso-0.1.1.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
5c29a5dc6d82e7f07a6bc0e8d7a861280d05c795c130ae858b7ba4f4ae1a4b13
BLAKE2b-256 checksum
How to use checksums
29562fa33e98ef619bf2e45c489d496cc70661e2cd19ab96d96438bbad0f449f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}

Release files / impulso-0.1.1-py3-none-any.whl

Download URL impulso-0.1.1-py3-none-any.whl
Size 206.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfffb827dbfc699836acfe57d0fad77064f2510c75ef4b8a2d574e7d7a5cce73
BLAKE2b-256 checksum
How to use checksums
4cf13a704c59289c6a26a3d7a6bffed1c03d1007d238f9999d317b537157a69f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}

Release history Release notifications | RSS feed

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.14

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release 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