🇬🇧 English · 🇪🇸 Español
Showcase notebooks
Choose an economic question, run one example, and then change an assumption.
The catalog links to executed notebooks and their editable Python sources in
both languages. The 00 notebooks describe earlier releases; they are historical
tours, not the starting point for the current package.
Choose a learning path
The numbers below refer to the linked catalog. The order within each row moves from a focused example to a broader application.
| Your question | Suggested sequence | What to examine |
|---|---|---|
| How do I identify a macroeconomic shock? | 06 → 07 → 14 → 28 | Ordering, shock units, identifying assumptions and weak instruments |
| How do I evaluate a policy intervention? | 10 → 15 → 24 → 29 → 60 | Comparison groups, estimands, uncertainty and overlap |
| How do I forecast with many indicators? | 34 → 19 → 48 → 59 | Held-out observations, a benchmark, release dates and revisions |
| How do I build an uncertainty index? | 11 → 13 → 30 → 37 | Corpus provenance, normalization and validation of the measure |
| Why does household heterogeneity matter? | 01 → 03 → 05 → 31 → 44 | Budget constraints, distributions and equilibrium feedback |
| How do I solve and estimate structural models? | 21 → 41 → 42 → 43 | Equilibrium residuals, identification and sampling diagnostics |
| Which numerical method fits my model? | 22 → 51 → 52 → 53 → 56 | Approximation error, grid sensitivity and convergence |
| How do I check a solver against a published result? | 66 → 67 → 68 → 12 | Closed forms, independent solution routes, tolerances and the evaluation criterion |
For a first session, choose one of 06, 10, 11 or 34. Each gives a specific question to answer before moving to a larger policy exercise. The course collections provide separate teaching sequences; their numbering differs from this showcase catalog.
Run and change an example
From a repository checkout, install the notebook tools and a notebook interface:
Select the kernel for that environment. Keep notebooks/_nbstyle.py beside the
showcases; several examples also use bundled files from the repository. Open an
.ipynb, restart its kernel, and run all cells before changing an exercise.
The .py files in Jupytext percent format are the editable sources. Rebuild
both languages after an edit:
python tools/build_notebooks.py 34_penalized_macro_forecasting 34_penalized_macro_forecasting_es
# Execute to temporary artifacts and validate their outputs.
python tools/build_notebooks.py --check 34_penalized_macro_forecasting 34_penalized_macro_forecasting_es
# Inspect existing artifacts without executing them.
python tools/build_notebooks.py --validate-only
--suite showcase selects the top-level showcases and notebooks/course/;
--suite curso selects curso/notebooks/. Without a name or suite, the tool
processes both suites.
Build individual examples first: simulation, bootstrap and Bayesian examples
have different computation costs. For browser execution, consult the
tablet and Pyodide guide. Local LLM inference requires a desktop
engine; its mock fallback demonstrates the interface only.
Read the evidence before the conclusion
Check the data provenance, observation units, estimand, and uncertainty measure before interpreting a chart. Country labels and realistic dates do not make simulated observations empirical evidence. Fixed seeds reproduce an experiment; they do not establish its accuracy or generality.
- 10 — DiD: the overall ATT needs uncertainty for its own aggregation. The event-study bands are pointwise. An interval can miss the planted truth in one simulated sample.
- 34 — forecasting: compare predictions for later, unused observations with a simple benchmark. In-sample fit and variable selection answer other questions.
- 48 and 59 — nowcasting: 48 holds target GDP out of bridge estimation and labels its single-vintage projection contributions as diagnostics. Exact news attribution requires two information sets under a fixed model, as in 59. Its separate simulated PIT experiment does not validate the actual nowcast densities. These are synthetic examples, not official forecasts.
- 50 — fiscal analysis: identify the shock before interpreting an impulse response as a multiplier. Debt ratios, percentage points and decimal changes must use consistent units; the debt scenarios impose their own assumptions.
- 66 — optimal policy: the closed-form checks show that the policy solvers
implement the Clarida–Galí–Gertler formulas at any admissible calibration.
By default
stabilization_biascompares unconditional losses. At low discount factors that criterion ranks timeless commitment below discretion, although commitment still wins when the loss is evaluated from the steady state, whichloss_criterion="conditional"does. - 67 — Bewley classics: Aiyagari's Table I is reproduced exactly and every ordering in Aiyagari's Table II and Huggett's tables holds, but their decimals differ by more than the notebook's numerical error. At high persistence, the choice of Markov chain moves Aiyagari's rates by more than those differences.
- 68 — third order: matching simulated paths does not show that a tensor is right; the notebook compares every tensor with closed forms and with live Dynare output. The exact pruned moments match a closed form and Dynare's means and variances. Dynare's order-3 autocorrelations do not: a closed form and Dynare's own long simulations both reject them. Skewness and kurtosis still come from simulations.
The notebook template connects a motivating question, equations, intuition, runnable code, output interpretation, an exercise and related examples. Use its evidence checklist when adapting an example to your own data. Copy runnable code from the linked sources, where inputs, seeds and diagnostics appear together.
Complete showcase catalog
Each title opens an executed notebook; “source” opens its editable .py file.
| Notebook | Question and method | Spanish edition |
|---|---|---|
| 00_whats_new_in_puremacro_3_0 · source | Milestone 3.0: Analytic Kalman gradients, NUTS HMC, and HANK Sequence-Space bridge | 00_whats_new_in_puremacro_3_0_es · source |
| 00_whats_new_in_puremacro_2_0 · source | Milestone 2.0: Unified API (lags, horizon, ci), result objects, and exporters |
00_whats_new_in_puremacro_2_0_es · source |
| 01_wealth_inequality · source | Aiyagari & Huggett incomplete markets, permanent \(\beta\)-heterogeneity, Lorenz & Gini | 01_wealth_inequality_es · source |
| 02_aggregate_shocks · source | Krusell–Smith approximate aggregation, transition dynamics, representative-agent benchmark | 02_aggregate_shocks_es · source |
| 03_life_cycle_and_demographics · source | Finite-horizon life-cycle consumption-saving, cohort wealth by age, mortality weighting | 03_life_cycle_and_demographics_es · source |
| 04_firm_dynamics · source | Hopenhayn industry equilibrium with endogenous entry/exit and selection | 04_firm_dynamics_es · source |
| 05_portfolios_and_preferences · source | Two-asset portfolio choice, Epstein–Zin recursive utility, EGM vs VFI | 05_portfolios_and_preferences_es · source |
| 06_svar_identification · source | Structural VAR identification: Cholesky recursive ordering vs sign restrictions | 06_svar_identification_es · source |
| 07_local_projections · source | Jordà Local Projections with Newey-West HAC inference & state-dependent IRFs | 07_local_projections_es · source |
| 08_garch_volatility · source | Pure-NumPy GARCH(1,1) MLE & Engle Dynamic Conditional Correlation (DCC) | 08_garch_volatility_es · source |
| 09_growth_at_risk · source | Adrian-Boyarchenko-Giannone Growth-at-Risk via quantile autoregression & skew-\(t\) fitting | 09_growth_at_risk_es · source |
| 10_staggered_did · source | Staggered DiD with pointwise event-study bands and a unit-bootstrap interval for overall ATT | 10_staggered_did_es · source |
| 11_narrative_uncertainty · source | Pure-NumPy Economic Policy Uncertainty (EPU) text index construction | 11_narrative_uncertainty_es · source |
| 12_validation_gallery · source | Validation scorecard comparing puremacro implementations against independent references | 12_validation_gallery_es · source |
| 13_build_your_own_index · source | Four index recipes: text EPU, simplified JLN-style uncertainty, FCI and comovement | 13_build_your_own_index_es · source |
| 14_tax_multiplier_three_ways · source | US tax multiplier: Blanchard-Perotti SVAR, Romer-Romer narrative LP, Mertens-Ravn proxy-SVAR | 14_tax_multiplier_three_ways_es · source |
| 15_lp_did · source | Local Projections Difference-in-Differences (LP-DiD) under staggered treatment | 15_lp_did_es · source |
| 16_regime_girf · source | Generalized Impulse Response Functions (GIRF) for threshold VAR / Markov-switching VAR | 16_regime_girf_es · source |
| 18_beveridge_curve · source | Beveridge curve dynamics, matching efficiency, and vacancy-unemployment shifts | 18_beveridge_curve_es · source |
| 19_model_confidence_set · source | Hansen-Lunde-Nason Model Confidence Set (MCS) for competitive forecasting | 19_model_confidence_set_es · source |
| 20_unit_roots_with_power · source | Elliott-Rothenberg-Stock DF-GLS and Ng-Perron high-power unit root tests | 20_unit_roots_with_power_es · source |
| 21_dynare_vfi_dsl · source | Declarative dynamic programming with puremacro.dp: precautionary savings, the exact wealth Gini and a simulated panel |
21_dynare_vfi_dsl_es · source |
| 22_continuous_time_hjb · source | Achdou et al. (2022) Continuous-Time Hamilton-Jacobi-Bellman finite difference scheme | 22_continuous_time_hjb_es · source |
| 23_aiyagari_endogenous_labor · source | General equilibrium incomplete markets with endogenous labor supply choice | 23_aiyagari_endogenous_labor_es · source |
| 24_synthetic_control · source | Abadie et al. Synthetic Control Method with in-space and in-time placebo tests | 24_synthetic_control_es · source |
| 25_frequency_connectedness · source | Baruník & Křehlík frequency-domain variance decomposition spillover networks | 25_frequency_connectedness_es · source |
| 26_cycles_and_bandpass · source | Baxter-King, Christiano-Fitzgerald, and Beveridge-Nelson cycle filtering | 26_cycles_and_bandpass_es · source |
| 27_garch_midas_macro_risk · source | Engle-Ghysels-Sohn GARCH-MIDAS mixed-frequency volatility modeling | 27_garch_midas_macro_risk_es · source |
| 28_weak_iv_anderson_rubin · source | Anderson-Rubin weak-instrument robust confidence sets for LP-IV | 28_weak_iv_anderson_rubin_es · source |
| 29_synthetic_did · source | Arkhangelsky et al. Synthetic Difference-in-Differences (SDID) | 29_synthetic_did_es · source |
| 30_narrative_bursts_and_transcripts · source | Kleinberg burst detection on central bank speech transcripts | 30_narrative_bursts_and_transcripts_es · source |
| 31_sequence_space_hank · source | Auclert et al. (2021) Sequence-Space Jacobian method for HANK models | 31_sequence_space_hank_es · source |
| 32_climate_macro_dice · source | Nordhaus DICE integrated assessment model & optimal carbon tax policy | 32_climate_macro_dice_es · source |
| 33_gdp_nowcasting_news · source | Single-vintage PCA/bridge demonstration; use 48 for a held-out target | 33_gdp_nowcasting_news_es · source |
| 34_penalized_macro_forecasting · source | Elastic Net and Adaptive Lasso with chronological holdout forecasts and a benchmark | 34_penalized_macro_forecasting_es · source |
| 35_empirical_benchmark_replications · source | Replication scorecard across SVAR, LP, and DiD benchmark literatures | 35_empirical_benchmark_replications_es · source |
| 36_climate_sovereign_debt_risk · source | Physical and transition climate risk transmission to sovereign debt sustainability | 36_climate_sovereign_debt_risk_es · source |
| 37_central_bank_narrative_sentiment · source | Central bank communication sentiment scoring and high-frequency monetary LP | 37_central_bank_narrative_sentiment_es · source |
| 38_real_time_vintages_and_revisions · source | Vintage and revision diagnostics; distinguish simulated examples from provider coverage | 38_real_time_vintages_and_revisions_es · source |
| 39_multilingual_narrative_harvesting · source | Multi-source narrative harvesting (50+ connectors) and multilingual macro scoring | 39_multilingual_narrative_harvesting_es · source |
| 40_quarterly_national_accounts · source | Three approaches to GDP accounting: rebasing, identities, and growth contributions | 40_quarterly_national_accounts_es · source |
| 41_dynare_frontier_showcase · source | Smets-Wouters (2007) native smoother & estimation, OccBin ZLB, Ramsey transitions | 41_dynare_frontier_showcase_es · source |
| 42_dsge_bayesian_estimation_and_diagnostics · source | Flagship Smets-Wouters Bayesian estimation, mode_check, MCMC, fan charts, MDD | 42_dsge_bayesian_estimation_and_diagnostics_es · source |
| 43_dsge_nuts_and_analytic_gradients · source | Bayesian DSGE via NUTS with exact analytic Kalman score recursion | 43_dsge_nuts_and_analytic_gradients_es · source |
| 44_hank_sequence_space_bridge · source | HANK Sequence-Space bridge from .mod files, Fake-News Jacobians, MIT transitions |
44_hank_sequence_space_bridge_es · source |
| 45_dsge_discretion_dsge_var_and_news_shocks · source | Discretionary policy vs commitment, DSGE-VAR prior optimization, news shocks | 45_dsge_discretion_dsge_var_and_news_shocks_es · source |
| 46_dsge_particle_filtering_and_markov_switching · source | Differentiable OccBin for NUTS, Markov-switching DSGE, particle filtering | 46_dsge_particle_filtering_and_markov_switching_es · source |
| 47_applied_central_bank_policy_suite · source | Monetary policy stance, counterfactual Taylor rules, fan charts, sentiment | 47_applied_central_bank_policy_suite_es · source |
| 48_applied_realtime_nowcasting_and_news · source | Synthetic ragged-edge nowcast with held-out GDP, projection diagnostics and revision tests | 48_applied_realtime_nowcasting_and_news_es · source |
| 49_applied_macroprudential_gar_and_stress · source | Growth-at-Risk quantile densities (skew-\(t\)), systemic connectedness networks | 49_applied_macroprudential_gar_and_stress_es · source |
| 50_applied_fiscal_multipliers_and_debt_sustainability · source | Frozen US fiscal data, narrative tax instruments and stochastic debt scenarios with explicit units | 50_applied_fiscal_multipliers_and_debt_sustainability_es · source |
| 51_continuous_projection_collocation_and_fem · source | Continuous state-space DP: Chebyshev orthogonal collocation vs FEM Galerkin with borrowing kinks | 51_continuous_projection_collocation_and_fem_es · source |
| 52_continuous_transition_mit_shocks · source | Non-linear continuous transition dynamics & MIT shocks via coupled EGM-Young operator | 52_continuous_transition_mit_shocks_es · source |
| 53_exact_analytic_ift_gradients · source | IFT parameter sensitivities, adjoints and comparison with finite differences | 53_exact_analytic_ift_gradients_es · source |
| 54_deep_macro_pinns_high_dim · source | High-dimensional dynamic models (10+ states) via pure-NumPy Physics-Informed Neural Networks | 54_deep_macro_pinns_high_dim_es · source |
| 56_implicit_hjb_and_continuous_kfe · source | Continuous-time HJB implicit upwind solver, adjoint KFE stationary wealth density & Aiyagari GE | 56_implicit_hjb_and_continuous_kfe_es · source |
| 57_multiconstraint_occbin_and_dml · source | Multi-constraint OccBin (\(M \ge 2\): ZLB + credit limits) & Double Machine Learning (DML-PLR) | 57_multiconstraint_occbin_and_dml_es · source |
| 58_latin_america_realtime_macro · source | Simulated Latin American vintages, portable .pmz cartridges and news/noise diagnostics | 58_latin_america_realtime_macro_es · source |
| 59_latam_realtime_nowcast_and_news · source | Synthetic Latin America nowcasting, vintage news attribution and a separate PIT experiment | 59_latam_realtime_nowcast_and_news_es · source |
| 60_interactive_dml_irm_and_iv · source | Interactive Double ML: IRM (ATE/ATT) with regularized logistic CD, propensity overlap & DML-IV | 60_interactive_dml_irm_and_iv_es · source |
| 66_optimal_policy_cgg1999_replication · source | Replication of Clarida–Galí–Gertler (1999): discretion, simple-rule and timeless commitment against closed forms, and the loss criterion | 66_optimal_policy_cgg1999_replication_es · source |
| 67_bewley_classics_replication · source | Replication of Huggett (1993) and Aiyagari (1994): Table I exactly, the equilibrium tables' orderings, their decimals against numerical error, and the Markov chain | 67_bewley_classics_replication_es · source |
| 68_third_order_perturbation_trust · source | Third-order perturbation checked against closed forms and live Dynare 7.0, a tensor error no path can see, and what the checked third order says | 68_third_order_perturbation_trust_es · source |
| local_llm_uncertainty · source | Local inference with optional desktop engines; offline mock fallback | local_llm_uncertainty_es · source |