Cookbook
Short, single-task pages. One question, one runnable answer, under thirty lines
of code, with the real output printed underneath. If you know what you want to
do and just need the call that does it, start here.
Every block on every page was executed against the installed library and the
output pasted verbatim. Each recipe stands alone — the data are simulated in
the snippet with a fixed seed, so you can paste any page into a fresh
interpreter with nothing but pip install tsecon and reproduce the numbers
exactly.
Not sure which model your problem calls for? Start at
Which model when?. Want the ideas rather than the
call? That is the Guide. Want the assumptions, defaults,
and failure modes of a specific estimator? That is a
model card.
Diagnostics — before you model anything
Inference — standard errors that survive review
Systems — VARs, forecasts, and identification
Causal effects
Risk and volatility
Reporting
Conventions in every recipe
- Arrays in, dicts out. Every estimator takes plain arrays (or anything
array-like — pandas Series and DataFrames are coerced) and returns a
dict
of documented keys. There is no fit/predict object to construct.
- You supply the constant. Functions taking a design matrix (
ols,
sup_f_test, bai_perron, recession_probit) use x exactly as given.
alpha is the non-coverage. alpha=0.10 is a 90% band, alpha=0.05 a
95% one.
- Seeds are arguments, not globals. Anything stochastic — bootstraps,
rotation draws, posterior sampling — takes a
seed. Report it.
- No data loaders, no network calls.
import tsecon depends only on NumPy;
you bring the data.
Missing a recipe you expected to find? Open an issue — the list is demand-driven.