Skip to content

tsecon

A high-performance time series econometrics library — a Rust core with a Python-first API — built to be the centralized home for macro and financial time series work.

Most of what economists actually do — structural identification, honest inference, Bayesian VARs, local projections, nowcasting, volatility, panels — is scattered across slow, unmaintained, non-interoperable packages. tsecon brings it together: one library, fast simulation, and every estimator validated against a golden reference (statsmodels, arch, linearmodels, scikit-learn, ArviZ, SciPy) so the numbers are trustworthy, not just present.

pip install tsecon

Pre-1.0

The name is settled — tsecon is what you install and import — but the API may still change before 1.0. See the roadmap.

Start here

  • Quickstart — install and read your first impulse response in about a minute.

  • Which model when? — start from your problem ("my regressor is persistent", "I have quarterly GDP and monthly indicators") and get routed to the right function.

  • The Guide — a full course in time series econometrics, from your first autocorrelation plot to research-grade structural identification, every concept paired with code that runs.

  • Model cards & API — the assumptions, defaults, failure modes, and validation target of every estimator, plus the complete function reference.

  • Migrating? — side-by-side maps from statsmodels, R, and Stata, and a cross-package Rosetta glossary.

  • Gallery — worked figures in a professional house style: IRFs with honest bands, identified sets, forecast fans, score-driven volatility.

What's inside

126 functions callable from Python today, spanning diagnostics, unit-root and specification tests; ARIMA, GARCH, and GAS score-driven volatility; VAR / SVAR with sign-restricted identification, FAVAR, and Diebold-Yilmaz connectedness; local projections (including state-dependent and LP-IV); Bayesian VARs; GMM / IV-GMM and IVX predictive regressions; the heterogeneous-panel trio (mean-group, CCE-MG, PMG); DFM nowcasting with a ragged edge and a news decomposition; MIDAS; realized volatility; the Nelson-Siegel term structure; forecast backtesting; and leakage-safe machine learning.

Every estimator returns a plain dict, and tsecon.results adds an opt-in layer of dict subclasses that render themselves — a .summary() an economist can read and .plot_*() figures — without taking the dict away, so adopting it breaks nothing. The library ships no data loaders and makes no network calls: import tsecon depends only on NumPy, and you bring data in with whatever you already use.

Correctness is argued, not asserted. Every estimator is pinned to a golden fixture with a stated tolerance (validation matrix); statistical properties that a fixture cannot prove — test size, interval coverage, parameter recovery — are checked by a seeded Monte Carlo suite whose tables are real output; and an honest benchmark harness asserts cross-library estimate parity before it reports a single timing number.

Everything installs as a single wheel with no heavy runtime dependencies, and the whole library builds and validates from a clean checkout on every push.