Skip to main content

South Africa Calibration for OG-Core

Project description

OG-ZAF

Org United Nations DESA PSL cataloged OS License: CC0-1.0 Jupyter Book Badge
Package Python 3.12 Python 3.13 PyPI Latest Release PyPI Downloads Code style: black
Testing example event parameter example event parameter example event parameter Codecov

OG-ZAF is an overlapping-generations (OG) model that allows for dynamic general equilibrium analysis of demographics and fiscal policy for South Africa. OG-ZAF is built on the OG-Core framework. The model output includes changes in macroeconomic aggregates (GDP, investment, consumption), demographics, worker productivity, wages, interest rates, and the stream of tax revenues over time. Regularly updated documentation of the model theory--its output, and solution method--and the Python API is available at https://pslmodels.github.io/OG-Core and documentation of the specific South African calibration of the model is available at https://eapd-drb.github.io/OG-ZAF.

Using and contributing to OG-ZAF

  • If you are installing on a Mac computer, install XCode Tools. In Terminal: xcode-select —install
  • Download and install the appropriate Anaconda distribution of Python. Select the correct version for you platform (Windows, Intel Mac, or M1 Mac).
  • In Terminal:
    • Make sure the conda package manager is up-to-date: conda update conda.
    • Make sure the Anaconda distribution of Python is up-to-date: conda update anaconda.
  • Fork this repository and clone your fork of this repository to a directory on your computer.
  • From the terminal (or Anaconda command prompt), navigate to the directory to which you cloned this repository and run conda env create -f environment.yml. The process of creating the ogzaf-dev conda environment should not take more than five minutes.
  • Then, conda activate ogzaf-dev
  • Then install by pip install -e .

Run an example of the model

  • Navigate to ./examples
  • Run the model with an example reform from terminal/command prompt by typing python run_og_zaf.py
  • You can adjust the ./examples/run_og_zaf.py by modifying model parameters specified in the dictionary passed to the p.update_specifications() calls.
  • Model outputs will be saved in the following files:
    • ./examples/OG-ZAF_example_plots
      • This folder will contain a number of plots generated from OG-Core to help you visualize the output from your run
    • ./examples/ogzaf_example_output.csv
      • This is a summary of the percentage changes in macro variables over the first ten years and in the steady-state.
    • ./examples/OG-ZAF-Example/OUTPUT_BASELINE/model_params.pkl
      • Model parameters used in the baseline run
      • See ogcore.execute.py for items in the dictionary object in this pickle file
    • ./examples/OG-ZAF-Example/OUTPUT_BASELINE/SS/SS_vars.pkl
      • Outputs from the model steady state solution under the baseline policy
      • See ogcore.SS.py for what is in the dictionary object in this pickle file
    • ./examples/OG-ZAF-Example/OUTPUT_BASELINE/TPI/TPI_vars.pkl
      • Outputs from the model timepath solution under the baseline policy
      • See ogcore.TPI.py for what is in the dictionary object in this pickle file
    • An analogous set of files in the ./examples/OUTPUT_REFORM directory, which represent objects from the simulation of the reform policy

Note that, depending on your machine, a full model run (solving for the full time path equilibrium for the baseline and reform policies) can take from 35 minutes to more than two hours of compute time.

If you run into errors running the example script, please open a new issue in the OG-ZAF repo with a description of the issue and any relevant tracebacks you receive.

Once the package is installed, one can adjust parameters in the OG-Core Specifications object using the Calibration class as follows:

from ogcore.parameters import Specifications
from ogzaf.calibrate import Calibration
p = Specifications()
c = Calibration(p, update_from_api=True)
updated_params = c.get_dict()
p.update_specifications(updated_params)

Disclaimer

The organization of this repository will be changing rapidly, but the OG-ZAF/examples/run_og_zaf.py script will be kept up to date to run with the master branch of this repo.

Core Maintainers

The core maintainers of the OG-ZAF repository are:

  • Marcelo LaFleur (GitHub handle: @SeaCelo), Senior Economist, Department of Economic and Social Affairs (DESA), United Nations
  • Richard W. Evans (GitHub handle: @rickecon), Senior Economist, Abundance Institute; President, Open Research Group, Inc.
  • Jason DeBacker (GitHub handle: @jdebacker), Associate Professor, University of South Carolina; Vice President of Research, Open Research Group, Inc.

Citing OG-ZAF

OG-ZAF (Version #.#.#)[Source code], https://github.com/EAPD-DRB/OG-ZAF.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ogzaf-0.1.0.tar.gz (294.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ogzaf-0.1.0-py3-none-any.whl (302.7 kB view details)

Uploaded Python 3

File details

Details for the file ogzaf-0.1.0.tar.gz.

File metadata

  • Download URL: ogzaf-0.1.0.tar.gz
  • Upload date:
  • Size: 294.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ogzaf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1c4a1ea06d51b1327ab404783ba7f996857458362224d98fe620a6e3a5344e26
MD5 292efaaee42abf87dc7b4918bd3e320c
BLAKE2b-256 109c932fcfa5ec18a529fcd677984243dc1288eb2a20459a007a36ec90ffa6f7

See more details on using hashes here.

File details

Details for the file ogzaf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ogzaf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 302.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ogzaf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1af363d61c6e1d28e8738935de22932f956eef13f6000b7955d3e2faa38a78c4
MD5 eba925a2aa422a32f25cbb71de2fc2e7
BLAKE2b-256 96f91ee5c078d862c91fe07e5c93127c9f15fa394cff3c9fcd333d154e94fa0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page