puremacro 0.92.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- puremacro-0.92.0/LICENSE +21 -0
- puremacro-0.92.0/PKG-INFO +363 -0
- puremacro-0.92.0/README.md +304 -0
- puremacro-0.92.0/puremacro/__init__.py +8 -0
- puremacro-0.92.0/puremacro/_backend.py +92 -0
- puremacro-0.92.0/puremacro/_cache_db.py +216 -0
- puremacro-0.92.0/puremacro/_codes.py +31 -0
- puremacro-0.92.0/puremacro/_http.py +198 -0
- puremacro-0.92.0/puremacro/_http_cache.py +158 -0
- puremacro-0.92.0/puremacro/_linalg.py +131 -0
- puremacro-0.92.0/puremacro/bartik/__init__.py +14 -0
- puremacro-0.92.0/puremacro/bartik/county_epu.py +84 -0
- puremacro-0.92.0/puremacro/bartik/exposure_iv.py +110 -0
- puremacro-0.92.0/puremacro/bartik/sensitivity.py +98 -0
- puremacro-0.92.0/puremacro/bartik/shares.py +119 -0
- puremacro-0.92.0/puremacro/bis_neer.py +154 -0
- puremacro-0.92.0/puremacro/build_panel.py +841 -0
- puremacro-0.92.0/puremacro/build_subnational_panel.py +559 -0
- puremacro-0.92.0/puremacro/cache.py +158 -0
- puremacro-0.92.0/puremacro/climate/__init__.py +25 -0
- puremacro-0.92.0/puremacro/climate/annual_lp.py +75 -0
- puremacro-0.92.0/puremacro/climate/degree_days.py +73 -0
- puremacro-0.92.0/puremacro/climate/mediation.py +120 -0
- puremacro-0.92.0/puremacro/climate/monthly_dl.py +201 -0
- puremacro-0.92.0/puremacro/cointegration_modern.py +355 -0
- puremacro-0.92.0/puremacro/connectedness/__init__.py +4 -0
- puremacro-0.92.0/puremacro/connectedness/diebold_yilmaz.py +109 -0
- puremacro-0.92.0/puremacro/credentials.py +188 -0
- puremacro-0.92.0/puremacro/cross_nest.py +390 -0
- puremacro-0.92.0/puremacro/cycles.py +86 -0
- puremacro-0.92.0/puremacro/data.py +179 -0
- puremacro-0.92.0/puremacro/did/__init__.py +49 -0
- puremacro-0.92.0/puremacro/did/_results.py +314 -0
- puremacro-0.92.0/puremacro/did/borusyak_jaravel_spiess.py +192 -0
- puremacro-0.92.0/puremacro/did/callaway_santanna.py +196 -0
- puremacro-0.92.0/puremacro/did/cdh.py +344 -0
- puremacro-0.92.0/puremacro/did/sdid_multi.py +269 -0
- puremacro-0.92.0/puremacro/did/sun_abraham.py +121 -0
- puremacro-0.92.0/puremacro/did/synthetic_did.py +200 -0
- puremacro-0.92.0/puremacro/did/types.py +81 -0
- puremacro-0.92.0/puremacro/dsge/__init__.py +32 -0
- puremacro-0.92.0/puremacro/dsge/_results.py +126 -0
- puremacro-0.92.0/puremacro/dsge/_sw07_data.csv +170 -0
- puremacro-0.92.0/puremacro/dsge/estimate.py +267 -0
- puremacro-0.92.0/puremacro/dsge/fertility_adj_costs.py +866 -0
- puremacro-0.92.0/puremacro/dsge/gensys.py +160 -0
- puremacro-0.92.0/puremacro/dsge/klein.py +367 -0
- puremacro-0.92.0/puremacro/dsge/load_dynare.py +125 -0
- puremacro-0.92.0/puremacro/dsge/priors.py +124 -0
- puremacro-0.92.0/puremacro/dsge/smets_wouters.py +877 -0
- puremacro-0.92.0/puremacro/dsge/sw07_estimate.py +86 -0
- puremacro-0.92.0/puremacro/dsge/sw07_observation.py +119 -0
- puremacro-0.92.0/puremacro/dsge/sw07_priors.py +108 -0
- puremacro-0.92.0/puremacro/dynpanel/__init__.py +32 -0
- puremacro-0.92.0/puremacro/dynpanel/_results.py +119 -0
- puremacro-0.92.0/puremacro/dynpanel/ab_gmm.py +334 -0
- puremacro-0.92.0/puremacro/dynpanel/bb_gmm.py +476 -0
- puremacro-0.92.0/puremacro/dynpanel/diagnostics.py +253 -0
- puremacro-0.92.0/puremacro/dynpanel/instruments.py +627 -0
- puremacro-0.92.0/puremacro/examples/__init__.py +5 -0
- puremacro-0.92.0/puremacro/examples/asset_composition_dynamics.py +168 -0
- puremacro-0.92.0/puremacro/examples/berkowitz_demo.py +66 -0
- puremacro-0.92.0/puremacro/examples/bloom2009.py +119 -0
- puremacro-0.92.0/puremacro/examples/bvar_fan_chart.py +123 -0
- puremacro-0.92.0/puremacro/examples/caldara_iacoviello.py +63 -0
- puremacro-0.92.0/puremacro/examples/cointegration_johansen.py +67 -0
- puremacro-0.92.0/puremacro/examples/dcc_volatility.py +90 -0
- puremacro-0.92.0/puremacro/examples/dfm_bai_ng.py +93 -0
- puremacro-0.92.0/puremacro/examples/dfm_nowcast_kalman.py +115 -0
- puremacro-0.92.0/puremacro/examples/did_callaway_santanna_demo.py +95 -0
- puremacro-0.92.0/puremacro/examples/diebold_yilmaz_spillover.py +58 -0
- puremacro-0.92.0/puremacro/examples/dsge_ar1_demo.py +63 -0
- puremacro-0.92.0/puremacro/examples/dsge_fertility_demo.py +39 -0
- puremacro-0.92.0/puremacro/examples/dsge_rbc_klein.py +157 -0
- puremacro-0.92.0/puremacro/examples/exact_diffuse_kalman.py +101 -0
- puremacro-0.92.0/puremacro/examples/fetch_fred_demo.py +112 -0
- puremacro-0.92.0/puremacro/examples/fm_ols_dols_demo.py +107 -0
- puremacro-0.92.0/puremacro/examples/forecast_density_eval.py +124 -0
- puremacro-0.92.0/puremacro/examples/gali_1999_hours.py +210 -0
- puremacro-0.92.0/puremacro/examples/gfevd_spillover.py +85 -0
- puremacro-0.92.0/puremacro/examples/gk_robust_from_gibbs.py +97 -0
- puremacro-0.92.0/puremacro/examples/gk_robust_signs.py +106 -0
- puremacro-0.92.0/puremacro/examples/global_fiscal_stance.py +111 -0
- puremacro-0.92.0/puremacro/examples/glp_lambda_search.py +89 -0
- puremacro-0.92.0/puremacro/examples/govt_vs_private_investment.py +134 -0
- puremacro-0.92.0/puremacro/examples/har_realized_vol.py +122 -0
- puremacro-0.92.0/puremacro/examples/hfi_gertler_karadi.py +72 -0
- puremacro-0.92.0/puremacro/examples/kilian_2009_oil.py +301 -0
- puremacro-0.92.0/puremacro/examples/la_lp_pmw_demo.py +115 -0
- puremacro-0.92.0/puremacro/examples/labor_flows_demo.py +102 -0
- puremacro-0.92.0/puremacro/examples/lp_asymmetric_tenreyro.py +58 -0
- puremacro-0.92.0/puremacro/examples/lp_panel_dk.py +52 -0
- puremacro-0.92.0/puremacro/examples/lp_smooth_demo.py +66 -0
- puremacro-0.92.0/puremacro/examples/lwui_wage_demo.py +96 -0
- puremacro-0.92.0/puremacro/examples/mcmc_diagnostics.py +102 -0
- puremacro-0.92.0/puremacro/examples/midas_quarterly_monthly.py +105 -0
- puremacro-0.92.0/puremacro/examples/mle_sandwich_demo.py +95 -0
- puremacro-0.92.0/puremacro/examples/ms_var_business_cycle.py +117 -0
- puremacro-0.92.0/puremacro/examples/narrative_custom_corpus.py +115 -0
- puremacro-0.92.0/puremacro/examples/narrative_event_study.py +171 -0
- puremacro-0.92.0/puremacro/examples/narrative_g7_panel.py +192 -0
- puremacro-0.92.0/puremacro/examples/narrative_homogeneous_panel.py +202 -0
- puremacro-0.92.0/puremacro/examples/narrative_indices_demo.py +75 -0
- puremacro-0.92.0/puremacro/examples/narrative_llm_pipeline.py +93 -0
- puremacro-0.92.0/puremacro/examples/narrative_local_llm.py +65 -0
- puremacro-0.92.0/puremacro/examples/narrative_multilingual_live.py +145 -0
- puremacro-0.92.0/puremacro/examples/narrative_panel_lp.py +150 -0
- puremacro-0.92.0/puremacro/examples/narrative_ramey_2011.py +158 -0
- puremacro-0.92.0/puremacro/examples/narrative_romer_romer_2010.py +144 -0
- puremacro-0.92.0/puremacro/examples/narrative_sign_adrr.py +163 -0
- puremacro-0.92.0/puremacro/examples/narrative_us_canonical_compare.py +194 -0
- puremacro-0.92.0/puremacro/examples/non_gaussian_svar.py +94 -0
- puremacro-0.92.0/puremacro/examples/posterior_predictive_fan.py +83 -0
- puremacro-0.92.0/puremacro/examples/ramey_zubairy_2018_multipliers.py +392 -0
- puremacro-0.92.0/puremacro/examples/regime_workflow.py +107 -0
- puremacro-0.92.0/puremacro/examples/report_workflow.py +79 -0
- puremacro-0.92.0/puremacro/examples/shock_atlas_demo.py +64 -0
- puremacro-0.92.0/puremacro/examples/sigma_decomposition.py +113 -0
- puremacro-0.92.0/puremacro/examples/sign_restrictions_uhlig.py +95 -0
- puremacro-0.92.0/puremacro/examples/spectral_business_cycle.py +93 -0
- puremacro-0.92.0/puremacro/examples/svariv_mertens_ravn.py +212 -0
- puremacro-0.92.0/puremacro/examples/synthetic_control_demo.py +116 -0
- puremacro-0.92.0/puremacro/examples/tvar_threshold_demo.py +89 -0
- puremacro-0.92.0/puremacro/examples/tvecm_demo.py +78 -0
- puremacro-0.92.0/puremacro/examples/tvp_var_demo.py +120 -0
- puremacro-0.92.0/puremacro/examples/tvp_var_sv_demo.py +100 -0
- puremacro-0.92.0/puremacro/examples/vintage_revisions.py +113 -0
- puremacro-0.92.0/puremacro/examples/vulnerable_growth.py +108 -0
- puremacro-0.92.0/puremacro/examples/wavelet_business_cycle.py +113 -0
- puremacro-0.92.0/puremacro/experiment.py +176 -0
- puremacro-0.92.0/puremacro/factor.py +141 -0
- puremacro-0.92.0/puremacro/fetch/__init__.py +50 -0
- puremacro-0.92.0/puremacro/fetch/_classic.py +143 -0
- puremacro-0.92.0/puremacro/fetch/_http.py +79 -0
- puremacro-0.92.0/puremacro/fetch/_oecd_sdmx.py +70 -0
- puremacro-0.92.0/puremacro/fetch/_seasonal.py +106 -0
- puremacro-0.92.0/puremacro/fetch/_static_tables.py +31 -0
- puremacro-0.92.0/puremacro/fetch/bea_cainc.py +163 -0
- puremacro-0.92.0/puremacro/fetch/bea_industry_shares.py +101 -0
- puremacro-0.92.0/puremacro/fetch/bls_state_panel.py +151 -0
- puremacro-0.92.0/puremacro/fetch/cdc_births_county.py +529 -0
- puremacro-0.92.0/puremacro/fetch/cdc_births_state.py +200 -0
- puremacro-0.92.0/puremacro/fetch/cdc_socrata_natality.py +103 -0
- puremacro-0.92.0/puremacro/fetch/census_bfs.py +129 -0
- puremacro-0.92.0/puremacro/fetch/census_pep_births.py +151 -0
- puremacro-0.92.0/puremacro/fetch/ces_states.py +74 -0
- puremacro-0.92.0/puremacro/fetch/epu.py +91 -0
- puremacro-0.92.0/puremacro/fetch/epu_news_historical.py +75 -0
- puremacro-0.92.0/puremacro/fetch/epu_states.py +103 -0
- puremacro-0.92.0/puremacro/fetch/fernald.py +63 -0
- puremacro-0.92.0/puremacro/fetch/frb_phil_coincident.py +86 -0
- puremacro-0.92.0/puremacro/fetch/fred.py +73 -0
- puremacro-0.92.0/puremacro/fetch/fred_states.py +152 -0
- puremacro-0.92.0/puremacro/fetch/gpr.py +81 -0
- puremacro-0.92.0/puremacro/fetch/hrs_mpu.py +57 -0
- puremacro-0.92.0/puremacro/fetch/imf_ifs.py +168 -0
- puremacro-0.92.0/puremacro/fetch/jln.py +64 -0
- puremacro-0.92.0/puremacro/fetch/kenfrench_industry.py +56 -0
- puremacro-0.92.0/puremacro/fetch/labor.py +488 -0
- puremacro-0.92.0/puremacro/fetch/labor_eurostat.py +498 -0
- puremacro-0.92.0/puremacro/fetch/labor_ilostat.py +740 -0
- puremacro-0.92.0/puremacro/fetch/laus.py +89 -0
- puremacro-0.92.0/puremacro/fetch/lmn.py +61 -0
- puremacro-0.92.0/puremacro/fetch/oecd.py +309 -0
- puremacro-0.92.0/puremacro/fetch/oecd_energy.py +108 -0
- puremacro-0.92.0/puremacro/fetch/oecd_fx.py +63 -0
- puremacro-0.92.0/puremacro/fetch/oecd_mei.py +131 -0
- puremacro-0.92.0/puremacro/fetch/oecd_qna_expenditure.py +158 -0
- puremacro-0.92.0/puremacro/fetch/oecd_qna_labor.py +138 -0
- puremacro-0.92.0/puremacro/fetch/oecd_qna_local.py +134 -0
- puremacro-0.92.0/puremacro/fetch/qcew.py +83 -0
- puremacro-0.92.0/puremacro/fetch/sdmx.py +203 -0
- puremacro-0.92.0/puremacro/fetch/state_industry_panel.py +469 -0
- puremacro-0.92.0/puremacro/fetch/wb_pink_sheet.py +102 -0
- puremacro-0.92.0/puremacro/fetch/wui.py +86 -0
- puremacro-0.92.0/puremacro/fetch/wui_extras.py +92 -0
- puremacro-0.92.0/puremacro/fetch/yahoo.py +77 -0
- puremacro-0.92.0/puremacro/forecast/__init__.py +14 -0
- puremacro-0.92.0/puremacro/forecast/compare.py +118 -0
- puremacro-0.92.0/puremacro/forecast/density.py +230 -0
- puremacro-0.92.0/puremacro/gar/__init__.py +32 -0
- puremacro-0.92.0/puremacro/gar/fci.py +164 -0
- puremacro-0.92.0/puremacro/gar/qar.py +127 -0
- puremacro-0.92.0/puremacro/gar/skewt.py +334 -0
- puremacro-0.92.0/puremacro/garch/__init__.py +5 -0
- puremacro-0.92.0/puremacro/garch/_results.py +110 -0
- puremacro-0.92.0/puremacro/garch/dcc.py +120 -0
- puremacro-0.92.0/puremacro/garch/fit.py +82 -0
- puremacro-0.92.0/puremacro/hfi/__init__.py +21 -0
- puremacro-0.92.0/puremacro/hfi/_results.py +90 -0
- puremacro-0.92.0/puremacro/hfi/jk2020.py +147 -0
- puremacro-0.92.0/puremacro/hfi/surprises.py +153 -0
- puremacro-0.92.0/puremacro/inference/__init__.py +56 -0
- puremacro-0.92.0/puremacro/inference/_ols_helpers.py +52 -0
- puremacro-0.92.0/puremacro/inference/_results.py +165 -0
- puremacro-0.92.0/puremacro/inference/balanced_panel.py +262 -0
- puremacro-0.92.0/puremacro/inference/block_bootstrap.py +69 -0
- puremacro-0.92.0/puremacro/inference/bootstrap.py +108 -0
- puremacro-0.92.0/puremacro/inference/dk.py +41 -0
- puremacro-0.92.0/puremacro/inference/hac.py +28 -0
- puremacro-0.92.0/puremacro/inference/hac_fixed_b.py +111 -0
- puremacro-0.92.0/puremacro/inference/lewbel_iv.py +179 -0
- puremacro-0.92.0/puremacro/inference/lp_block_bootstrap.py +154 -0
- puremacro-0.92.0/puremacro/inference/moving_block.py +231 -0
- puremacro-0.92.0/puremacro/inference/moving_block_bootstrap.py +229 -0
- puremacro-0.92.0/puremacro/inference/newey_west.py +26 -0
- puremacro-0.92.0/puremacro/inference/over_id.py +118 -0
- puremacro-0.92.0/puremacro/inference/pesaran.py +55 -0
- puremacro-0.92.0/puremacro/inference/pesaran_cce.py +51 -0
- puremacro-0.92.0/puremacro/inference/quandt_andrews.py +128 -0
- puremacro-0.92.0/puremacro/inference/spec_curve.py +110 -0
- puremacro-0.92.0/puremacro/inference/supt.py +233 -0
- puremacro-0.92.0/puremacro/inference/swamy.py +40 -0
- puremacro-0.92.0/puremacro/inference/swamy_test.py +40 -0
- puremacro-0.92.0/puremacro/inference/weak_iv.py +389 -0
- puremacro-0.92.0/puremacro/inference/wild_bootstrap.py +97 -0
- puremacro-0.92.0/puremacro/instruments/__init__.py +21 -0
- puremacro-0.92.0/puremacro/instruments/_catalog.py +811 -0
- puremacro-0.92.0/puremacro/instruments/_compose.py +199 -0
- puremacro-0.92.0/puremacro/instruments/_core.py +209 -0
- puremacro-0.92.0/puremacro/instruments/_helpers.py +118 -0
- puremacro-0.92.0/puremacro/instruments/_registry.py +174 -0
- puremacro-0.92.0/puremacro/instruments/external/__init__.py +14 -0
- puremacro-0.92.0/puremacro/instruments/external/bis.py +136 -0
- puremacro-0.92.0/puremacro/instruments/external/fred.py +128 -0
- puremacro-0.92.0/puremacro/instruments/external/imf_weo.py +176 -0
- puremacro-0.92.0/puremacro/instruments/literature/__init__.py +19 -0
- puremacro-0.92.0/puremacro/instruments/literature/_helpers.py +9 -0
- puremacro-0.92.0/puremacro/instruments/literature/bbd_epu.py +79 -0
- puremacro-0.92.0/puremacro/instruments/literature/bloom_2009.py +84 -0
- puremacro-0.92.0/puremacro/instruments/literature/caldara_iacoviello_gpr.py +78 -0
- puremacro-0.92.0/puremacro/instruments/literature/romer_romer_2004.py +93 -0
- puremacro-0.92.0/puremacro/klems.py +596 -0
- puremacro-0.92.0/puremacro/korv_gmm.py +890 -0
- puremacro-0.92.0/puremacro/labor_flows.py +286 -0
- puremacro-0.92.0/puremacro/labor_share.py +72 -0
- puremacro-0.92.0/puremacro/long_panel.py +421 -0
- puremacro-0.92.0/puremacro/lp/__init__.py +28 -0
- puremacro-0.92.0/puremacro/lp/_garch_utils.py +170 -0
- puremacro-0.92.0/puremacro/lp/_panel_helpers.py +219 -0
- puremacro-0.92.0/puremacro/lp/asymmetric.py +89 -0
- puremacro-0.92.0/puremacro/lp/cce.py +124 -0
- puremacro-0.92.0/puremacro/lp/garch_in_mean.py +32 -0
- puremacro-0.92.0/puremacro/lp/garch_state.py +39 -0
- puremacro-0.92.0/puremacro/lp/iv.py +95 -0
- puremacro-0.92.0/puremacro/lp/iv_helpers.py +90 -0
- puremacro-0.92.0/puremacro/lp/iv_lewbel.py +114 -0
- puremacro-0.92.0/puremacro/lp/jorda.py +78 -0
- puremacro-0.92.0/puremacro/lp/la_lp.py +100 -0
- puremacro-0.92.0/puremacro/lp/lp_did.py +443 -0
- puremacro-0.92.0/puremacro/lp/mean_group.py +89 -0
- puremacro-0.92.0/puremacro/lp/panel.py +277 -0
- puremacro-0.92.0/puremacro/lp/panel_dk.py +46 -0
- puremacro-0.92.0/puremacro/lp/panel_iv.py +50 -0
- puremacro-0.92.0/puremacro/lp/quantile.py +111 -0
- puremacro-0.92.0/puremacro/lp/smooth.py +96 -0
- puremacro-0.92.0/puremacro/lp/state_dep.py +249 -0
- puremacro-0.92.0/puremacro/mcmc.py +254 -0
- puremacro-0.92.0/puremacro/midas.py +282 -0
- puremacro-0.92.0/puremacro/models/__init__.py +10 -0
- puremacro-0.92.0/puremacro/models/dmp_regime_dependent.py +526 -0
- puremacro-0.92.0/puremacro/models/nested_dmp/__init__.py +133 -0
- puremacro-0.92.0/puremacro/models/nested_dmp/backend.py +23 -0
- puremacro-0.92.0/puremacro/models/nested_dmp/dynamics.py +417 -0
- puremacro-0.92.0/puremacro/models/nested_dmp/equilibrium.py +392 -0
- puremacro-0.92.0/puremacro/models/nested_dmp/estimation.py +332 -0
- puremacro-0.92.0/puremacro/models/nested_dmp/kernels.py +158 -0
- puremacro-0.92.0/puremacro/models/nested_dmp/kernels_numba.py +47 -0
- puremacro-0.92.0/puremacro/models/nested_dmp/params.py +107 -0
- puremacro-0.92.0/puremacro/models/nested_dmp/welfare.py +727 -0
- puremacro-0.92.0/puremacro/narrative/__init__.py +119 -0
- puremacro-0.92.0/puremacro/narrative/_local_engines.py +280 -0
- puremacro-0.92.0/puremacro/narrative/_signal_quality.py +66 -0
- puremacro-0.92.0/puremacro/narrative/aggregate.py +283 -0
- puremacro-0.92.0/puremacro/narrative/dedup.py +177 -0
- puremacro-0.92.0/puremacro/narrative/indices/__init__.py +55 -0
- puremacro-0.92.0/puremacro/narrative/indices/_embedding_kernel.py +176 -0
- puremacro-0.92.0/puremacro/narrative/indices/_fed_districts.py +221 -0
- puremacro-0.92.0/puremacro/narrative/indices/_kernels.py +430 -0
- puremacro-0.92.0/puremacro/narrative/indices/_lexicons.py +2352 -0
- puremacro-0.92.0/puremacro/narrative/indices/_lexicons_expanded.py +609 -0
- puremacro-0.92.0/puremacro/narrative/indices/_llm_kernel.py +312 -0
- puremacro-0.92.0/puremacro/narrative/indices/_mnl_kernel.py +189 -0
- puremacro-0.92.0/puremacro/narrative/indices/beige_book.py +181 -0
- puremacro-0.92.0/puremacro/narrative/indices/bluesky.py +124 -0
- puremacro-0.92.0/puremacro/narrative/indices/cross_source.py +133 -0
- puremacro-0.92.0/puremacro/narrative/indices/epu.py +71 -0
- puremacro-0.92.0/puremacro/narrative/indices/eu_legislative.py +94 -0
- puremacro-0.92.0/puremacro/narrative/indices/gpr.py +56 -0
- puremacro-0.92.0/puremacro/narrative/indices/ltui.py +182 -0
- puremacro-0.92.0/puremacro/narrative/indices/lui.py +75 -0
- puremacro-0.92.0/puremacro/narrative/indices/lwui.py +143 -0
- puremacro-0.92.0/puremacro/narrative/indices/mpu.py +64 -0
- puremacro-0.92.0/puremacro/narrative/indices/tone.py +100 -0
- puremacro-0.92.0/puremacro/narrative/indices/us_executive.py +116 -0
- puremacro-0.92.0/puremacro/narrative/indices/wui.py +54 -0
- puremacro-0.92.0/puremacro/narrative/panel.py +516 -0
- puremacro-0.92.0/puremacro/narrative/quality/__init__.py +7 -0
- puremacro-0.92.0/puremacro/narrative/quality/magnitude_harmonizer.py +81 -0
- puremacro-0.92.0/puremacro/narrative/quality/pipeline.py +71 -0
- puremacro-0.92.0/puremacro/narrative/quality/surprise_filter.py +74 -0
- puremacro-0.92.0/puremacro/narrative/quality/target_auditor.py +101 -0
- puremacro-0.92.0/puremacro/narrative/replication/__init__.py +75 -0
- puremacro-0.92.0/puremacro/narrative/replication/_within_year.py +94 -0
- puremacro-0.92.0/puremacro/narrative/replication/adler_2024_consolidations.py +230 -0
- puremacro-0.92.0/puremacro/narrative/replication/cloyne_2013_uk.py +110 -0
- puremacro-0.92.0/puremacro/narrative/replication/devries_2011_consolidations.py +210 -0
- puremacro-0.92.0/puremacro/narrative/replication/dglp_2011_consolidations.py +249 -0
- puremacro-0.92.0/puremacro/narrative/replication/eu_nms_2023_consolidations.py +301 -0
- puremacro-0.92.0/puremacro/narrative/replication/guajardo_2011_aeipf.py +243 -0
- puremacro-0.92.0/puremacro/narrative/replication/imf_covid_2022_announcements.py +324 -0
- puremacro-0.92.0/puremacro/narrative/replication/mertens_ravn_2013.py +171 -0
- puremacro-0.92.0/puremacro/narrative/replication/mitchell_historical.py +134 -0
- puremacro-0.92.0/puremacro/narrative/replication/ramey_2011_defense.py +118 -0
- puremacro-0.92.0/puremacro/narrative/replication/romer_romer_2010.py +141 -0
- puremacro-0.92.0/puremacro/narrative/replication/romer_romer_2017.py +122 -0
- puremacro-0.92.0/puremacro/narrative/scoring/__init__.py +14 -0
- puremacro-0.92.0/puremacro/narrative/scoring/keyword.py +231 -0
- puremacro-0.92.0/puremacro/narrative/scoring/llm.py +536 -0
- puremacro-0.92.0/puremacro/narrative/scoring/manual.py +79 -0
- puremacro-0.92.0/puremacro/narrative/sources/__init__.py +121 -0
- puremacro-0.92.0/puremacro/narrative/sources/_extractors.py +394 -0
- puremacro-0.92.0/puremacro/narrative/sources/_fallback.py +181 -0
- puremacro-0.92.0/puremacro/narrative/sources/_http.py +20 -0
- puremacro-0.92.0/puremacro/narrative/sources/_playwright_helper.py +114 -0
- puremacro-0.92.0/puremacro/narrative/sources/_ratedoc.py +85 -0
- puremacro-0.92.0/puremacro/narrative/sources/_rss.py +104 -0
- puremacro-0.92.0/puremacro/narrative/sources/_rss_filtered.py +66 -0
- puremacro-0.92.0/puremacro/narrative/sources/_schema.py +108 -0
- puremacro-0.92.0/puremacro/narrative/sources/_schema_check.py +78 -0
- puremacro-0.92.0/puremacro/narrative/sources/_speeches.py +37 -0
- puremacro-0.92.0/puremacro/narrative/sources/_telemetry.py +169 -0
- puremacro-0.92.0/puremacro/narrative/sources/_wayback.py +61 -0
- puremacro-0.92.0/puremacro/narrative/sources/banrep.py +20 -0
- puremacro-0.92.0/puremacro/narrative/sources/banxico.py +127 -0
- puremacro-0.92.0/puremacro/narrative/sources/bcb.py +176 -0
- puremacro-0.92.0/puremacro/narrative/sources/bccl.py +20 -0
- puremacro-0.92.0/puremacro/narrative/sources/bcra.py +20 -0
- puremacro-0.92.0/puremacro/narrative/sources/beige_book.py +1100 -0
- puremacro-0.92.0/puremacro/narrative/sources/bi.py +198 -0
- puremacro-0.92.0/puremacro/narrative/sources/bis_speeches.py +204 -0
- puremacro-0.92.0/puremacro/narrative/sources/bluesky.py +340 -0
- puremacro-0.92.0/puremacro/narrative/sources/bnm.py +177 -0
- puremacro-0.92.0/puremacro/narrative/sources/boe_decision.py +34 -0
- puremacro-0.92.0/puremacro/narrative/sources/boe_minutes.py +105 -0
- puremacro-0.92.0/puremacro/narrative/sources/boe_speeches.py +154 -0
- puremacro-0.92.0/puremacro/narrative/sources/boj_decision.py +35 -0
- puremacro-0.92.0/puremacro/narrative/sources/boj_speeches.py +104 -0
- puremacro-0.92.0/puremacro/narrative/sources/bok.py +106 -0
- puremacro-0.92.0/puremacro/narrative/sources/bot.py +128 -0
- puremacro-0.92.0/puremacro/narrative/sources/bsp.py +315 -0
- puremacro-0.92.0/puremacro/narrative/sources/ca_dof.py +38 -0
- puremacro-0.92.0/puremacro/narrative/sources/cbe.py +200 -0
- puremacro-0.92.0/puremacro/narrative/sources/cbk.py +218 -0
- puremacro-0.92.0/puremacro/narrative/sources/cbn.py +213 -0
- puremacro-0.92.0/puremacro/narrative/sources/de_bmf.py +42 -0
- puremacro-0.92.0/puremacro/narrative/sources/ecb_decision.py +70 -0
- puremacro-0.92.0/puremacro/narrative/sources/ecb_minutes.py +40 -0
- puremacro-0.92.0/puremacro/narrative/sources/ecb_press.py +55 -0
- puremacro-0.92.0/puremacro/narrative/sources/ecb_press_conf.py +56 -0
- puremacro-0.92.0/puremacro/narrative/sources/ecb_speeches.py +41 -0
- puremacro-0.92.0/puremacro/narrative/sources/eu_ecfin.py +63 -0
- puremacro-0.92.0/puremacro/narrative/sources/eu_eurlex.py +354 -0
- puremacro-0.92.0/puremacro/narrative/sources/eu_parliament.py +206 -0
- puremacro-0.92.0/puremacro/narrative/sources/fed_decision.py +83 -0
- puremacro-0.92.0/puremacro/narrative/sources/fed_minutes.py +140 -0
- puremacro-0.92.0/puremacro/narrative/sources/fed_press_conf.py +64 -0
- puremacro-0.92.0/puremacro/narrative/sources/fed_speeches.py +48 -0
- puremacro-0.92.0/puremacro/narrative/sources/fr_tresor.py +28 -0
- puremacro-0.92.0/puremacro/narrative/sources/frdb_strikes.py +170 -0
- puremacro-0.92.0/puremacro/narrative/sources/google_news.py +77 -0
- puremacro-0.92.0/puremacro/narrative/sources/hackernews.py +112 -0
- puremacro-0.92.0/puremacro/narrative/sources/health.py +184 -0
- puremacro-0.92.0/puremacro/narrative/sources/imf_articleiv.py +221 -0
- puremacro-0.92.0/puremacro/narrative/sources/imf_news.py +39 -0
- puremacro-0.92.0/puremacro/narrative/sources/it_mef.py +40 -0
- puremacro-0.92.0/puremacro/narrative/sources/jp_mof.py +20 -0
- puremacro-0.92.0/puremacro/narrative/sources/local_csv.py +30 -0
- puremacro-0.92.0/puremacro/narrative/sources/mas.py +21 -0
- puremacro-0.92.0/puremacro/narrative/sources/nber_wp.py +80 -0
- puremacro-0.92.0/puremacro/narrative/sources/news_api.py +75 -0
- puremacro-0.92.0/puremacro/narrative/sources/norges.py +21 -0
- puremacro-0.92.0/puremacro/narrative/sources/oecd_surveys.py +209 -0
- puremacro-0.92.0/puremacro/narrative/sources/pboc.py +92 -0
- puremacro-0.92.0/puremacro/narrative/sources/rba.py +111 -0
- puremacro-0.92.0/puremacro/narrative/sources/rbi.py +21 -0
- puremacro-0.92.0/puremacro/narrative/sources/rbnz.py +26 -0
- puremacro-0.92.0/puremacro/narrative/sources/reddit.py +105 -0
- puremacro-0.92.0/puremacro/narrative/sources/riksbank.py +95 -0
- puremacro-0.92.0/puremacro/narrative/sources/sarb.py +82 -0
- puremacro-0.92.0/puremacro/narrative/sources/uk_hmt.py +23 -0
- puremacro-0.92.0/puremacro/narrative/sources/uk_obr.py +21 -0
- puremacro-0.92.0/puremacro/narrative/sources/us_cbo.py +269 -0
- puremacro-0.92.0/puremacro/narrative/sources/us_dod_contracts.py +81 -0
- puremacro-0.92.0/puremacro/narrative/sources/us_erp.py +223 -0
- puremacro-0.92.0/puremacro/narrative/sources/us_federal_register.py +77 -0
- puremacro-0.92.0/puremacro/narrative/sources/us_sotu.py +244 -0
- puremacro-0.92.0/puremacro/narrative/sources/us_treasury.py +76 -0
- puremacro-0.92.0/puremacro/narrative/sources/us_warn.py +1251 -0
- puremacro-0.92.0/puremacro/narrative/types.py +529 -0
- puremacro-0.92.0/puremacro/narrative/validate.py +138 -0
- puremacro-0.92.0/puremacro/narrative/validation/__init__.py +36 -0
- puremacro-0.92.0/puremacro/narrative/validation/external_benchmarks.py +295 -0
- puremacro-0.92.0/puremacro/narrative/validation/gap_filler.py +87 -0
- puremacro-0.92.0/puremacro/narrative/validation/report.py +182 -0
- puremacro-0.92.0/puremacro/narrative/validation/spec_curve.py +275 -0
- puremacro-0.92.0/puremacro/narrative/validation/stability.py +148 -0
- puremacro-0.92.0/puremacro/nowcast/__init__.py +49 -0
- puremacro-0.92.0/puremacro/nowcast/combine.py +192 -0
- puremacro-0.92.0/puremacro/nowcast/dfm.py +171 -0
- puremacro-0.92.0/puremacro/nowcast/mfvar.py +175 -0
- puremacro-0.92.0/puremacro/nowcast/scoring.py +182 -0
- puremacro-0.92.0/puremacro/numerics.py +167 -0
- puremacro-0.92.0/puremacro/plot.py +227 -0
- puremacro-0.92.0/puremacro/plotting/__init__.py +0 -0
- puremacro-0.92.0/puremacro/plotting/bw_style.py +136 -0
- puremacro-0.92.0/puremacro/plotting/irf_plot.py +162 -0
- puremacro-0.92.0/puremacro/posterior.py +79 -0
- puremacro-0.92.0/puremacro/realized_vol.py +124 -0
- puremacro-0.92.0/puremacro/regime_dates.py +104 -0
- puremacro-0.92.0/puremacro/regimes.py +95 -0
- puremacro-0.92.0/puremacro/regress/__init__.py +4 -0
- puremacro-0.92.0/puremacro/regress/lp.py +167 -0
- puremacro-0.92.0/puremacro/replication/__init__.py +23 -0
- puremacro-0.92.0/puremacro/replication/_data.py +17 -0
- puremacro-0.92.0/puremacro/replication/_model.py +134 -0
- puremacro-0.92.0/puremacro/replication/cases_ha_dsge_causal.py +144 -0
- puremacro-0.92.0/puremacro/replication/cases_stylized_facts.py +44 -0
- puremacro-0.92.0/puremacro/replication/data/__init__.py +0 -0
- puremacro-0.92.0/puremacro/replication/data/gali1999.csv +314 -0
- puremacro-0.92.0/puremacro/replication/data/kilian2009.csv +433 -0
- puremacro-0.92.0/puremacro/replication/data/okun.csv +940 -0
- puremacro-0.92.0/puremacro/replication/data/rz2018.csv +509 -0
- puremacro-0.92.0/puremacro/replication/data/tax14_narrative_tax_shocks.csv +253 -0
- puremacro-0.92.0/puremacro/replication/data/tax14_us_fiscal.csv +318 -0
- puremacro-0.92.0/puremacro/replication/runner.py +51 -0
- puremacro-0.92.0/puremacro/reports.py +235 -0
- puremacro-0.92.0/puremacro/sa/__init__.py +25 -0
- puremacro-0.92.0/puremacro/sa/stl.py +132 -0
- puremacro-0.92.0/puremacro/sa/x13.py +159 -0
- puremacro-0.92.0/puremacro/scale.py +98 -0
- puremacro-0.92.0/puremacro/shock_atlas.py +321 -0
- puremacro-0.92.0/puremacro/sigma/__init__.py +4 -0
- puremacro-0.92.0/puremacro/sigma/shapley.py +232 -0
- puremacro-0.92.0/puremacro/sigma/sigma_numpy.py +64 -0
- puremacro-0.92.0/puremacro/spectral.py +186 -0
- puremacro-0.92.0/puremacro/state_space.py +378 -0
- puremacro-0.92.0/puremacro/synthetic_control.py +202 -0
- puremacro-0.92.0/puremacro/teaching/__init__.py +0 -0
- puremacro-0.92.0/puremacro/teaching/bartik.py +54 -0
- puremacro-0.92.0/puremacro/teaching/bartik_importance.py +199 -0
- puremacro-0.92.0/puremacro/teaching/bartik_research.py +66 -0
- puremacro-0.92.0/puremacro/teaching/bq_canonical.py +115 -0
- puremacro-0.92.0/puremacro/teaching/data.py +73 -0
- puremacro-0.92.0/puremacro/teaching/data_long.py +197 -0
- puremacro-0.92.0/puremacro/teaching/data_states.py +121 -0
- puremacro-0.92.0/puremacro/teaching/experiment.py +181 -0
- puremacro-0.92.0/puremacro/teaching/garch_arch.py +20 -0
- puremacro-0.92.0/puremacro/teaching/garch_iv.py +493 -0
- puremacro-0.92.0/puremacro/teaching/integration_checks.py +173 -0
- puremacro-0.92.0/puremacro/teaching/irf_scale.py +114 -0
- puremacro-0.92.0/puremacro/teaching/lp_sm.py +47 -0
- puremacro-0.92.0/puremacro/teaching/panel_lm.py +74 -0
- puremacro-0.92.0/puremacro/teaching/plot.py +70 -0
- puremacro-0.92.0/puremacro/teaching/recipes.py +142 -0
- puremacro-0.92.0/puremacro/teaching/svar_panel.py +592 -0
- puremacro-0.92.0/puremacro/teaching/var_sm.py +195 -0
- puremacro-0.92.0/puremacro/tests/__init__.py +0 -0
- puremacro-0.92.0/puremacro/tests/breaks.py +217 -0
- puremacro-0.92.0/puremacro/tests/test_var/__init__.py +0 -0
- puremacro-0.92.0/puremacro/tests/test_var/test_proxy_axis.py +35 -0
- puremacro-0.92.0/puremacro/tests/unit_root.py +313 -0
- puremacro-0.92.0/puremacro/uncertainty/__init__.py +49 -0
- puremacro-0.92.0/puremacro/uncertainty/composite.py +332 -0
- puremacro-0.92.0/puremacro/uncertainty/decomposition.py +111 -0
- puremacro-0.92.0/puremacro/uncertainty/diagnostics.py +121 -0
- puremacro-0.92.0/puremacro/uncertainty/lp_long.py +181 -0
- puremacro-0.92.0/puremacro/uncertainty/regimes.py +125 -0
- puremacro-0.92.0/puremacro/validation/__init__.py +23 -0
- puremacro-0.92.0/puremacro/validation/_fixtures.py +19 -0
- puremacro-0.92.0/puremacro/validation/_goldens.py +29 -0
- puremacro-0.92.0/puremacro/validation/_model.py +143 -0
- puremacro-0.92.0/puremacro/validation/cases_dsge.py +350 -0
- puremacro-0.92.0/puremacro/validation/cases_dynpanel.py +298 -0
- puremacro-0.92.0/puremacro/validation/cases_forecast.py +234 -0
- puremacro-0.92.0/puremacro/validation/cases_garch.py +221 -0
- puremacro-0.92.0/puremacro/validation/cases_inference.py +361 -0
- puremacro-0.92.0/puremacro/validation/cases_lp.py +244 -0
- puremacro-0.92.0/puremacro/validation/cases_narrative.py +284 -0
- puremacro-0.92.0/puremacro/validation/cases_spectral.py +342 -0
- puremacro-0.92.0/puremacro/validation/cases_state_space.py +272 -0
- puremacro-0.92.0/puremacro/validation/cases_var.py +78 -0
- puremacro-0.92.0/puremacro/validation/cases_vfi.py +297 -0
- puremacro-0.92.0/puremacro/validation/goldens/__init__.py +0 -0
- puremacro-0.92.0/puremacro/validation/goldens/_t.json +4 -0
- puremacro-0.92.0/puremacro/validation/goldens/garch.json +4818 -0
- puremacro-0.92.0/puremacro/validation/goldens/inference.json +22 -0
- puremacro-0.92.0/puremacro/validation/goldens/lp.json +40 -0
- puremacro-0.92.0/puremacro/validation/goldens/state_space.json +239 -0
- puremacro-0.92.0/puremacro/validation/goldens/var.json +142 -0
- puremacro-0.92.0/puremacro/validation/runner.py +55 -0
- puremacro-0.92.0/puremacro/var/__init__.py +15 -0
- puremacro-0.92.0/puremacro/var/_results.py +60 -0
- puremacro-0.92.0/puremacro/var/bootstrap.py +180 -0
- puremacro-0.92.0/puremacro/var/bvar.py +476 -0
- puremacro-0.92.0/puremacro/var/diagnostics.py +132 -0
- puremacro-0.92.0/puremacro/var/estimate.py +82 -0
- puremacro-0.92.0/puremacro/var/identify/__init__.py +37 -0
- puremacro-0.92.0/puremacro/var/identify/_results.py +613 -0
- puremacro-0.92.0/puremacro/var/identify/bq.py +128 -0
- puremacro-0.92.0/puremacro/var/identify/cholesky.py +197 -0
- puremacro-0.92.0/puremacro/var/identify/hetero.py +229 -0
- puremacro-0.92.0/puremacro/var/identify/magmav.py +394 -0
- puremacro-0.92.0/puremacro/var/identify/maxshare.py +409 -0
- puremacro-0.92.0/puremacro/var/identify/narrative_sign.py +568 -0
- puremacro-0.92.0/puremacro/var/identify/non_gaussian.py +230 -0
- puremacro-0.92.0/puremacro/var/identify/panel.py +125 -0
- puremacro-0.92.0/puremacro/var/identify/proxy.py +117 -0
- puremacro-0.92.0/puremacro/var/identify/sign.py +77 -0
- puremacro-0.92.0/puremacro/var/identify/sign_robust.py +212 -0
- puremacro-0.92.0/puremacro/var/identify/sign_zero.py +167 -0
- puremacro-0.92.0/puremacro/var/irf.py +153 -0
- puremacro-0.92.0/puremacro/var/panel.py +250 -0
- puremacro-0.92.0/puremacro/var/peak.py +121 -0
- puremacro-0.92.0/puremacro/var/regime/__init__.py +13 -0
- puremacro-0.92.0/puremacro/var/regime/girf.py +511 -0
- puremacro-0.92.0/puremacro/var/regime/ms_var.py +250 -0
- puremacro-0.92.0/puremacro/var/regime/threshold.py +137 -0
- puremacro-0.92.0/puremacro/var/regime/tvecm.py +179 -0
- puremacro-0.92.0/puremacro/var/tvp.py +471 -0
- puremacro-0.92.0/puremacro/var/vecm.py +279 -0
- puremacro-0.92.0/puremacro/vfi/__init__.py +98 -0
- puremacro-0.92.0/puremacro/vfi/aggregate.py +111 -0
- puremacro-0.92.0/puremacro/vfi/case2.py +128 -0
- puremacro-0.92.0/puremacro/vfi/compat.py +57 -0
- puremacro-0.92.0/puremacro/vfi/discretize.py +197 -0
- puremacro-0.92.0/puremacro/vfi/distribution.py +140 -0
- puremacro-0.92.0/puremacro/vfi/egm.py +83 -0
- puremacro-0.92.0/puremacro/vfi/epstein_zin.py +110 -0
- puremacro-0.92.0/puremacro/vfi/equilibrium.py +113 -0
- puremacro-0.92.0/puremacro/vfi/estimate.py +86 -0
- puremacro-0.92.0/puremacro/vfi/examples.py +379 -0
- puremacro-0.92.0/puremacro/vfi/finite_horizon.py +227 -0
- puremacro-0.92.0/puremacro/vfi/firm_dynamics.py +113 -0
- puremacro-0.92.0/puremacro/vfi/kernels.py +28 -0
- puremacro-0.92.0/puremacro/vfi/kernels_numba.py +174 -0
- puremacro-0.92.0/puremacro/vfi/krusell_smith.py +261 -0
- puremacro-0.92.0/puremacro/vfi/olg.py +124 -0
- puremacro-0.92.0/puremacro/vfi/permanent_types.py +96 -0
- puremacro-0.92.0/puremacro/vfi/problem.py +205 -0
- puremacro-0.92.0/puremacro/vfi/returnfn.py +71 -0
- puremacro-0.92.0/puremacro/vfi/simulate.py +77 -0
- puremacro-0.92.0/puremacro/vfi/solve.py +60 -0
- puremacro-0.92.0/puremacro/vfi/transition.py +91 -0
- puremacro-0.92.0/puremacro/vintages.py +303 -0
- puremacro-0.92.0/puremacro/volatility/__init__.py +32 -0
- puremacro-0.92.0/puremacro/volatility/diagnostics.py +94 -0
- puremacro-0.92.0/puremacro/volatility/har.py +79 -0
- puremacro-0.92.0/puremacro/volatility/multivariate.py +212 -0
- puremacro-0.92.0/puremacro/volatility/range.py +129 -0
- puremacro-0.92.0/puremacro/volatility/sigma.py +262 -0
- puremacro-0.92.0/puremacro/wavelet.py +251 -0
- puremacro-0.92.0/puremacro.egg-info/PKG-INFO +363 -0
- puremacro-0.92.0/puremacro.egg-info/SOURCES.txt +742 -0
- puremacro-0.92.0/puremacro.egg-info/dependency_links.txt +1 -0
- puremacro-0.92.0/puremacro.egg-info/requires.txt +55 -0
- puremacro-0.92.0/puremacro.egg-info/top_level.txt +1 -0
- puremacro-0.92.0/pyproject.toml +112 -0
- puremacro-0.92.0/setup.cfg +4 -0
- puremacro-0.92.0/tests/test_46_state_strikes_replicates.py +62 -0
- puremacro-0.92.0/tests/test_bartik_county_epu_coverage.py +557 -0
- puremacro-0.92.0/tests/test_bartik_exposure_iv_coverage.py +472 -0
- puremacro-0.92.0/tests/test_bartik_sensitivity_coverage.py +467 -0
- puremacro-0.92.0/tests/test_bartik_shares_coverage.py +641 -0
- puremacro-0.92.0/tests/test_beige_book.py +466 -0
- puremacro-0.92.0/tests/test_bilingual_docs.py +45 -0
- puremacro-0.92.0/tests/test_bis_neer_coverage.py +551 -0
- puremacro-0.92.0/tests/test_bluesky.py +301 -0
- puremacro-0.92.0/tests/test_cholesky_shocks.py +73 -0
- puremacro-0.92.0/tests/test_cointegration_modern.py +118 -0
- puremacro-0.92.0/tests/test_connectedness_diebold_yilmaz_coverage.py +297 -0
- puremacro-0.92.0/tests/test_course.py +36 -0
- puremacro-0.92.0/tests/test_cross_nest_coverage.py +674 -0
- puremacro-0.92.0/tests/test_cross_source.py +131 -0
- puremacro-0.92.0/tests/test_cycles.py +84 -0
- puremacro-0.92.0/tests/test_data.py +128 -0
- puremacro-0.92.0/tests/test_did_callaway_santanna_demo.py +35 -0
- puremacro-0.92.0/tests/test_dmp_regime_dependent.py +69 -0
- puremacro-0.92.0/tests/test_dsge_gensys_coverage.py +724 -0
- puremacro-0.92.0/tests/test_dsge_load_dynare_coverage.py +519 -0
- puremacro-0.92.0/tests/test_dsge_smets_wouters.py +254 -0
- puremacro-0.92.0/tests/test_eu_legislative.py +386 -0
- puremacro-0.92.0/tests/test_examples_local_llm.py +22 -0
- puremacro-0.92.0/tests/test_experiment.py +140 -0
- puremacro-0.92.0/tests/test_experiment_vs_teaching.py +104 -0
- puremacro-0.92.0/tests/test_factor_coverage.py +358 -0
- puremacro-0.92.0/tests/test_fetch_bls_state.py +89 -0
- puremacro-0.92.0/tests/test_fetch_labor.py +455 -0
- puremacro-0.92.0/tests/test_fetch_labor_eurostat.py +178 -0
- puremacro-0.92.0/tests/test_fetch_labor_eurostat_quarterly.py +399 -0
- puremacro-0.92.0/tests/test_fetch_labor_ilostat.py +369 -0
- puremacro-0.92.0/tests/test_fetch_seasonal.py +70 -0
- puremacro-0.92.0/tests/test_fetch_state_industry.py +119 -0
- puremacro-0.92.0/tests/test_forecast_compare_coverage.py +531 -0
- puremacro-0.92.0/tests/test_forecast_density_coverage.py +546 -0
- puremacro-0.92.0/tests/test_http_cache.py +92 -0
- puremacro-0.92.0/tests/test_http_throttle.py +110 -0
- puremacro-0.92.0/tests/test_http_unified.py +44 -0
- puremacro-0.92.0/tests/test_identify_narrative_sign.py +389 -0
- puremacro-0.92.0/tests/test_import.py +7 -0
- puremacro-0.92.0/tests/test_inference_balanced_panel_coverage.py +620 -0
- puremacro-0.92.0/tests/test_inference_block_bootstrap_coverage.py +640 -0
- puremacro-0.92.0/tests/test_inference_bootstrap_coverage.py +562 -0
- puremacro-0.92.0/tests/test_inference_lp_block_bootstrap_coverage.py +412 -0
- puremacro-0.92.0/tests/test_inference_moving_block_bootstrap_coverage.py +690 -0
- puremacro-0.92.0/tests/test_inference_moving_block_coverage.py +694 -0
- puremacro-0.92.0/tests/test_inference_over_id_coverage.py +523 -0
- puremacro-0.92.0/tests/test_inference_pesaran_coverage.py +311 -0
- puremacro-0.92.0/tests/test_inference_supt_coverage.py +510 -0
- puremacro-0.92.0/tests/test_inference_wild_bootstrap_coverage.py +570 -0
- puremacro-0.92.0/tests/test_instruments__catalog_coverage.py +597 -0
- puremacro-0.92.0/tests/test_known_failures_schema.py +35 -0
- puremacro-0.92.0/tests/test_korv_gmm_coverage.py +1034 -0
- puremacro-0.92.0/tests/test_labor_flows_coverage.py +722 -0
- puremacro-0.92.0/tests/test_labor_flows_demo.py +30 -0
- puremacro-0.92.0/tests/test_local_backends.py +121 -0
- puremacro-0.92.0/tests/test_local_engines.py +190 -0
- puremacro-0.92.0/tests/test_local_http_post.py +38 -0
- puremacro-0.92.0/tests/test_local_llm_live.py +56 -0
- puremacro-0.92.0/tests/test_long_panel.py +166 -0
- puremacro-0.92.0/tests/test_long_panel_coverage.py +968 -0
- puremacro-0.92.0/tests/test_lp_did_coverage.py +386 -0
- puremacro-0.92.0/tests/test_lp_garch_utils_coverage.py +581 -0
- puremacro-0.92.0/tests/test_lp_quantile_coverage.py +571 -0
- puremacro-0.92.0/tests/test_lwui_wage.py +129 -0
- puremacro-0.92.0/tests/test_mcmc_coverage.py +500 -0
- puremacro-0.92.0/tests/test_midas.py +109 -0
- puremacro-0.92.0/tests/test_narrative.py +830 -0
- puremacro-0.92.0/tests/test_narrative_5tuple_schema.py +139 -0
- puremacro-0.92.0/tests/test_narrative_a_ext_and_ergo.py +252 -0
- puremacro-0.92.0/tests/test_narrative_aggregate_kind.py +90 -0
- puremacro-0.92.0/tests/test_narrative_bbui_district.py +324 -0
- puremacro-0.92.0/tests/test_narrative_benchmarks_c3.py +134 -0
- puremacro-0.92.0/tests/test_narrative_body_extractor_coverage.py +220 -0
- puremacro-0.92.0/tests/test_narrative_cb_connectors.py +246 -0
- puremacro-0.92.0/tests/test_narrative_event_sources.py +86 -0
- puremacro-0.92.0/tests/test_narrative_external_benchmarks.py +98 -0
- puremacro-0.92.0/tests/test_narrative_extractors.py +145 -0
- puremacro-0.92.0/tests/test_narrative_fed_url_transform.py +47 -0
- puremacro-0.92.0/tests/test_narrative_health.py +123 -0
- puremacro-0.92.0/tests/test_narrative_index_to_quarterly.py +147 -0
- puremacro-0.92.0/tests/test_narrative_indices.py +634 -0
- puremacro-0.92.0/tests/test_narrative_indices_crosslingual.py +76 -0
- puremacro-0.92.0/tests/test_narrative_indices_validation.py +57 -0
- puremacro-0.92.0/tests/test_narrative_kernels.py +172 -0
- puremacro-0.92.0/tests/test_narrative_kind.py +119 -0
- puremacro-0.92.0/tests/test_narrative_lexicons_expanded.py +70 -0
- puremacro-0.92.0/tests/test_narrative_llm_scoring.py +135 -0
- puremacro-0.92.0/tests/test_narrative_ltui.py +59 -0
- puremacro-0.92.0/tests/test_narrative_ltui_updown.py +82 -0
- puremacro-0.92.0/tests/test_narrative_lui_cooccurrence.py +53 -0
- puremacro-0.92.0/tests/test_narrative_lwui.py +64 -0
- puremacro-0.92.0/tests/test_narrative_negation.py +90 -0
- puremacro-0.92.0/tests/test_narrative_nlp_modernization.py +238 -0
- puremacro-0.92.0/tests/test_narrative_offline.py +359 -0
- puremacro-0.92.0/tests/test_narrative_panel_coverage.py +1211 -0
- puremacro-0.92.0/tests/test_narrative_predicts_events.py +51 -0
- puremacro-0.92.0/tests/test_narrative_quality.py +389 -0
- puremacro-0.92.0/tests/test_narrative_replication_adler_2024.py +117 -0
- puremacro-0.92.0/tests/test_narrative_replication_cloyne_2013_uk_coverage.py +572 -0
- puremacro-0.92.0/tests/test_narrative_replication_eu_nms_2023.py +117 -0
- puremacro-0.92.0/tests/test_narrative_replication_imf_covid_2022.py +140 -0
- puremacro-0.92.0/tests/test_narrative_replication_mertens_ravn_2013_coverage.py +668 -0
- puremacro-0.92.0/tests/test_narrative_replication_mitchell_historical_coverage.py +489 -0
- puremacro-0.92.0/tests/test_narrative_replication_profiles.py +346 -0
- puremacro-0.92.0/tests/test_narrative_replication_ramey_2011_defense_coverage.py +518 -0
- puremacro-0.92.0/tests/test_narrative_replication_romer_romer_2010_coverage.py +459 -0
- puremacro-0.92.0/tests/test_narrative_replication_romer_romer_2017_coverage.py +581 -0
- puremacro-0.92.0/tests/test_narrative_riskindex.py +124 -0
- puremacro-0.92.0/tests/test_narrative_scoring_manual_coverage.py +590 -0
- puremacro-0.92.0/tests/test_narrative_scoring_monetary.py +131 -0
- puremacro-0.92.0/tests/test_narrative_slice3_connectors.py +475 -0
- puremacro-0.92.0/tests/test_narrative_slice3_prompts.py +107 -0
- puremacro-0.92.0/tests/test_narrative_stability_report.py +193 -0
- puremacro-0.92.0/tests/test_narrative_surprise_filter_profile.py +86 -0
- puremacro-0.92.0/tests/test_narrative_tech_lexicons.py +66 -0
- puremacro-0.92.0/tests/test_narrative_timing_profile.py +221 -0
- puremacro-0.92.0/tests/test_narrative_triple_cooccurrence.py +210 -0
- puremacro-0.92.0/tests/test_narrative_validation.py +372 -0
- puremacro-0.92.0/tests/test_narrative_validation_report_coverage.py +500 -0
- puremacro-0.92.0/tests/test_numerics_coverage.py +432 -0
- puremacro-0.92.0/tests/test_paper.py +50 -0
- puremacro-0.92.0/tests/test_plot.py +112 -0
- puremacro-0.92.0/tests/test_plotting_bw_style_coverage.py +600 -0
- puremacro-0.92.0/tests/test_plotting_irf_plot_coverage.py +531 -0
- puremacro-0.92.0/tests/test_posterior_coverage.py +455 -0
- puremacro-0.92.0/tests/test_public_api.py +97 -0
- puremacro-0.92.0/tests/test_puremacro_regime_dates_coverage.py +644 -0
- puremacro-0.92.0/tests/test_pyodide_compat.py +202 -0
- puremacro-0.92.0/tests/test_pyodide_smoke_runner.py +145 -0
- puremacro-0.92.0/tests/test_random_walk_metropolis.py +95 -0
- puremacro-0.92.0/tests/test_realized_vol_coverage.py +418 -0
- puremacro-0.92.0/tests/test_regimes_coverage.py +616 -0
- puremacro-0.92.0/tests/test_regress_lp.py +94 -0
- puremacro-0.92.0/tests/test_release_check.py +340 -0
- puremacro-0.92.0/tests/test_render_examples_gallery.py +272 -0
- puremacro-0.92.0/tests/test_replication_bloom2009.py +66 -0
- puremacro-0.92.0/tests/test_replication_gali1999.py +70 -0
- puremacro-0.92.0/tests/test_replication_kilian2009.py +76 -0
- puremacro-0.92.0/tests/test_replication_mertens_ravn.py +49 -0
- puremacro-0.92.0/tests/test_replication_rz2018.py +100 -0
- puremacro-0.92.0/tests/test_replication_smoke.py +136 -0
- puremacro-0.92.0/tests/test_reports_coverage.py +643 -0
- puremacro-0.92.0/tests/test_robustness.py +452 -0
- puremacro-0.92.0/tests/test_sa_stl_coverage.py +549 -0
- puremacro-0.92.0/tests/test_sa_x13_coverage.py +576 -0
- puremacro-0.92.0/tests/test_scale.py +99 -0
- puremacro-0.92.0/tests/test_shock_atlas_coverage.py +831 -0
- puremacro-0.92.0/tests/test_shock_atlas_demo.py +26 -0
- puremacro-0.92.0/tests/test_sigma_shapley_coverage.py +580 -0
- puremacro-0.92.0/tests/test_sigma_sigma_numpy_coverage.py +441 -0
- puremacro-0.92.0/tests/test_spectral_coverage.py +565 -0
- puremacro-0.92.0/tests/test_state_ai_exposure.py +26 -0
- puremacro-0.92.0/tests/test_state_space_coverage.py +662 -0
- puremacro-0.92.0/tests/test_synthetic_control_coverage.py +660 -0
- puremacro-0.92.0/tests/test_uncertainty_composite_coverage.py +918 -0
- puremacro-0.92.0/tests/test_uncertainty_decomposition_coverage.py +605 -0
- puremacro-0.92.0/tests/test_uncertainty_diagnostics_coverage.py +671 -0
- puremacro-0.92.0/tests/test_uncertainty_lp_long_coverage.py +623 -0
- puremacro-0.92.0/tests/test_uncertainty_regimes_coverage.py +596 -0
- puremacro-0.92.0/tests/test_us_executive.py +306 -0
- puremacro-0.92.0/tests/test_us_warn_historical.py +303 -0
- puremacro-0.92.0/tests/test_var_bootstrap_coverage.py +557 -0
- puremacro-0.92.0/tests/test_var_bvar_coverage.py +526 -0
- puremacro-0.92.0/tests/test_var_estimate_coverage.py +332 -0
- puremacro-0.92.0/tests/test_var_identify_hetero_coverage.py +477 -0
- puremacro-0.92.0/tests/test_var_panel_coverage.py +520 -0
- puremacro-0.92.0/tests/test_var_regime_girf_coverage.py +432 -0
- puremacro-0.92.0/tests/test_var_regime_ms_var_coverage.py +587 -0
- puremacro-0.92.0/tests/test_var_regime_threshold_coverage.py +616 -0
- puremacro-0.92.0/tests/test_var_regime_tvecm_coverage.py +433 -0
- puremacro-0.92.0/tests/test_var_tvp_coverage.py +553 -0
- puremacro-0.92.0/tests/test_wavelet_coverage.py +584 -0
- puremacro-0.92.0/tests/test_wayback.py +53 -0
puremacro-0.92.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jorge Alonso Ortiz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: puremacro
|
|
3
|
+
Version: 0.92.0
|
|
4
|
+
Summary: Pyodide-compatible empirical macro toolbox: SVAR + LP + GARCH + inference
|
|
5
|
+
Author: Jorge Alonso Ortiz
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Classifier: Topic :: Scientific/Engineering
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: numpy>=1.26
|
|
18
|
+
Requires-Dist: scipy>=1.10
|
|
19
|
+
Requires-Dist: pandas>=2.0
|
|
20
|
+
Requires-Dist: matplotlib>=3.7
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
23
|
+
Requires-Dist: statsmodels>=0.14; extra == "dev"
|
|
24
|
+
Requires-Dist: linearmodels>=5; extra == "dev"
|
|
25
|
+
Requires-Dist: arch>=6; extra == "dev"
|
|
26
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-cov>=5; extra == "dev"
|
|
28
|
+
Requires-Dist: pyyaml>=6; extra == "dev"
|
|
29
|
+
Requires-Dist: openpyxl>=3.1; extra == "dev"
|
|
30
|
+
Requires-Dist: pyarrow>=15; extra == "dev"
|
|
31
|
+
Provides-Extra: narrative
|
|
32
|
+
Requires-Dist: pypdf>=4.0; extra == "narrative"
|
|
33
|
+
Requires-Dist: beautifulsoup4>=4.12; extra == "narrative"
|
|
34
|
+
Requires-Dist: pdfplumber>=0.11; extra == "narrative"
|
|
35
|
+
Provides-Extra: backend
|
|
36
|
+
Requires-Dist: numba>=0.59; extra == "backend"
|
|
37
|
+
Requires-Dist: mlx>=0.9; sys_platform == "darwin" and extra == "backend"
|
|
38
|
+
Provides-Extra: cuda
|
|
39
|
+
Requires-Dist: cupy-cuda12x>=13; extra == "cuda"
|
|
40
|
+
Provides-Extra: notebooks
|
|
41
|
+
Requires-Dist: jupytext>=1.16; extra == "notebooks"
|
|
42
|
+
Requires-Dist: nbconvert>=7; extra == "notebooks"
|
|
43
|
+
Requires-Dist: ipykernel>=6; extra == "notebooks"
|
|
44
|
+
Provides-Extra: data
|
|
45
|
+
Requires-Dist: yfinance>=0.2; extra == "data"
|
|
46
|
+
Requires-Dist: fredapi>=0.5; extra == "data"
|
|
47
|
+
Requires-Dist: xlrd>=2.0.1; extra == "data"
|
|
48
|
+
Provides-Extra: llm
|
|
49
|
+
Requires-Dist: anthropic>=0.40; extra == "llm"
|
|
50
|
+
Provides-Extra: embeddings
|
|
51
|
+
Requires-Dist: sentence-transformers>=2.2; extra == "embeddings"
|
|
52
|
+
Provides-Extra: local-llm
|
|
53
|
+
Requires-Dist: llama-cpp-python>=0.3; extra == "local-llm"
|
|
54
|
+
Requires-Dist: mlx-lm>=0.20; sys_platform == "darwin" and extra == "local-llm"
|
|
55
|
+
Provides-Extra: playground
|
|
56
|
+
Requires-Dist: jupyterlite-core<0.8,>=0.7; extra == "playground"
|
|
57
|
+
Requires-Dist: jupyterlite-pyodide-kernel<0.8,>=0.7; extra == "playground"
|
|
58
|
+
Dynamic: license-file
|
|
59
|
+
|
|
60
|
+
> 🇬🇧 English · 🇪🇸 [Español](README.es.md)
|
|
61
|
+
|
|
62
|
+
# puremacro
|
|
63
|
+
|
|
64
|
+
A **Pyodide-compatible empirical macroeconomics toolbox**: pure-numpy +
|
|
65
|
+
scipy + pandas + matplotlib at runtime, runs on iPad / juno.sh as well
|
|
66
|
+
as a regular workstation.
|
|
67
|
+
|
|
68
|
+
## What's in it
|
|
69
|
+
|
|
70
|
+
**Core econometrics**
|
|
71
|
+
|
|
72
|
+
- **VAR** — reduced-form OLS, BVAR (Minnesota), VECM (Engle-Granger /
|
|
73
|
+
Johansen), TVP-VAR, panel-VAR; IRF / FEVD / GFEVD; residual,
|
|
74
|
+
block, moving-block, and wild bootstrap bands.
|
|
75
|
+
- **SVAR identification** (`var.identify.*`) — Cholesky, Blanchard-Quah,
|
|
76
|
+
sign restrictions (Rubio-Ramirez-Waggoner-Zha), sign + zero
|
|
77
|
+
restrictions (Arias-Rubio Ramirez-Waggoner), sign-robust bands
|
|
78
|
+
(Giacomini-Kitagawa), proxy / external instruments, max-share / news,
|
|
79
|
+
heteroskedasticity (Rigobon), non-Gaussian (Lanne-Meitz-Saikkonen).
|
|
80
|
+
All public estimators return frozen-dataclass `…Result` objects.
|
|
81
|
+
- **Local projections** (`lp.*`) — single-country LP-HAC, LP-IV,
|
|
82
|
+
lag-augmented LP (Plagborg-Møller-Wolf), panel LP with cluster /
|
|
83
|
+
Driscoll-Kraay SE, state-dependent LP, smoothed LP (Barnichon-
|
|
84
|
+
Brownlees B-splines), asymmetric LP (Tenreyro-Thwaites), LP-GARCH-
|
|
85
|
+
state, LP-GARCH-in-mean, mean-group, CCE, quantile LP.
|
|
86
|
+
- **Inference** (`inference.*`) — central HAC OLS, Newey-West, Kiefer-
|
|
87
|
+
Vogelsang fixed-b, Driscoll-Kraay; weak-IV diagnostics (Cragg-Donald,
|
|
88
|
+
Kleibergen-Paap, Anderson-Rubin, Montiel Olea-Pflueger); Hansen-J /
|
|
89
|
+
Stock-Yogo over-id; Pesaran CD, Swamy slope-homogeneity, Quandt-
|
|
90
|
+
Andrews structural breaks, specification curves.
|
|
91
|
+
- **Other estimators** — Diebold-Yilmaz spillover index;
|
|
92
|
+
Diebold-Mariano / Giacomini-White forecast comparison + density-
|
|
93
|
+
forecast scoring (CRPS, log score); Bai-Perron breaks; unit-root
|
|
94
|
+
tests (ADF, KPSS, PP, Zivot-Andrews); Klein QZ solver for linear DSGE
|
|
95
|
+
(Blanchard-Kahn enforced).
|
|
96
|
+
|
|
97
|
+
**Modern macro extensions**
|
|
98
|
+
|
|
99
|
+
- **Staggered DiD** (`did.*`) — Callaway-Sant'Anna, Sun-Abraham,
|
|
100
|
+
Borusyak-Jaravel-Spiess, Synthetic-DiD; bootstrap SE throughout.
|
|
101
|
+
- **Dynamic-panel GMM** (`dynpanel.*`) — Arellano-Bond, Blundell-Bond
|
|
102
|
+
two-step Windmeijer + Hansen-J + AR(1)/AR(2) + Roodman collapse.
|
|
103
|
+
- **High-frequency monetary surprises** (`hfi.*`) — Gertler-Karadi 2015,
|
|
104
|
+
Nakamura-Steinsson 2018, Jarociński-Karadi 2020.
|
|
105
|
+
- **Volatility** (`volatility.*`) — `SigmaObject` (1:1 port of the MAV
|
|
106
|
+
MATLAB class with extended decomposition API), BEKK, CCC, HAR-RV,
|
|
107
|
+
range-based, ARCH-LM / Ljung-Box diagnostics.
|
|
108
|
+
- **Nowcasting** (`nowcast.*`) — Kalman-DFM (Doz-Giannone-Reichlin)
|
|
109
|
+
with ragged-edge handling, Mariano-Murasawa MF-VAR, forecast
|
|
110
|
+
combinations, probabilistic scoring rules.
|
|
111
|
+
- **Growth-at-risk** (`gar.*`) — quantile AR, ABG 2019 skew-t fit, NFCI-
|
|
112
|
+
style FCI.
|
|
113
|
+
- **Cycles / cointegration / factors** — Hamilton 2018 trend-cycle
|
|
114
|
+
filter (`cycles`), Phillips-Hansen FM-OLS / Stock-Watson DOLS /
|
|
115
|
+
Phillips-Ouliaris (`cointegration_modern`), PCA factors + Bai-Ng IC
|
|
116
|
+
(`factor`), MIDAS (`midas`), KORV (2000) system-GMM CES (`korv_gmm`),
|
|
117
|
+
synthetic control + placebo inference (`synthetic_control`).
|
|
118
|
+
- **Spectral / wavelet** (`spectral`, `wavelet`) — Welch PSD / cross-
|
|
119
|
+
spectrum / coherence (numpy.fft only); MODWT-Haar wavelet variance
|
|
120
|
+
decomposition.
|
|
121
|
+
- **Realized volatility** (`realized_vol`) — realized variance, bipower
|
|
122
|
+
variation, Corsi HAR-RV.
|
|
123
|
+
- **Heterogeneous-agent / VFI** (`vfi.*`) — value-function iteration with
|
|
124
|
+
EGM, finite-horizon life-cycle, OLG, Krusell-Smith aggregate shocks,
|
|
125
|
+
Hopenhayn firm entry/exit, Epstein-Zin, permanent types, transition
|
|
126
|
+
paths, and method-of-moments estimation; numpy reference backend with
|
|
127
|
+
optional numba / mlx / cupy acceleration. See `notebooks/` for a
|
|
128
|
+
showcase suite.
|
|
129
|
+
|
|
130
|
+
**Narrative econometrics** (`narrative.*`)
|
|
131
|
+
|
|
132
|
+
Fiscal- / labor- / uncertainty-narrative IV pipeline: canonical
|
|
133
|
+
`NarrativeEvent` / `NarrativeInstrument` schemas, deduplication,
|
|
134
|
+
keyword and manual scoring backends, panel construction, replication
|
|
135
|
+
loaders for canonical datasets (Romer-Romer, Mertens-Ravn). LLM
|
|
136
|
+
scoring backend (`narrative.scoring.llm`) and HTTP source modules
|
|
137
|
+
(`narrative.sources.*`) live as out-of-Pyodide side-channels.
|
|
138
|
+
Sources include:
|
|
139
|
+
- **Beige Book** — Fed Beige Book corpus from federalreserve.gov modern
|
|
140
|
+
+ FOMC historical pages, with per-canonical-section + per-district
|
|
141
|
+
parsing (`puremacro.narrative.sources.iter_beige_book`,
|
|
142
|
+
`puremacro.narrative.indices.bbui`).
|
|
143
|
+
- **US executive narrative** — Economic Report of the President
|
|
144
|
+
(`iter_erp`), State of the Union (`iter_sotu`), and CBO reports
|
|
145
|
+
(`iter_cbo`); three matching indices `erpui`, `sotuui`, `cboui`.
|
|
146
|
+
CBO body fetches transparently fall back to the Wayback Machine
|
|
147
|
+
when cbo.gov returns a DataDome challenge.
|
|
148
|
+
- **EU legislative narrative** — EUR-Lex binding acts (`iter_eurlex`)
|
|
149
|
+
and EU Parliament plenary verbatim (`iter_ep_debates`); two trilingual
|
|
150
|
+
EN/DE/FR indices `eurlex_ui` and `ep_ui`. EUR-Lex enumeration via
|
|
151
|
+
the public Cellar SPARQL endpoint (Wayback-routed per-act fetch
|
|
152
|
+
due to AWS-WAF on the live site); EP via Wayback CDX with coverage
|
|
153
|
+
back to Term 7 (2009-07-14).
|
|
154
|
+
- **Bluesky archive** — central-bank governors + finance ministers via
|
|
155
|
+
AT Protocol (`iter_bluesky_posts`, `bluesky_ui`). Hand-curated 29-
|
|
156
|
+
handle seed list (`BLUESKY_KNOWN_HANDLES`); 12 resolved as of 2026-05-25.
|
|
157
|
+
Multilingual via `languages=...` connector kwarg; the index defaults
|
|
158
|
+
to monthly actor-level text aggregation (`aggregate_to="actor_month"`)
|
|
159
|
+
to mitigate LUI's short-text degradation.
|
|
160
|
+
- **Cross-source disagreement** — `consensus_disagreement` computes
|
|
161
|
+
the cross-sectional mean + std over any subset of narrative indices;
|
|
162
|
+
`CROSS_SOURCE_GROUPS` documents thematic subsets.
|
|
163
|
+
|
|
164
|
+
Connectors hit by WAF / bot-protection (EUR-Lex, EU Parliament, CBO) fall back
|
|
165
|
+
to the Wayback Machine via the shared `puremacro.narrative.sources._wayback`
|
|
166
|
+
helper. Coverage is constrained by what Wayback has snapshotted.
|
|
167
|
+
|
|
168
|
+
**Data pipelines** (newly absorbed; see `ARCHITECTURE.md`)
|
|
169
|
+
|
|
170
|
+
- **Fetchers** (`fetch.*`) — FRED / ALFRED (real-time vintages), SDMX-CSV
|
|
171
|
+
(OECD, Eurostat, ECB, IMF SDMX-Central), EPU / GPR / WUI / JLN /
|
|
172
|
+
Fernald, OECD-MEI / QNA / Energy / FX, ILOSTAT, Yahoo, WB pink
|
|
173
|
+
sheet, plus per-state FRED loaders for the US subnational track.
|
|
174
|
+
- **Panel builders** (`build_panel`, `build_subnational_panel`) — single
|
|
175
|
+
entry points that materialise quarterly / monthly cross-country and
|
|
176
|
+
US-state panels from the fetchers, with regime tagging, SA
|
|
177
|
+
(X-13 / STL fallback), and a derived GARCH-σ pipeline.
|
|
178
|
+
- **Instruments** (`instruments.*`) — instrument registry +
|
|
179
|
+
composition + external loaders (FRED API key path); backbone of the
|
|
180
|
+
LP-IV machinery.
|
|
181
|
+
- **Bartik / shift-share** (`bartik.*`) — shares, sensitivities,
|
|
182
|
+
Rotemberg weights, county-level EPU exposure.
|
|
183
|
+
- **Misc data utilities** — EU-KLEMS 2023 loader (`klems`), BIS NEER
|
|
184
|
+
aggregator (`bis_neer`), G9 homogeneous-vintage splice
|
|
185
|
+
(`long_panel`), Gollin labor share (`labor_share`), real-time
|
|
186
|
+
vintages (`vintages`), seasonal adjustment (`sa`).
|
|
187
|
+
- **Labor flows** — 3-state E/U/N transitions from BLS CPS aggregates
|
|
188
|
+
(`labor_flows`) and 4-state F/I/U/N transitions from ENOE microdata
|
|
189
|
+
for Mexico (`labor_flows_enoe`).
|
|
190
|
+
|
|
191
|
+
**Teaching artefacts**
|
|
192
|
+
|
|
193
|
+
`teaching.*` is a research / teaching side-channel that intentionally
|
|
194
|
+
wraps `statsmodels` / `linearmodels` / `arch` so notebooks can compare
|
|
195
|
+
puremacro's pure-numpy estimators against the canonical packages. **Not
|
|
196
|
+
covered by the Pyodide promise.**
|
|
197
|
+
|
|
198
|
+
## Installation
|
|
199
|
+
|
|
200
|
+
### Local (development)
|
|
201
|
+
|
|
202
|
+
From the `puremacro/` package directory (the one containing this `README.md`
|
|
203
|
+
and `pyproject.toml`):
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
pip install -e .
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
To run the dev parity tests, install the optional dev deps too:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
pip install -e '.[dev]'
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
To use the `narrative.sources` PDF body extractor:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
pip install -e '.[narrative]'
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Other optional extras: `[backend]` (numba + Apple-Silicon mlx), `[cuda]`
|
|
222
|
+
(NVIDIA cupy), `[data]` (yfinance / fredapi / xlrd data fetchers), `[llm]`
|
|
223
|
+
(Anthropic-backed narrative scoring), `[embeddings]` (sentence-transformers
|
|
224
|
+
narrative scoring), `[notebooks]` (jupytext notebook build).
|
|
225
|
+
|
|
226
|
+
For connectors that want opt-in on-disk caching + per-host throttling,
|
|
227
|
+
the variants `safe_get_bytes_cached` and `safe_get_text_cached` apply
|
|
228
|
+
a SHA-256-keyed cache at `~/.cache/puremacro/http/`. Set
|
|
229
|
+
`PUREMACRO_HTTP_NO_CACHE=1` to bypass.
|
|
230
|
+
|
|
231
|
+
### juno.sh / iPad
|
|
232
|
+
|
|
233
|
+
Upload the `puremacro/` directory to your juno.sh workspace, then in a
|
|
234
|
+
notebook cell:
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
%pip install ./puremacro
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Run the LLM features for free (local models)
|
|
241
|
+
|
|
242
|
+
The narrative LLM features (`score_llm`, `llm_prob_kernel`) run on a **local
|
|
243
|
+
model** — no API key, no paid API, $0. Everything else in puremacro is already
|
|
244
|
+
free; this closes the last paid gap.
|
|
245
|
+
|
|
246
|
+
Install an engine once (any one):
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
pip install "puremacro[local-llm]" # MLX (Apple Silicon) + llama.cpp (any OS)
|
|
250
|
+
# or install Ollama (https://ollama.com) — no Python deps — then: ollama pull qwen2.5:3b
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Then swap in a local backend (same signatures as the paid backends):
|
|
254
|
+
|
|
255
|
+
```python
|
|
256
|
+
from puremacro.narrative.scoring import score_llm, LocalBackend
|
|
257
|
+
events = score_llm(records, backend=LocalBackend("qwen2.5-3b-instruct", engine="auto"))
|
|
258
|
+
|
|
259
|
+
from puremacro.narrative.indices import llm_prob_kernel, LocalProvider
|
|
260
|
+
idx = llm_prob_kernel(records, provider=LocalProvider("qwen2.5-3b-instruct"),
|
|
261
|
+
category="economic uncertainty")
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
`engine="auto"` picks the best installed engine (Apple GPU via MLX → llama.cpp →
|
|
265
|
+
a running Ollama server; for LM Studio / vLLM / any OpenAI-compatible server,
|
|
266
|
+
pass `engine="openai"` with `base_url=`). Models: `qwen2.5-3b-instruct` (default),
|
|
267
|
+
`gemma2-2b` (Google), `llama3.2-3b` (Meta), `phi3.5` (Microsoft), or any raw
|
|
268
|
+
engine model id. See `puremacro/examples/narrative_local_llm.py` and the
|
|
269
|
+
`local_llm_uncertainty` notebook. (Local inference is desktop-only — it does not
|
|
270
|
+
run inside the browser playground.)
|
|
271
|
+
|
|
272
|
+
## Pyodide compatibility
|
|
273
|
+
|
|
274
|
+
The runtime promise is: only `numpy + scipy + pandas + matplotlib`
|
|
275
|
+
ever get imported by code that ships in the wheel. `statsmodels`,
|
|
276
|
+
`linearmodels`, `arch`, `pypdf`, and the network fetchers are all
|
|
277
|
+
either dev-only / extras-only or lazy-imported behind a guard.
|
|
278
|
+
|
|
279
|
+
The regression test is `tests/test_pyodide_compat.py` — it walks every
|
|
280
|
+
shippable submodule and asserts no forbidden module lands in
|
|
281
|
+
`sys.modules`. If you add a new optional dependency, follow the
|
|
282
|
+
existing lazy-import pattern (see `narrative.scoring.llm` or
|
|
283
|
+
`fetch._seasonal._x13_arima_analysis` for the canonical examples).
|
|
284
|
+
|
|
285
|
+
## Quickstart
|
|
286
|
+
|
|
287
|
+
**First 5 minutes — offline, no data files, no API key.** The quickest check
|
|
288
|
+
that your install works (a sign-restricted SVAR on a synthetic 3-variable DGP;
|
|
289
|
+
no network, no data, fixed seed):
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
python -m puremacro.examples.sign_restrictions_uhlig
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Or, in Python, on a synthetic system you build in three lines:
|
|
296
|
+
|
|
297
|
+
```python
|
|
298
|
+
import numpy as np
|
|
299
|
+
import pandas as pd
|
|
300
|
+
import puremacro as pm
|
|
301
|
+
|
|
302
|
+
# A small synthetic 3-variable system (no data files, no API key).
|
|
303
|
+
rng = np.random.default_rng(0)
|
|
304
|
+
T = 200
|
|
305
|
+
Y = rng.standard_normal((T, 3)).cumsum(0) # ndarray, shape (T, 3)
|
|
306
|
+
|
|
307
|
+
# Cholesky-identified SVAR with 90% residual-bootstrap bands.
|
|
308
|
+
from puremacro.var.identify.cholesky import cholesky_svar
|
|
309
|
+
res = cholesky_svar(Y, p=2, horizon=20, n_boot=500, ci=0.9)
|
|
310
|
+
print("IRF array shape (H+1, n, n):", res.irf_point.shape) # (21, 3, 3)
|
|
311
|
+
# also available: res.irf_lower, res.irf_upper, res.n_boot, res.n_fail
|
|
312
|
+
|
|
313
|
+
# Single-country LP-HAC: response of y to a synthetic shock.
|
|
314
|
+
panel = pd.DataFrame({"y": Y[:, 0], "shock": rng.standard_normal(T)})
|
|
315
|
+
from puremacro.lp.jorda import lp_hac
|
|
316
|
+
irf = lp_hac(panel, y="y", x="shock", horizons=range(0, 21), n_lags=2)
|
|
317
|
+
print(irf.head()) # columns: h, beta, se, t, lo, hi
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Optional API keys are resolved centrally (none are needed for the synthetic
|
|
321
|
+
examples above):
|
|
322
|
+
|
|
323
|
+
```python
|
|
324
|
+
from puremacro import credentials
|
|
325
|
+
credentials.status() # see what's configured (no values leaked)
|
|
326
|
+
# credentials.require("fred") # raises with a signup URL if the key is missing
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
End-to-end replications of canonical papers live under `puremacro/examples/`
|
|
330
|
+
— Bloom 2009 (`bloom2009.py`), Mertens-Ravn narrative SVAR
|
|
331
|
+
(`svariv_mertens_ravn.py`), Romer-Romer monetary narrative
|
|
332
|
+
(`romer_romer_*.py`), and ~60 more. Most (like the Uhlig example above) are
|
|
333
|
+
fully synthetic and need no data or keys; a few read bundled or fetched data.
|
|
334
|
+
|
|
335
|
+
## Documentation
|
|
336
|
+
|
|
337
|
+
- **`ARCHITECTURE.md`** — module map, stability tiers, Pyodide
|
|
338
|
+
contract, result-object standard. Read this first if you're
|
|
339
|
+
contributing or trying to find where something lives.
|
|
340
|
+
- **`CHANGELOG.md`** — per-release diff, including internal-only refactors.
|
|
341
|
+
- **Per-function docstrings** are the canonical reference; the module
|
|
342
|
+
docstring of each subpackage explains its scope.
|
|
343
|
+
|
|
344
|
+
## Conventions
|
|
345
|
+
|
|
346
|
+
- **Public API per subpackage** is curated via `__init__.py::__all__`;
|
|
347
|
+
the top-level `puremacro` package only re-exports `__version__`.
|
|
348
|
+
- **Frozen-dataclass result objects** for any estimator returning 3+
|
|
349
|
+
fields or non-trivial diagnostics (see `ARCHITECTURE.md` § Result-
|
|
350
|
+
object standard). DataFrames returning named columns are exempt.
|
|
351
|
+
- **Diagnostic errors over silent garbage** — singular `X'X`, non-PD
|
|
352
|
+
Σ, BK violations, and ill-conditioned bootstrap draws raise or warn
|
|
353
|
+
with a message naming the calling function and the likely cause.
|
|
354
|
+
|
|
355
|
+
## Status
|
|
356
|
+
|
|
357
|
+
Pre-1.0; APIs rename freely with consumers updated in the same
|
|
358
|
+
commit. Single-author research package. CI workflows (tests, Pyodide
|
|
359
|
+
gate, mypy, reference drift-guard, playground deploy, PyPI release)
|
|
360
|
+
are defined in `.github/workflows/` and activate once the package is
|
|
361
|
+
split into its own repository; while it lives inside the monorepo
|
|
362
|
+
they are inert, so run `pytest` (or `python tools/release_check.py`)
|
|
363
|
+
locally before tagging a release.
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
> 🇬🇧 English · 🇪🇸 [Español](README.es.md)
|
|
2
|
+
|
|
3
|
+
# puremacro
|
|
4
|
+
|
|
5
|
+
A **Pyodide-compatible empirical macroeconomics toolbox**: pure-numpy +
|
|
6
|
+
scipy + pandas + matplotlib at runtime, runs on iPad / juno.sh as well
|
|
7
|
+
as a regular workstation.
|
|
8
|
+
|
|
9
|
+
## What's in it
|
|
10
|
+
|
|
11
|
+
**Core econometrics**
|
|
12
|
+
|
|
13
|
+
- **VAR** — reduced-form OLS, BVAR (Minnesota), VECM (Engle-Granger /
|
|
14
|
+
Johansen), TVP-VAR, panel-VAR; IRF / FEVD / GFEVD; residual,
|
|
15
|
+
block, moving-block, and wild bootstrap bands.
|
|
16
|
+
- **SVAR identification** (`var.identify.*`) — Cholesky, Blanchard-Quah,
|
|
17
|
+
sign restrictions (Rubio-Ramirez-Waggoner-Zha), sign + zero
|
|
18
|
+
restrictions (Arias-Rubio Ramirez-Waggoner), sign-robust bands
|
|
19
|
+
(Giacomini-Kitagawa), proxy / external instruments, max-share / news,
|
|
20
|
+
heteroskedasticity (Rigobon), non-Gaussian (Lanne-Meitz-Saikkonen).
|
|
21
|
+
All public estimators return frozen-dataclass `…Result` objects.
|
|
22
|
+
- **Local projections** (`lp.*`) — single-country LP-HAC, LP-IV,
|
|
23
|
+
lag-augmented LP (Plagborg-Møller-Wolf), panel LP with cluster /
|
|
24
|
+
Driscoll-Kraay SE, state-dependent LP, smoothed LP (Barnichon-
|
|
25
|
+
Brownlees B-splines), asymmetric LP (Tenreyro-Thwaites), LP-GARCH-
|
|
26
|
+
state, LP-GARCH-in-mean, mean-group, CCE, quantile LP.
|
|
27
|
+
- **Inference** (`inference.*`) — central HAC OLS, Newey-West, Kiefer-
|
|
28
|
+
Vogelsang fixed-b, Driscoll-Kraay; weak-IV diagnostics (Cragg-Donald,
|
|
29
|
+
Kleibergen-Paap, Anderson-Rubin, Montiel Olea-Pflueger); Hansen-J /
|
|
30
|
+
Stock-Yogo over-id; Pesaran CD, Swamy slope-homogeneity, Quandt-
|
|
31
|
+
Andrews structural breaks, specification curves.
|
|
32
|
+
- **Other estimators** — Diebold-Yilmaz spillover index;
|
|
33
|
+
Diebold-Mariano / Giacomini-White forecast comparison + density-
|
|
34
|
+
forecast scoring (CRPS, log score); Bai-Perron breaks; unit-root
|
|
35
|
+
tests (ADF, KPSS, PP, Zivot-Andrews); Klein QZ solver for linear DSGE
|
|
36
|
+
(Blanchard-Kahn enforced).
|
|
37
|
+
|
|
38
|
+
**Modern macro extensions**
|
|
39
|
+
|
|
40
|
+
- **Staggered DiD** (`did.*`) — Callaway-Sant'Anna, Sun-Abraham,
|
|
41
|
+
Borusyak-Jaravel-Spiess, Synthetic-DiD; bootstrap SE throughout.
|
|
42
|
+
- **Dynamic-panel GMM** (`dynpanel.*`) — Arellano-Bond, Blundell-Bond
|
|
43
|
+
two-step Windmeijer + Hansen-J + AR(1)/AR(2) + Roodman collapse.
|
|
44
|
+
- **High-frequency monetary surprises** (`hfi.*`) — Gertler-Karadi 2015,
|
|
45
|
+
Nakamura-Steinsson 2018, Jarociński-Karadi 2020.
|
|
46
|
+
- **Volatility** (`volatility.*`) — `SigmaObject` (1:1 port of the MAV
|
|
47
|
+
MATLAB class with extended decomposition API), BEKK, CCC, HAR-RV,
|
|
48
|
+
range-based, ARCH-LM / Ljung-Box diagnostics.
|
|
49
|
+
- **Nowcasting** (`nowcast.*`) — Kalman-DFM (Doz-Giannone-Reichlin)
|
|
50
|
+
with ragged-edge handling, Mariano-Murasawa MF-VAR, forecast
|
|
51
|
+
combinations, probabilistic scoring rules.
|
|
52
|
+
- **Growth-at-risk** (`gar.*`) — quantile AR, ABG 2019 skew-t fit, NFCI-
|
|
53
|
+
style FCI.
|
|
54
|
+
- **Cycles / cointegration / factors** — Hamilton 2018 trend-cycle
|
|
55
|
+
filter (`cycles`), Phillips-Hansen FM-OLS / Stock-Watson DOLS /
|
|
56
|
+
Phillips-Ouliaris (`cointegration_modern`), PCA factors + Bai-Ng IC
|
|
57
|
+
(`factor`), MIDAS (`midas`), KORV (2000) system-GMM CES (`korv_gmm`),
|
|
58
|
+
synthetic control + placebo inference (`synthetic_control`).
|
|
59
|
+
- **Spectral / wavelet** (`spectral`, `wavelet`) — Welch PSD / cross-
|
|
60
|
+
spectrum / coherence (numpy.fft only); MODWT-Haar wavelet variance
|
|
61
|
+
decomposition.
|
|
62
|
+
- **Realized volatility** (`realized_vol`) — realized variance, bipower
|
|
63
|
+
variation, Corsi HAR-RV.
|
|
64
|
+
- **Heterogeneous-agent / VFI** (`vfi.*`) — value-function iteration with
|
|
65
|
+
EGM, finite-horizon life-cycle, OLG, Krusell-Smith aggregate shocks,
|
|
66
|
+
Hopenhayn firm entry/exit, Epstein-Zin, permanent types, transition
|
|
67
|
+
paths, and method-of-moments estimation; numpy reference backend with
|
|
68
|
+
optional numba / mlx / cupy acceleration. See `notebooks/` for a
|
|
69
|
+
showcase suite.
|
|
70
|
+
|
|
71
|
+
**Narrative econometrics** (`narrative.*`)
|
|
72
|
+
|
|
73
|
+
Fiscal- / labor- / uncertainty-narrative IV pipeline: canonical
|
|
74
|
+
`NarrativeEvent` / `NarrativeInstrument` schemas, deduplication,
|
|
75
|
+
keyword and manual scoring backends, panel construction, replication
|
|
76
|
+
loaders for canonical datasets (Romer-Romer, Mertens-Ravn). LLM
|
|
77
|
+
scoring backend (`narrative.scoring.llm`) and HTTP source modules
|
|
78
|
+
(`narrative.sources.*`) live as out-of-Pyodide side-channels.
|
|
79
|
+
Sources include:
|
|
80
|
+
- **Beige Book** — Fed Beige Book corpus from federalreserve.gov modern
|
|
81
|
+
+ FOMC historical pages, with per-canonical-section + per-district
|
|
82
|
+
parsing (`puremacro.narrative.sources.iter_beige_book`,
|
|
83
|
+
`puremacro.narrative.indices.bbui`).
|
|
84
|
+
- **US executive narrative** — Economic Report of the President
|
|
85
|
+
(`iter_erp`), State of the Union (`iter_sotu`), and CBO reports
|
|
86
|
+
(`iter_cbo`); three matching indices `erpui`, `sotuui`, `cboui`.
|
|
87
|
+
CBO body fetches transparently fall back to the Wayback Machine
|
|
88
|
+
when cbo.gov returns a DataDome challenge.
|
|
89
|
+
- **EU legislative narrative** — EUR-Lex binding acts (`iter_eurlex`)
|
|
90
|
+
and EU Parliament plenary verbatim (`iter_ep_debates`); two trilingual
|
|
91
|
+
EN/DE/FR indices `eurlex_ui` and `ep_ui`. EUR-Lex enumeration via
|
|
92
|
+
the public Cellar SPARQL endpoint (Wayback-routed per-act fetch
|
|
93
|
+
due to AWS-WAF on the live site); EP via Wayback CDX with coverage
|
|
94
|
+
back to Term 7 (2009-07-14).
|
|
95
|
+
- **Bluesky archive** — central-bank governors + finance ministers via
|
|
96
|
+
AT Protocol (`iter_bluesky_posts`, `bluesky_ui`). Hand-curated 29-
|
|
97
|
+
handle seed list (`BLUESKY_KNOWN_HANDLES`); 12 resolved as of 2026-05-25.
|
|
98
|
+
Multilingual via `languages=...` connector kwarg; the index defaults
|
|
99
|
+
to monthly actor-level text aggregation (`aggregate_to="actor_month"`)
|
|
100
|
+
to mitigate LUI's short-text degradation.
|
|
101
|
+
- **Cross-source disagreement** — `consensus_disagreement` computes
|
|
102
|
+
the cross-sectional mean + std over any subset of narrative indices;
|
|
103
|
+
`CROSS_SOURCE_GROUPS` documents thematic subsets.
|
|
104
|
+
|
|
105
|
+
Connectors hit by WAF / bot-protection (EUR-Lex, EU Parliament, CBO) fall back
|
|
106
|
+
to the Wayback Machine via the shared `puremacro.narrative.sources._wayback`
|
|
107
|
+
helper. Coverage is constrained by what Wayback has snapshotted.
|
|
108
|
+
|
|
109
|
+
**Data pipelines** (newly absorbed; see `ARCHITECTURE.md`)
|
|
110
|
+
|
|
111
|
+
- **Fetchers** (`fetch.*`) — FRED / ALFRED (real-time vintages), SDMX-CSV
|
|
112
|
+
(OECD, Eurostat, ECB, IMF SDMX-Central), EPU / GPR / WUI / JLN /
|
|
113
|
+
Fernald, OECD-MEI / QNA / Energy / FX, ILOSTAT, Yahoo, WB pink
|
|
114
|
+
sheet, plus per-state FRED loaders for the US subnational track.
|
|
115
|
+
- **Panel builders** (`build_panel`, `build_subnational_panel`) — single
|
|
116
|
+
entry points that materialise quarterly / monthly cross-country and
|
|
117
|
+
US-state panels from the fetchers, with regime tagging, SA
|
|
118
|
+
(X-13 / STL fallback), and a derived GARCH-σ pipeline.
|
|
119
|
+
- **Instruments** (`instruments.*`) — instrument registry +
|
|
120
|
+
composition + external loaders (FRED API key path); backbone of the
|
|
121
|
+
LP-IV machinery.
|
|
122
|
+
- **Bartik / shift-share** (`bartik.*`) — shares, sensitivities,
|
|
123
|
+
Rotemberg weights, county-level EPU exposure.
|
|
124
|
+
- **Misc data utilities** — EU-KLEMS 2023 loader (`klems`), BIS NEER
|
|
125
|
+
aggregator (`bis_neer`), G9 homogeneous-vintage splice
|
|
126
|
+
(`long_panel`), Gollin labor share (`labor_share`), real-time
|
|
127
|
+
vintages (`vintages`), seasonal adjustment (`sa`).
|
|
128
|
+
- **Labor flows** — 3-state E/U/N transitions from BLS CPS aggregates
|
|
129
|
+
(`labor_flows`) and 4-state F/I/U/N transitions from ENOE microdata
|
|
130
|
+
for Mexico (`labor_flows_enoe`).
|
|
131
|
+
|
|
132
|
+
**Teaching artefacts**
|
|
133
|
+
|
|
134
|
+
`teaching.*` is a research / teaching side-channel that intentionally
|
|
135
|
+
wraps `statsmodels` / `linearmodels` / `arch` so notebooks can compare
|
|
136
|
+
puremacro's pure-numpy estimators against the canonical packages. **Not
|
|
137
|
+
covered by the Pyodide promise.**
|
|
138
|
+
|
|
139
|
+
## Installation
|
|
140
|
+
|
|
141
|
+
### Local (development)
|
|
142
|
+
|
|
143
|
+
From the `puremacro/` package directory (the one containing this `README.md`
|
|
144
|
+
and `pyproject.toml`):
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
pip install -e .
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
To run the dev parity tests, install the optional dev deps too:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
pip install -e '.[dev]'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
To use the `narrative.sources` PDF body extractor:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
pip install -e '.[narrative]'
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Other optional extras: `[backend]` (numba + Apple-Silicon mlx), `[cuda]`
|
|
163
|
+
(NVIDIA cupy), `[data]` (yfinance / fredapi / xlrd data fetchers), `[llm]`
|
|
164
|
+
(Anthropic-backed narrative scoring), `[embeddings]` (sentence-transformers
|
|
165
|
+
narrative scoring), `[notebooks]` (jupytext notebook build).
|
|
166
|
+
|
|
167
|
+
For connectors that want opt-in on-disk caching + per-host throttling,
|
|
168
|
+
the variants `safe_get_bytes_cached` and `safe_get_text_cached` apply
|
|
169
|
+
a SHA-256-keyed cache at `~/.cache/puremacro/http/`. Set
|
|
170
|
+
`PUREMACRO_HTTP_NO_CACHE=1` to bypass.
|
|
171
|
+
|
|
172
|
+
### juno.sh / iPad
|
|
173
|
+
|
|
174
|
+
Upload the `puremacro/` directory to your juno.sh workspace, then in a
|
|
175
|
+
notebook cell:
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
%pip install ./puremacro
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Run the LLM features for free (local models)
|
|
182
|
+
|
|
183
|
+
The narrative LLM features (`score_llm`, `llm_prob_kernel`) run on a **local
|
|
184
|
+
model** — no API key, no paid API, $0. Everything else in puremacro is already
|
|
185
|
+
free; this closes the last paid gap.
|
|
186
|
+
|
|
187
|
+
Install an engine once (any one):
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
pip install "puremacro[local-llm]" # MLX (Apple Silicon) + llama.cpp (any OS)
|
|
191
|
+
# or install Ollama (https://ollama.com) — no Python deps — then: ollama pull qwen2.5:3b
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Then swap in a local backend (same signatures as the paid backends):
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
from puremacro.narrative.scoring import score_llm, LocalBackend
|
|
198
|
+
events = score_llm(records, backend=LocalBackend("qwen2.5-3b-instruct", engine="auto"))
|
|
199
|
+
|
|
200
|
+
from puremacro.narrative.indices import llm_prob_kernel, LocalProvider
|
|
201
|
+
idx = llm_prob_kernel(records, provider=LocalProvider("qwen2.5-3b-instruct"),
|
|
202
|
+
category="economic uncertainty")
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`engine="auto"` picks the best installed engine (Apple GPU via MLX → llama.cpp →
|
|
206
|
+
a running Ollama server; for LM Studio / vLLM / any OpenAI-compatible server,
|
|
207
|
+
pass `engine="openai"` with `base_url=`). Models: `qwen2.5-3b-instruct` (default),
|
|
208
|
+
`gemma2-2b` (Google), `llama3.2-3b` (Meta), `phi3.5` (Microsoft), or any raw
|
|
209
|
+
engine model id. See `puremacro/examples/narrative_local_llm.py` and the
|
|
210
|
+
`local_llm_uncertainty` notebook. (Local inference is desktop-only — it does not
|
|
211
|
+
run inside the browser playground.)
|
|
212
|
+
|
|
213
|
+
## Pyodide compatibility
|
|
214
|
+
|
|
215
|
+
The runtime promise is: only `numpy + scipy + pandas + matplotlib`
|
|
216
|
+
ever get imported by code that ships in the wheel. `statsmodels`,
|
|
217
|
+
`linearmodels`, `arch`, `pypdf`, and the network fetchers are all
|
|
218
|
+
either dev-only / extras-only or lazy-imported behind a guard.
|
|
219
|
+
|
|
220
|
+
The regression test is `tests/test_pyodide_compat.py` — it walks every
|
|
221
|
+
shippable submodule and asserts no forbidden module lands in
|
|
222
|
+
`sys.modules`. If you add a new optional dependency, follow the
|
|
223
|
+
existing lazy-import pattern (see `narrative.scoring.llm` or
|
|
224
|
+
`fetch._seasonal._x13_arima_analysis` for the canonical examples).
|
|
225
|
+
|
|
226
|
+
## Quickstart
|
|
227
|
+
|
|
228
|
+
**First 5 minutes — offline, no data files, no API key.** The quickest check
|
|
229
|
+
that your install works (a sign-restricted SVAR on a synthetic 3-variable DGP;
|
|
230
|
+
no network, no data, fixed seed):
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
python -m puremacro.examples.sign_restrictions_uhlig
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Or, in Python, on a synthetic system you build in three lines:
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
import numpy as np
|
|
240
|
+
import pandas as pd
|
|
241
|
+
import puremacro as pm
|
|
242
|
+
|
|
243
|
+
# A small synthetic 3-variable system (no data files, no API key).
|
|
244
|
+
rng = np.random.default_rng(0)
|
|
245
|
+
T = 200
|
|
246
|
+
Y = rng.standard_normal((T, 3)).cumsum(0) # ndarray, shape (T, 3)
|
|
247
|
+
|
|
248
|
+
# Cholesky-identified SVAR with 90% residual-bootstrap bands.
|
|
249
|
+
from puremacro.var.identify.cholesky import cholesky_svar
|
|
250
|
+
res = cholesky_svar(Y, p=2, horizon=20, n_boot=500, ci=0.9)
|
|
251
|
+
print("IRF array shape (H+1, n, n):", res.irf_point.shape) # (21, 3, 3)
|
|
252
|
+
# also available: res.irf_lower, res.irf_upper, res.n_boot, res.n_fail
|
|
253
|
+
|
|
254
|
+
# Single-country LP-HAC: response of y to a synthetic shock.
|
|
255
|
+
panel = pd.DataFrame({"y": Y[:, 0], "shock": rng.standard_normal(T)})
|
|
256
|
+
from puremacro.lp.jorda import lp_hac
|
|
257
|
+
irf = lp_hac(panel, y="y", x="shock", horizons=range(0, 21), n_lags=2)
|
|
258
|
+
print(irf.head()) # columns: h, beta, se, t, lo, hi
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Optional API keys are resolved centrally (none are needed for the synthetic
|
|
262
|
+
examples above):
|
|
263
|
+
|
|
264
|
+
```python
|
|
265
|
+
from puremacro import credentials
|
|
266
|
+
credentials.status() # see what's configured (no values leaked)
|
|
267
|
+
# credentials.require("fred") # raises with a signup URL if the key is missing
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
End-to-end replications of canonical papers live under `puremacro/examples/`
|
|
271
|
+
— Bloom 2009 (`bloom2009.py`), Mertens-Ravn narrative SVAR
|
|
272
|
+
(`svariv_mertens_ravn.py`), Romer-Romer monetary narrative
|
|
273
|
+
(`romer_romer_*.py`), and ~60 more. Most (like the Uhlig example above) are
|
|
274
|
+
fully synthetic and need no data or keys; a few read bundled or fetched data.
|
|
275
|
+
|
|
276
|
+
## Documentation
|
|
277
|
+
|
|
278
|
+
- **`ARCHITECTURE.md`** — module map, stability tiers, Pyodide
|
|
279
|
+
contract, result-object standard. Read this first if you're
|
|
280
|
+
contributing or trying to find where something lives.
|
|
281
|
+
- **`CHANGELOG.md`** — per-release diff, including internal-only refactors.
|
|
282
|
+
- **Per-function docstrings** are the canonical reference; the module
|
|
283
|
+
docstring of each subpackage explains its scope.
|
|
284
|
+
|
|
285
|
+
## Conventions
|
|
286
|
+
|
|
287
|
+
- **Public API per subpackage** is curated via `__init__.py::__all__`;
|
|
288
|
+
the top-level `puremacro` package only re-exports `__version__`.
|
|
289
|
+
- **Frozen-dataclass result objects** for any estimator returning 3+
|
|
290
|
+
fields or non-trivial diagnostics (see `ARCHITECTURE.md` § Result-
|
|
291
|
+
object standard). DataFrames returning named columns are exempt.
|
|
292
|
+
- **Diagnostic errors over silent garbage** — singular `X'X`, non-PD
|
|
293
|
+
Σ, BK violations, and ill-conditioned bootstrap draws raise or warn
|
|
294
|
+
with a message naming the calling function and the likely cause.
|
|
295
|
+
|
|
296
|
+
## Status
|
|
297
|
+
|
|
298
|
+
Pre-1.0; APIs rename freely with consumers updated in the same
|
|
299
|
+
commit. Single-author research package. CI workflows (tests, Pyodide
|
|
300
|
+
gate, mypy, reference drift-guard, playground deploy, PyPI release)
|
|
301
|
+
are defined in `.github/workflows/` and activate once the package is
|
|
302
|
+
split into its own repository; while it lives inside the monorepo
|
|
303
|
+
they are inert, so run `pytest` (or `python tools/release_check.py`)
|
|
304
|
+
locally before tagging a release.
|