bayesloop 2.0
Time series models with parameters that
change over time
bayesloop is a Python library for Bayesian inference on time series. It tracks time-varying parameters, detects change-points and structural breaks, and objectively compares competing models via the marginal likelihood — using fast grid-based computation instead of MCMC sampling.
pip install bayesloop
No MCMC, no tuning
Parameter distributions live on a discrete, regular grid — computing the model evidence reduces to a simple sum over all lattice points.
Sequential inference
Fitting time step by time step breaks one high-dimensional inference problem into many low-dimensional ones — for retrospective and online analyses alike.
Simple models, time-varying
Well-known statistical models with few parameters, extended so that those parameters may change over time — new insights on a solid statistical foundation.
New in 2.0
Faster fits with likelihood caching, parallel hyper-studies via joblib, and a drop-in compatibility layer for 1.x scripts.
Why bayesloop?
Real-world systems rarely keep their statistical properties constant. bayesloop embraces that: it treats model parameters as dynamic quantities and infers how they evolve — together with the evidence you need to decide between competing hypotheses.
Time-varying parameters
Infer full posterior distributions of model parameters at every single time step — not just point estimates.
Model selection
Compare hypotheses about parameter dynamics on objective grounds, via the marginal likelihood (model evidence).
Custom models
Build observation models from SymPy random variables, SciPy distributions or plain NumPy functions.
Change-point detection
Locate abrupt changes and structural breaks — including full uncertainty about when they happened.
Online studies
Feed in data point by point and run real-time model selection on streaming data.
Missing data
NaN values are handled natively by the inference algorithm — no imputation gymnastics required.
Try it — right here, right now
This playground runs a complete bayesloop analysis entirely in your browser via Pyodide (Python compiled to WebAssembly). Nothing is sent to a server. The example below analyses the classic UK coal mining disaster record: did mine safety really improve at the end of the 19th century — and how quickly? Edit the code, press Run, and find out.
First run downloads the Python runtime (~40 MB) — subsequent runs are instant.
Output will appear here…
Pre-rendered result — press Run to compute it live in your browser.
Built for research
bayesloop has been employed in cancer research (migration paths of invasive tumor cells), financial risk assessment, climate research and accident analysis.
Nature Communications 9:1803 (2018)
Bayesian model selection for complex dynamic systems
Nature Communications 6:7516 (2015)
Superstatistical analysis and modelling of heterogeneous random walks
PNAS 123(11):e2524427123 (2026)
Immune cells employ intermittent integrin-mediated traction forces for 3D migration
Nature Methods 13:171–176 (2016)