Macro Parameter Estimation Functions

Macro Parameter Estimation Functions#

macro_params.py modules

ogzaf.macro_params#

This module uses data from World Bank WDI, World Bank Quarterly Public Sector Debt (QPSD) database, the IMF, and UN ILO to find values for parameters for the OG-ZAF model that rely on macro data for calibration.

ogzaf.macro_params._fetch_wb_data(indicators, country_iso, start_year, end_year, source)[source]#

Fetch a set of World Bank indicators and return a single DataFrame.

Parameters:
  • indicators (dict) – mapping of human-readable labels to indicator codes

  • country_iso (str) – ISO country code

  • start_year (int) – first year to request

  • end_year (int) – last year to request

  • source (int) – World Bank source ID

Returns:

DataFrame indexed by year/quarter label

Return type:

pandas.DataFrame

ogzaf.macro_params._get_imf_macro_params(country_iso, target_year, data_path=None)[source]#

Fetch IMF GFS data and compute alpha_T and alpha_G.

Parameters:
  • country_iso (str) – ISO alpha-3 country code

  • target_year (int) – preferred calibration year

  • data_path (str | Path | None) – optional path to save IMF CSV data

Returns:

IMF-derived macro parameters

Return type:

dict

ogzaf.macro_params.get_macro_params(data_start_date=datetime.datetime(1947, 1, 1, 0, 0), data_end_date=datetime.datetime(2024, 12, 31, 0, 0), country_iso='ZAF', update_from_api=False, imf_data_year=None, imf_data_path=None)[source]#

Compute values of parameters that are derived from macro data

Parameters:
  • data_start_date (datetime) – start date for data

  • data_end_date (datetime) – end date for data

  • country_iso (str) – ISO code for country

  • imf_data_year (int | None) – IMF target year override. Defaults to data_end_date.year when None.

  • imf_data_path (str | Path | None) – optional path to save IMF CSV data

Returns:

dictionary of parameter values

Return type:

macro_parameters (dict)

Note

Only parameters whose documented source is a live API AND which are not curated for internal consistency are refreshed here: gamma (ILOSTAT labour share) and alpha_T (IMF GFS non-interest transfers). Everything else is a curated packaged value and is deliberately NOT updated here, because a refresh would clobber a deliberately-chosen value: g_y_annual (a forward-looking long-run productivity growth, not the stagnant realized series), alpha_G (pinned to fiscal-consistency with the debt target, not the raw GFS figure), the debt block (initial_debt_ratio, initial_foreign_debt_ratio, zeta_D — National Treasury figures, not the wider-perimeter World Bank QPSD), and the r_gov wedge (r_gov_scale from LMWW, r_gov_shift re-anchored to SA’s effective rate and holding the debt-elastic premium’s recentering). Those values live in ogzaf_default_parameters.json and are documented in docs/book/content/calibration/macro.md.