Overview · Gallery · From Stata & Dynare · Run it anywhere
Coming from Stata, MATLAB or Dynare?
A Rosetta Stone for macroeconomists: the command you already know, next to its puremacro equivalent.
| Task / Estimator | Stata | MATLAB / Dynare | statsmodels / linearmodels | puremacro |
|---|---|---|---|---|
| Cholesky SVAR | var y1 y2, lags(1/4) + irf create | varm / VAR Toolbox | VAR(Y).fit(4).irf(20) | var.identify.cholesky_svar(Y, p=4, horizon=20) |
| Blanchard–Quah SVAR | svar y1 y2, lreq(...) | VAR Toolbox bq_svar | SVAR(..., svar_type='B') | var.identify.bq_svar(Y, p=4, horizon=20) |
| Sign Restrictions | User plugin | Rubio-Ramírez / VAR Toolbox | — | var.identify.sign_restrictions(Y, restrictions={0: [+1, -1]}, p=4) |
| Proxy / External IV SVAR | svariv | Mertens & Ravn SVAR-IV | — | var.identify.proxy_svar(Y, p=4, instrument_series=z) |
| Local Projections (HAC) | jorda / manual OLS | Jordà (2005) code | OLS(y_h, X).fit(cov_type='HAC') | lp.lp_hac(df, y="y", x="shock", horizon=20, lags=4) |
| State-Dep LP-IV (Ramey-Zubairy) | manual 2SLS interaction | — | — | lp.lp_state_dep_iv(df, y="y", x="g", z="news", state="u") |
| Panel LP (Driscoll–Kraay) | xtscc | Panel LP toolbox | PanelOLS(..., cov_type='driscoll-kraay') | lp.panel_lp_dk(df, y="y", x="z", unit_col="id", time_col="t") |
| Dynamic Panel GMM | xtabond2 y L.y, gmm(y) two robust | Arellano–Bond MATLAB | — | dynpanel.ab_gmm(y, panel_id, time_id, two_step=True, windmeijer=True) |
| Staggered DiD | csdid y, ivar(id) time(t) gvar(g) | — | — | did.callaway_santanna(df, unit="id", time="t", outcome="y", treat_time="g") |
| Synthetic DiD | sdid y id t d | synthdid R package | — | did.synthetic_did(df, unit="id", time="t", outcome="y", treat_time="g") |
| Factor-Augmented VAR (FAVAR) | — | BBE (2005) MATLAB | — | var.favar(panel_df, policy_series, n_factors=3, horizon=20) |
| Value Function Iteration | — | VFIToolkit ValueFnIter_Case1 | — | vfi.VFIProblem(a_grid, z_grid, P_z, return_fn, beta).solve() |
| Linear DSGE (QZ / BK) | — | Dynare stoch_simul / Klein solab | — | dsge.klein.klein_solve(A, B, C, n_pre=...) |
| DSGE from equations / .mod | — | Dynare .mod file | — | dsge.load_mod("rbc.mod") / dsge.build_dynare(eqs) |
| DSGE 2nd-Order Pruning | — | Dynare stoch_simul(order=2, pruning) | — | dsge.build_dynare(eqs, order=2) / m.solve_second_order() |
puremacro-dynare CLI | — | dynare model.mod command-line | — | puremacro-dynare model.mod --order 2 --fevd --plot |
| OccBin (ZLB / piecewise) | — | Dynare occbin_solver / Guerrieri & Iacoviello | — | dsge.solve_occbin(m_normal, m_zlb, constraint, shocks) |
| Non-Linear Perfect Foresight | — | Dynare simul (Boucekkine-Juillard) | — | dsge.solve_perfect_foresight(m, shocks, T=100) |
| Bayesian DSGE (MCMC) | — | Dynare estimation(...) (Metropolis-Hastings) | — | dsge.estimate_dsge_bayesian(m, data, priors, n_draws=10000) |
| Sequence-Space Fake News | — | SSJ (Auclert et al. 2021) Python/Julia | — | models.fake_news_algorithm(T=40) / models.simulate_targeted_transfer(...) |
| GLS Unit Root (DF-GLS) | dfgls y, maxlag(4) | ERS (1996) code | adfuller | unit_root.dfgls_test(y, regression="ct") |
| Seasonal Adjustment | x13 y | X-13 wrapper | STL / x13 | sa.stl_sa(y) / sa.x11_sa(y) |
Every puremacro call returns a result object with .summary(), .plot() and .to_latex(), so the last step to a paper table is one line.
Bring your Dynare model as it is
Pass a native .mod file, or its text, and solve it to second order with pruning.
from puremacro.dsge import load_mod
model = load_mod("rbc.mod") # a path, or the .mod source text
sol = model.solve(order=2) # 2nd-order pruned perturbation
print(sol.oo_dr["ghx"]) # Dynare-style decision rules
print(sol.theoretical_moments().to_latex())
Or from the terminal: puremacro-dynare model.mod --order 2 --fevd --plot
