You are here: ILREconomic Modeling of Agricultural SystemsResearch CGEBOX - a modular CGE a GUI

CGEBox, a CGE toolbox with a Graphical User Interface


CGEBOX provides a flexible, extendable and modular code basis for CGE modeling in GAMS drawing on the GTAP data base, combined with a powerful user interface based on GGIG (GAMS Graphical User Interface Generator). The code and user interface is open source and can be downaloded from the internet (see Documentation section). As the model draws on GTAP data base, an appropriate GTAP license is required or the older, by now for-free version of the data base can be used. The system aims at complex applications, including solving very large models, but the user interface and options to visualize and analyze results in tables, maps and graphs render it also useful for class-room use. The work started in 2013 when a CGE for projects with students was required, drawing at that time on the GTAP6inGAMS model by Thomas F. Rutherford.

Release together with the GTAP center

Since 2015, the work on a GAMS based version of GTAP with a user interface intensified when Dominique Van der Mensbrugghe, director of the GTAP center, started work on a release of the GTAP standard model in GAMS. Efforts were joined, and first trial implementations of GTAP modules (GTAP-AGR, GTAP-AEZ) of specific interest to agriculture and land use were integrated in the code base along with intensive testing. That new CGE modeling system was presented in June 2016 as a pre-conference event to the 19th GTAP conference. In parallel, a project jointly with ZEF started in summer 2015 to analyze with a GTAP variant land use changes in the long-run due to changes in global demand for biomass, with a focus on Brazil and Indonesia. Currently, a project for JRC-IPTS looks into food waste issues at European level, using also the GTAP-NUTS2 extenion, while post-doc research applies the model of analyze larger market penetration of bio-plastics. The model was already used in different master theses to analyze e.g FTAs or carbon tax recycling.

In opposite to Tom Rutherford's code originaly used, the new implementation offers a truthful replica of the GTAP Standard model. Using either switches on the interface or by changing the parameterization or the data base underlying the model, different additional features or variants can be derived:

  • A recursive-dynamic long term version G-RDEM by Roberto Roson and Wolfgang Britz
  • A single region model with fixed import prices and FOB prices driving bi-lateral export demand
  • A partial equilibrium set-up where only one or some commodity markets clear and the remaining cross-prices and input demands are fixed and accounts are not closed
  • A two-level CET representation of distribution of supply to domestic use or exports, respectively to different export destination, mimicking the Armington CES representation on the demand side
  • Non-diagonal make matrices where one sector can produce several outputs or one output can be produced by several sectors, with matching CET/CES nests
  • Substitution between intermediates instead of the standard Leontief assumption
  • Substitution between value added and total intermediate demand instead of the standard Leontief assumption
  • Different closures for final, government, investment demand and foreign savings, a version with endogenous exchange rates
  • Support for flexible nestings in the production function, for factor supply and CES-subnests under final demand, based on set-definitions in GAMS. Does not require additional coding of equations and variables
  • Choice between CDE, CD, LES and AIDADS as functional forms in final demand. The AIDADS system is estimated to capture structural changes in demand under larger income changes, relevant for G-RDEM (see below)

A pre-solve algorithm, careful scaling of the model's equations and substituting out linear relationsships ensures that even the model in the full resolution of the GTAP 9 data base (e.g. 57 sectors and 140 regions) can be solved in reasonable time under larger shocks. On demand, the model can be solved as a MCP to capture e.g. production and tariff rate quotas. The code supports GTAP7, GTAP8 and GTAP9 data bases, including the landuse data linked to Agri-Ecological Zoning (AEZ) dis-aggregation and the GTAP9 version covering water as a primary factor in crop production as well as the CO2 and Non-CO2 emission data bases.

The data driver allows to use split factors to dis-aggregated the global SAM to more sector and commodity detail. That is currently applied in a project focusing on bio-plastics. Equally, post-model aggregation of the global SAM can be used to yield non-diagonal make structures.


CGEBox already implements different modules which replicate variants of the GTAP model or provide new extensions which can be combined in applications:

  • GTAP-AGR: intermediate demand nests for feed use in livestock production and for primary agricultural products into food processing sector; a split-up into an agricultural and non-agricultural households; CET-driven factor supply between agriculture and non-agriculture and inside the agricultural sector. Note that water can be aded as primary factor when using the GTAP-WATER data base.
  • GTAP-E: Multi-stage nesting for energy-capital composite in production and demand nests for energy use. CO2 emissions. The GTAP-WATER water data base supported by the data driver also cover additional sector detail in electricity production from the GTAP-Power data base.
  • GTAP-AEZ: Sub-regional land supply linked with CES/CET structures, support to both the 2007 and 2011 releases of the landuse data base, uses volume-preserving CET transformations.
  • myGTAP: Support for several private households, replacement of regional household approach by separate accounts for the different agents. Can be used to define for instance a household drawing income from factor use in agricultural and non-agricultural activities.
  • GTAP-Melitz: Love of varieties linked to endogenous number of firms for each sector and operating on each bi-lateral trade link, increasing return-to-scale based on fixed costs, monopolistic power, separate technology nests for fixed and variable costs. Can be simplifited to a Krugmann model. Which sectors are covered can be chosen by the user. The module is developed and maintained by Yaghoob Jafari and Wolfgang Britz.
  • GTAP-MRIO: Bi-lateral import demand dis-aggregated to total intermediate demand and each final demand agent, split factors courtesy of the OECD secretariate in Paris as used in the OECD's METRO model. Which sectors are covered can be chosen by the user.
  • Tariff lines: A prototype module allows to dis-aggregate selected bi-lateral trade flows to the tariff line level using an additional CES-CET structure. It supports multiple bi-lateral Tariff-Rate-Quotas in combination with a MCP solver.
  • GTAP-NUTS2: Dis-aggregation of national production and factor markets to sub-regions. Currently, data area available for about 280 NUTS2 regions for European countries.
  • GTAP-TIVA: Post model generation of a global Leontief-inverse to derive Trade-In-Value added indicators and to attributes global changes in CO2 / non-CO2 emissions to regional final demand.
  • ALTERTAX: Post-model generation of a global SAM to provide an updated benchmark.
  • FABIO link: FABIO is a MRIO for Agri-Food products (192 countries and 130 products) derived from various FAO data bases by Martin Bruckner. CGEBox has a generic driver to split-up the global GTAP SAM based on FABIO and to post-model dis-aggregate to the full FABIO detail based on proportionality assumptions and application of its Leontoef-Inverse.
  • G-RDEM: A module for generation of long-term baselines which features (1) an AIDADS demand system with non-linear Engel curves, (2) debt accumulation and serving from foreign savings, (3) sector specific productivity growth, (4) macro-economic saving rates adjust to population and GDP dynamic, (5) dynamics IO-Coefficients and factor shares. G-RDEM uses as a default the GDP and population projection at single country level for SSP 1-5 form the IIASSA SSP data base which can be combined with climate change impacts on crop yields from various Global Circulation Models and Gridded Crop Growth models for different RCPs provided by EU-CLIM project.

