Run G-Cubed in 10–15 minutes

This recipe uses GitHub Codespaces and the public G-Cubed 2R model. It first runs the build 199 baseline and then the USA inflation target permanent increase example experiment. You do not need to install Python or understand the run scripts before you begin.

For G-Cubed Cloud, local computers, private repositories and other ways to run the model, see Deployment options.

Build 199 file guides: YAML formats, model configuration YAML, setup YAML and running experiments.

1. Create your copy of the public model

  1. Sign in to GitHub, or create an account.
  2. Open the public gcubed.com-model-2R repository.
  3. Select Fork near the top-right of the page and create the fork in your own GitHub account.

Forking gives you a copy in which you can save your work. These instructions apply only to the public 2R model. Do not fork a private production-model repository.

2. Open a Codespace

  1. On the main page of your fork, select Code and then Codespaces.
  2. Select Create codespace on main.
  3. Wait for VS Code to open and finish preparing the dev container. The blue progress indicators on the left disappear when it is ready.
  4. From the VS Code menu, select Terminal → New Terminal.

You are now at a shell prompt in the root of your repository. Commands in the rest of this recipe are entered in that terminal.

3. Set up and run the baseline

Move into the build 199 baseline folder:

cd "2R/199/simulations/baseline"

Generate the standard files declared by setup.yaml:

python setup.py

Setup replaces only the generated files it declares. It does not run the model. Now run the maintained baseline script:

python run_baseline.py

The terminal records progress. Wait until it reports that the baseline run completed successfully. The first run solves the model and saves the solution under results/2R/199/baseline/ for the experiment to reuse.

If setup reports a YAML error, read the path and line in the message, correct setup.yaml, and run python setup.py again. The setup YAML recipes explain each part of the file.

4. Set up and run the example experiment

Move from the baseline folder into the supplied example:

cd "../USA inflation target permanent increase"

This experiment permanently raises the USA inflation target by one percentage point. Its setup.yaml declares the simulation layer, design and chartpack. Generate those files:

python setup.py

In the VS Code Explorer, you can now inspect:

  • adjustments.csv, containing the projected shock values;
  • design.yaml, ordering the simulation layer; and
  • chartpack.yaml, selecting the report series.

Run the experiment:

python run_experiment.py

The experiment reuses the baseline’s solved model and writes a separate results folder.

5. Find and download the reports

Use the VS Code Explorer on the left to open the repository’s results folder. The baseline and experiment reports are under:

results/
└── 2R/
    └── 199/
        ├── baseline/
        │   └── html_reports/
        └── USA inflation target permanent increase/
            └── html_reports/

Each html_reports folder contains the HTML reports for that run. Select an HTML file to preview it. To keep a copy on your computer, right-click the file in the Explorer and select Download. The neighbouring projections_data folder contains the CSV data used in the reports, and run.log records the run.

You have completed the quick start

You have now solved the 2R baseline, generated and run a build 199 experiment, and located its reports. Next, change a small value in the experiment’s setup.yaml, rerun python setup.py, inspect the generated layer and rerun the experiment.

Use the shock projection recipes for permanent, temporary, explicit, constant-tail, phase-in and piecewise linear alternatives. Use Git guidance to save your changes, and Getting updates when the model or G-Cubed software changes.

A Codespace can be deleted after a period of inactivity. Commit and push work that you need to retain, and stop the Codespace when you finish so it does not continue to use your allowance.


This site uses Just the Docs, a documentation theme for Jekyll.