Getting Ready: Structure of the UNI-CGE Model

Organization of Model Code into Sections

A CGE model is a system of equations. The model's code can become lengthy because it not only defines the equations but also must include information on items that support the equations. For example, model commands are needed to select a country database, calibrate equation parameters, prepare model results, and more. 

Because even simple models can become large, they are typically organized in logical sections.  Each section has a different function. For example, different sections address the definitions of variables and parameters, equations for consumer demand and producer supply, model calibration, equilibrium constraints, and report-writing. 

Folded Sections of Model Code

To facilitate viewing a model's structure, its sections of code can be "folded" up, similar to closing an accordion. Folding provides a summary view of the structure of the model, which aids modelers in understanding the role of each section.  

Table 1 describes the structure of the UNI-CGE model by listing its folded sections and their functions. 

Table 1. Structure and Folds of the UNI-CGE Model
1. Sets and Input Data Defines the sets in the model and the country data base
2. Model Parameters Defines all parameters
3. Model Variables Defines all variables
4. Model Equations 5 sub-sections:  Demand, Production, Trade, Equilibrium Constraints, Price Indices/numeraire
5. Parameter Estimation and Calibration Calculates coefficients used in the demand and supply equations
6. Variable Initialization Defines the initial values of variables using data from the SAM
7. Model Closures Modeler chooses closures for savings-investment, government savings, foreign savings and factor markets
8. Model Solution Run and solve the model.  Output describes baseline equilibrium
9. Report Base Model Base data is generated and reported
 Experiments  Sample experiments.  Results of experiment is the updated equilibrium - compare it to baseline to measure effect of shock.
Folding and Unfolding Sections of Code

You can fold and unfold all sections of the model at once using these commands:

ALT + O    folds the entire model into its sections

ALT + Shift + O  unfolds the entire model

You can also choose to unfold or fold only one section.  Click on the arrow next to any "$onfold" statement and only that section will unfold.  Click on the $onfold arrow again to fold it up. 

Figure 1.  Click on $onFold to open a single section of model code

Image shows a finger pointing to the "$onfold command in the model code.

An Exercise:  The UNI-CGE Model will be unfolded when you download it from the course website.  Try to fold and unfold it and compare its folded structure with the sections described in Table 1. 

Copyright Cornerstone CGE 2024 CC 4.0 SA-NC-BY  


Last modified: Wednesday, 1 May 2024, 12:43 PM