Skip to main content

OG-PHL

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 Ruff
Testing example event parameter example event parameter example event parameter Codecov

OG-PHL is an overlapping-generations (OG) model that allows for dynamic general equilibrium analysis of fiscal policy for the Philippines. OG-PHL is built on the OG-Core framework. 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 at https://pslmodels.github.io/OG-Core and documentation of the specific Philippines calibration of the model is available at https://eapd-drb.github.io/OG-PHL.

Using and contributing to OG-PHL

Install and run OG-PHL by cloning this GitHub repository and installing the ogphl package with its dependencies using uv, as detailed below. (Installing the ogphl package from PyPI with pip is no longer the recommended path: on older Python versions pip silently resolves a years-old release of the model, and the PyPI route does not pin the ogcore version the repository is tested against. The uv workflow installs the exact tested versions of every dependency, including a compatible Python interpreter.)

Installation

There are two ways to install OG-PHL: the easy way, using the OG model family's universal installer, and a manual install that runs the same steps one command at a time. Both start from a terminal, put the model in a new OG-PHL folder inside your current directory (a freshly opened terminal starts in your home folder), and need git.

Before you start: git

On a Mac where you have never used git before, run this line first and accept the dialog that appears:

xcode-select --install

On Windows, install Git first (skip this if you already have it):

winget install --id Git.Git -e --source winget

The easy way: the universal installer

The OG model family has a universal installer that installs the uv tool, downloads the model, builds its environment, and verifies it — for OG-PHL or any of its sibling country models.

On macOS and Linux, paste:

curl -fsSL https://raw.githubusercontent.com/PSLmodels/OG-Core/master/scripts/install.sh -o og-install.sh
bash og-install.sh --repo og-phl --yes

On Windows (PowerShell), paste:

$f = "$env:TEMP\og-install.ps1"; irm https://raw.githubusercontent.com/PSLmodels/OG-Core/master/scripts/install.ps1 -OutFile $f; powershell -ExecutionPolicy Bypass -File $f -Repo og-phl -Yes

When the installer finishes, run the example. On macOS and Linux, paste:

source $HOME/.local/bin/env
cd OG-PHL
uv run python examples/run_og_phl.py

On Windows, open a new PowerShell window (so the just-installed tools are found) and paste:

cd OG-PHL
uv run python examples/run_og_phl.py

Manual install

The same setup as individual commands. On macOS and Linux, paste:

curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
git clone https://github.com/EAPD-DRB/OG-PHL.git
cd OG-PHL
uv run python examples/run_og_phl.py

The second line makes the just-installed uv available in the current terminal; from your next terminal session it is available automatically.

On Windows (PowerShell), install uv:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Then open a new PowerShell window (so the just-installed tools are found) and paste:

git clone https://github.com/EAPD-DRB/OG-PHL.git
cd OG-PHL
uv run python examples/run_og_phl.py

What happens

The first uv run creates the project environment if it does not exist yet — downloading a compatible Python interpreter if needed and installing the exact locked dependencies — and then runs the example. Early in the run you may be asked for a UN API token; just press return, and the model reads the same population data from a public mirror and continues. A full baseline-plus-reform run takes from 35 minutes to more than two hours; when it finishes, its plots and tables are saved under ./examples/OG-PHL-Example/ (see the list of outputs below).

Installing for development or contributing

  • Fork this repository and clone your fork to a directory on your computer.
  • From the terminal, navigate to the cloned directory and run uv sync --extra dev to create a local .venv and install OG-PHL with its development dependencies (uv downloads a compatible Python if you don't already have one).
  • For docs/Jupyter Book work, also run uv sync --extra dev --extra docs.
  • Run commands in the environment with uv run <command>, or activate it first with source .venv/bin/activate (macOS/Linux) or .\.venv\Scripts\Activate.ps1 (Windows).

Run an example of the model

  • From the repository root, run the model with an example reform: uv run python examples/run_og_phl.py.
  • You can adjust the ./examples/run_og_phl.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-PHL-Example/OG-PHL_example_plots
      • This folder will contain a number of plots generated from OG-Core to help you visualize the output from your run
    • ./examples/OG-PHL-Example/OG-PHL_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-PHL-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-PHL-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-PHL-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/OG-PHL-Example/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-PHL 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 ogphl.calibrate import Calibration
from ogphl.utils import is_connected
p = Specifications()
if is_connected():
    c = Calibration(p, update_from_api=True)
    updated_params = c.get_dict()
    p.update_specifications(updated_params)

Disclaimer

The OG-PHL/examples/run_og_phl.py script is kept up to date to run with the main branch of this repo.

Core Maintainers

The core maintainers of the OG-PHL 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-PHL

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

Download files

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

Source Distribution

ogphl-0.1.1.tar.gz (769.6 kB view details)

Uploaded Source

Built Distribution

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

ogphl-0.1.1-py3-none-any.whl (993.1 kB view details)

Uploaded Python 3

File details

Details for the file ogphl-0.1.1.tar.gz.

File metadata

  • Download URL: ogphl-0.1.1.tar.gz
  • Upload date:
  • Size: 769.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ogphl-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a3c43d081cf42e08483b1cb2186fe58938676e5ba6c44350f59cab29bca62fec
MD5 98b39b49ddb7dc04ae8f28f82145c36e
BLAKE2b-256 0628c134b8eaaaf7fabe659882a88b38d5e100cb976d0f1dfc56cdc22fad249e

See more details on using hashes here.

File details

Details for the file ogphl-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ogphl-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 993.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ogphl-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8082483d72c955c04e4ef25ba75a10de59838f3735e5cef7e4dec72a4a94b327
MD5 841c4cab3d3e2d42de9da62cbb446532
BLAKE2b-256 2a9cdb6a04433541fa1b67a906da35143a9045727e7383901da12f816612a303

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page