These extensions can be generally freely combined. Additionally, the first stage Armington nest can be aggregated across agents, or alternatively, all intermediate demand can be aggregated. A link to the FABIO MRIO offers the chances to split-up GTAP SAMs with more detail for agriculture.

Why a Graphical User Interface?

A Graphical User Interface (GUI) allows experienced modlers to work more efficiently with models and to analyze their results while students can step more rapidly into application and analysis.

One major advantage of using models in combination with a suitable GUI is that far less technical knowlege is needed to analyze result, see e.g. Perez et al. 2013 and Britz et al. 2015. That allows using even a complex model such as GTAP in a class without spending time on GAMS or GEMPACK and code implementation - only the concepts matters.

Using the GUI, students can define, run and explore scenarios without in-depth knowledge of the model code, which clearly motivates them to make further steps. The combination of GTAP's flexible aggregation possibilities, the stable and fast implementation of the standard GTAP model as a global, trade oriented CGE in GAMS and a hopefully easy to use interface to run simulations and exploit results thus provides an entry point in the amazing world of CGE analysis. That combination is especially inviting for class use, but might be also interesting in a research environment.

In order to benefit from the explotation possibilities of the GUI, the GAMS code was extended with post-model processing code which maps the simulated values back into a SAM like structure which differentiates values, prices, quantities, tax revenues and tax rates. That structure allows for easy analysis of results. The exploitation part offers a set of structured views, and allows to compare the results to the benachmark point, to produce graphs from the results and to export e.g. to clipboard or EXCEL. Equally, tools for systematic sensitivity anaylsis were added, using a combination of R-scripts and GAMS code, running model solves in parallel.

I would like to thank Arne Drud for his continuous support over the years, not only for the GTAPinGAMS project to make best use of the CONOPT solver. It is also worth to mention Mark Horridge's HAR2GDX utility distributed with GAMS which allows to convert the GTAP data base into a GAMS readable format.


Dr. Tom Rutherford has developed a version of the GTAP model realized in GAMS, which is called GTAP in GAMS, available in different versions and can be downloaded for free. It provides a standard template for a trade oriented, global CGE based on the GTAP data base, is well documented, and loads results from user defined aggregations (GTAPAGG) of versions 6 to 9 of the GTAP data base and converts them into GAMS format. It allows to filter out small values from the GTAP data base while keeping the SAMs and international data base consistent, such that the model solves quite fast even in full resolution (57 sector, and, depending on the version of the data base, up to 134 regions). Not we used originally the GtapInGams6 version and have not checked any later vriosn.

In the context of the class "Applied modeling of agricultural systems" in the winter terms 2013/2014 and 2014/2015 where students develop their own project related to economic modeling, the students decided to work with a global, trade oriented CGE. Tom Rutherford's code was the logical choice for their project, as the students had already some basic knowledge of GAMS, while the GTAP data base is unique in coverage and content. In order to ease especially analyzing results, Tom Rutherford's code was slightly modified to interact with the GAMS Graphical User Interface Generator. That model version, with extensions, was also used in several master thesis projects. The GUI link and further extensions to Tom Rutherford's code is not longer available and was replaced, as mentioned above, by GAMS code derived from ENVISAGE.

Access and documentation

In line with the general philosophy of the GTAP center, the code and the user interface can be used by anybody interested. The code is distributed via a Software Versioning Repository, downloads require a SVN client such as TortoiseSVN. The GUI is based on Java, running under Java Run Time Environment 1.8. Running the code clearly requires a GAMS license, results analysis doesn't. It should also be noted that the by now outdated version 7 of the GTAP data base along with aggregation utility can be downloaded for free, while GTAP offers special free licenses for a their GTAP Africa data base. Detailed information on how to install and use the model can be found in the user manual.

Staff working at ILR on the project




Conference contributions:


Please note that details of the implementation have changed since the vidoes were recorded.

First time setup

Loading data from GTAPAGG

Running a simulation

Looking at results

Last updated: Thursday, March 07, 2019