Calibration

JCGECalibrate loads canonical sets, parameters, and social accounting matrices (SAMs). Its SAM calibration helpers derive starting values and parameters for the production, demand, trade, and fiscal structure used by StandardCGE. Other specifications use the calibrated inputs and formulas appropriate to their own equations. See Imports for preparing source tables before constructing your model's SAM.

Inputs

  • sam.csv: square SAM matrix with labeled rows/columns
  • sets.csv: lists of goods, activities, factors, and institutions with set and item columns
  • Optional: subsets.csv, labels.csv, mappings.csv, params.csv

The Imports guide describes the canonical schema and how to build these files from raw sources.

Outputs

Calibration produces:

  • Parameter tables for production, demand, and tax structures.
  • Starting values for levels and prices.
  • Consistent mappings that align data with model sets.

When a model reports physical quantities, keep their observed baseline values, units, and mappings to model-volume drivers alongside the monetary calibration data. These anchors are not SAM accounts: they provide the input to JCGEOutput satellite reporting and retain a traceable connection between the monetary model and the physical data layer.

Typical workflow

This example uses the SAM bundled with JCGEExamples.StandardCGE.

using JCGECalibrate, JCGEExamples

sam_path = joinpath(JCGEExamples.StandardCGE.datadir(), "sam_2_2.csv")
sam = load_sam_table(sam_path; goods = ["BRD", "MLK"], factors = ["CAP", "LAB"])
start = compute_starting_values(sam)
params = compute_calibration_params(sam, start)

For your own SAM, supply the corresponding account labels. Check that the calibrated values reproduce the baseline for the equations in your model.

Validating calibration

Before building the model, check that:

  • All accounts balance.
  • Mappings cover all required sets.
  • Calibration outputs match the expected model inputs.

If a balance check fails, fix the SAM or mappings before proceeding.

Common pitfalls

  • Misaligned labels between sam.csv and sets.csv.
  • Missing or duplicated accounts in the SAM.
  • Implicit zeros that should be explicit.

Next steps