Skip to main content

A general equilibribum overlapping generations model for fiscal policy analysis

Project description

OG-Core

Org PSL cataloged OS License: CCO-1.0 Jupyter Book Badge
Package Python 3.9 Python 3.10 Python 3.11 PyPI Latest Release PyPI Downloads Code style: black
Testing example event parameter example event parameter example event parameter Codecov

OG-Core is an overlapping-generations (OG) model core theory, logic, and solution method algorithms that allow for dynamic general equilibrium analysis of fiscal policy. OG-Core provides a general framework and is a dependency of several country-specific OG models, such as OG-USA and OG-UK. The model output includes changes in macroeconomic aggregates (GDP, investment, consumption), 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 here.

Disclaimer

The model is constantly under development, and model components could change significantly. The package will have released versions, which will be checked against existing code prior to release. Stay tuned for an upcoming release!

Using/contributing to OG-Core

There are two primary methods for installing and running OG-Core on your computer locally. The first and simplest method is to download the most recent ogcore Python package from the Python Package Index (PyPI.org). A second option is to fork and clone the most recent version of OG-Core from its GitHub repository and create the conda environment for the ogcore package. We detail both of these methods below.

Installing and Running OG-Core from Python Package Index (PyPI.org)

  • Open your terminal (or Conda command prompt), and make sure you have the most recent version of pip (the Python Index Package manager) by typing on a Unix/macOS machine python3 -m pip install --upgrade pip or on a Windows machine py -m pip install --upgrade pip.
  • Install the ogcore package from the Python Package Index by typing pip install ogcore.
  • Navigate to a folder ./YourFolderName/ where you want to save scripts to run OG-Core and output from the simulations in those scripts.
  • Save the python script run_ogcore_example.py from the OG-Core GitHub repository in the folder where you are working on your local machine ./YourFolderName/run_ogcore_example.py.
  • Run the model with an example reform from terminal/command prompt by typing python run_ogcore_example.py
  • You can adjust the run_ogcore_example.py script by modifying model parameters specified in the og_spec dictionary.
  • Model outputs will be saved in the following files:
    • ./run_example_plots
      • This folder will contain a number of plots generated from OG-Core to help you visualize the output from your run
    • ./ogcore_example_output.csv
      • This is a summary of the percentage changes in macro variables over the first ten years and in the steady-state.
    • ./OUTPUT_BASELINE/model_params.pkl
      • Model parameters used in the baseline run
      • See execute.py in the OG-Core repository for items in the dictionary object in this pickle file
    • ./OUTPUT_BASELINE/SS/SS_vars.pkl
      • Outputs from the model steady state solution under the baseline policy
      • See SS.py in the OG-Core repository for what is in the dictionary object in this pickle file
    • ./OUTPUT_BASELINE/TPI/TPI_vars.pkl
      • Outputs from the model timepath solution under the baseline policy
      • See TPI.py in the OG-Core repository for what is in the dictionary object in this pickle file
    • An analogous set of files in the ./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 more than two hours of compute time.

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

The CSV output file ./ogcore_example_output.csv can be compared to the ./run_examples/expected_ogcore_example_output.csv file in the OG-Core repository to confirm that you are generating the expected output. The easiest way to do this is to copy the example-diffs and example-diffs.bat files from the OG-Core repository and use the sh example-diffs command (or example-diffs on Windows) from the run_examples directory. If you run into errors running the example script, please open a new issue in the OG-Core repo with a description of the issue and any relevant tracebacks you receive.

Installing and Running OG-Core from GitHub repository

  • Install the Anaconda distribution of Python
  • Clone this repository to a directory on your computer
  • From the terminal (or Conda command prompt), navigate to the directory to which you cloned this repository and run conda env create -f environment.yml
  • Then, conda activate ogcore-dev
  • Then install by pip install -e .
  • Navigate to ./run_examples
  • Run the model with an example reform from terminal/command prompt by typing python run_ogcore_example.py
  • You can adjust the ./run_examples/run_ogcore_example.py script by modifying model parameters specified in the og_spec dictionary.
  • Model outputs will be saved in the following files:
    • ./run_examples/run_example_plots
      • This folder will contain a number of plots generated from OG-Core to help you visualize the output from your run
    • ./run_examples/ogcore_example_output.csv
      • This is a summary of the percentage changes in macro variables over the first ten years and in the steady-state.
    • ./run_examples/OUTPUT_BASELINE/model_params.pkl
      • Model parameters used in the baseline run
      • See execute.py for items in the dictionary object in this pickle file
    • ./run_examples/OUTPUT_BASELINE/SS/SS_vars.pkl
      • Outputs from the model steady state solution under the baseline policy
      • See SS.py for what is in the dictionary object in this pickle file
    • ./run_examples/OUTPUT_BASELINE/TPI/TPI_vars.pkl
      • Outputs from the model timepath solution under the baseline policy
      • See TPI.py for what is in the dictionary object in this pickle file
    • An analogous set of files in the ./run_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 more than two hours of compute time.

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

The CSV output file ./run_examples/ogcore_example_output.csv can be compared to the ./run_examples/expected_ogcore_example_output.csv file that is checked into the repository to confirm that you are generating the expected output. The easiest way to do this is to use the sh example-diffs command (or example-diffs on Windows) from the run_examples directory. If you run into errors running the example script, please open a new issue in the OG-Core repo with a description of the issue and any relevant tracebacks you receive.

Core Maintainers

The core maintainers of the OG-Core repository are:

  • Jason DeBacker (GitHub handle: jdebacker), Associate Professor, Department of Economics, Darla Moore School of Business, University of South Carolina; President, PSL Foundation; Vice President of Research and Co-founder, Open Research Group, Inc.
  • Richard W. Evans (GitHub handle: rickecon), Advisory Board Visiting Fellow, Center for Public Finance, Baker Institute for Public Policy at Rice University; President, Open Research Group, Inc.; Director, Open Source Economics Laboratory

Citing OG-Core

OG-Core (Version #.#.#)[Source code], https://github.com/PSLmodels/OG-Core

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

ogcore-0.11.15.tar.gz (417.6 kB view details)

Uploaded Source

Built Distribution

ogcore-0.11.15-py3-none-any.whl (423.9 kB view details)

Uploaded Python 3

File details

Details for the file ogcore-0.11.15.tar.gz.

File metadata

  • Download URL: ogcore-0.11.15.tar.gz
  • Upload date:
  • Size: 417.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for ogcore-0.11.15.tar.gz
Algorithm Hash digest
SHA256 adf73c023f8bbe0b737ae8a2472752208b83d3afb3a0dedcb73b8ccbe9e45354
MD5 9478dc21b892fe455760d2a580bf5320
BLAKE2b-256 0ad4997a0c73c2c990f77b23a07d328554483e416e30a1d95b1dec1b1dbb58b7

See more details on using hashes here.

File details

Details for the file ogcore-0.11.15-py3-none-any.whl.

File metadata

  • Download URL: ogcore-0.11.15-py3-none-any.whl
  • Upload date:
  • Size: 423.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for ogcore-0.11.15-py3-none-any.whl
Algorithm Hash digest
SHA256 9f6c60b982c053a9bce957cfa48c09862e10b89a8e5d38ee7f90a79ad4d75b56
MD5 2a7986018c63f83d07779ac8068f8494
BLAKE2b-256 b999c3c17be498181987f26c0759177398aadf3223e9bef075dcd18bc373c3c9

See more details on using hashes here.

Supported by

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