Jorge Alonso-Ortiz

Jorge Alonso Ortiz

Research, teaching, opinions… and dogs

puremacro

4,984

automated tests, run on three operating systems and three Python versions

91

worked examples and real-data replications

33

notebooks you can run in the browser, each with a Spanish twin

0

compiled extensions of its own: pure Python on NumPy and SciPy

Gallery · From Stata & Dynare · Run it anywhere · Documentation · Changelog

Why puremacro

Built at ITAM–CIE for research and teaching, and engineered like production software.

PURE PYTHON

No compiler, no licence

The estimator core imports only NumPy, SciPy, pandas and Matplotlib. Nothing to compile, no MATLAB or Stata licence, MIT-licensed.

RUNS ANYWHERE

Laptop, browser, iPad

The same code runs locally, in JupyterLite and under Pyodide. Heavy jobs offload to Google Colab; long bootstraps resume after the app is suspended.

SPEAKS DYNARE

Bring your .mod files

Load native Dynare models, solve to second order with pruning, handle the ZLB with OccBin and get oo_.dr-compatible decision rules.

PUBLICATION-READY

From estimate to LaTeX

Every estimator returns a result object with .summary(), .plot(), .to_latex(), .to_typst() and .to_markdown().

What it can do

Fifty-two subpackages covering the empirical and structural toolkit of modern macroeconomics.

VARs & identification

VARs & identification

Cholesky, long-run, sign and zero, narrative, proxy-IV, heteroskedasticity and non-Gaussian identification, with bootstrap and Bayesian bands.

Open the notebook in your browser →

Local projections & inference

Local projections & inference

LP-HAC, LP-IV, lag-augmented, panel, state-dependent, smooth and quantile LPs, with HAC, fixed-b and weak-IV-robust inference.

Open the notebook in your browser →

DSGE & Bayesian estimation

DSGE & Bayesian estimation

Native .mod files, second-order pruning, OccBin, perfect foresight, and NUTS sampling with exact likelihood gradients.

Open the notebook in your browser →

Heterogeneous agents

Heterogeneous agents

Sequence-space HANK with the Fake News algorithm, plus Aiyagari, Krusell–Smith, life-cycle and firm-dynamics models.

Open the notebook in your browser →

Data, nowcasting & text

Data, nowcasting & text

FRED, OECD, IMF and ECB fetchers, real-time vintages, dynamic-factor nowcasts and text-based uncertainty indices.

Open the notebook in your browser →

Climate, risk & forecasting

Climate, risk & forecasting

A DICE climate-macro simulator, growth-at-risk, GARCH-MIDAS, BVAR fan charts and penalized forecasting.

Open the notebook in your browser →

Classic results, reproduced

Real-data replications ship with the package on frozen data snapshots and run fully offline. A built-in scorecard checks puremacro against each paper’s published numbers.

from puremacro.replication import scorecard

df = scorecard()      # puremacro vs each paper's published target
df["passed"].all()

Every case compares puremacro’s estimate with the number printed in the paper, so a regression shows up as a failed row, not a silently different figure.

Coming from Stata, MATLAB or Dynare?

The commands you know, and their puremacro equivalents.

TaskStata / MATLAB / Dynarepuremacro
Cholesky SVARvar y1 y2, lags(1/4) + irf createvar.identify.cholesky_svar(Y, p=4, horizon=20)
Local Projections (HAC)jorda / manual OLSlp.lp_hac(df, y="y", x="shock", horizon=20, lags=4)
Staggered DiDcsdid y, ivar(id) time(t) gvar(g)did.callaway_santanna(df, unit="id", time="t", outcome="y", treat_time="g")
DSGE from equations / .modDynare .mod filedsge.load_mod("rbc.mod") / dsge.build_dynare(eqs)
Bayesian DSGE (MCMC)Dynare estimation(...) (Metropolis-Hastings)dsge.estimate_dsge_bayesian(m, data, priors, n_draws=10000)

ENGINEERED FOR CORRECTNESS

Numbers you can defend

Research code has to be right before it is fast. puremacro treats correctness as a feature.

  • Every push runs the full test suite on three operating systems and three Python versions, plus mypy and a Pyodide-compatibility contract.
  • A validation gallery cross-checks estimators against statsmodels, linearmodels and arch.
  • A replication scorecard compares results with each paper’s published numbers.
  • Clear diagnostic errors instead of silent garbage: singular matrices, non-positive-definite covariances and Blanchard–Kahn violations say what went wrong and where.
  • Any released version that returned a wrong number is listed in a public correctness advisory.