Contact  |   Impressum  

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 system aims at class room use as well as basis for complex applications, including solving very large models. The work started in 2013 when a CGE for projects with students was required, drawing 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.

In opposite to Tom Rutherford's code originaly used, the new implementation offers a truthfull 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 version with various shifters instead of the standard comparative-static one
  • A single region model with fixed import prices and FOB prices driving bi-lateral export demand
  • 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

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 8.1 data base (e.g. 57 sectors and 134 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 GTAP8 and GTAP9 data bases, including the landuse data linked to Agri-Ecoloigcal Zoning (AEZ) dis-aggregation and the GTAP9 version covering water as a primary factor in crop production.


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
  • myGTAP: Support for several private household, replacement of reigonal 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.
  • 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.
  • GTAP-NUTS2: Dis-aggregation of national production and factor markets to sub-regions. Currently, data area available for about 250 NUTS2 regions for European countries.

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 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
  • loads results from user defined aggregations (GTAPAGG) of versions 6 to 8 of the GTAP data base and converts them into GAMS format
  • 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 129 regions)

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.

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 - please simply send an e-mail to receive a user id and password. 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 6 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

Staff working at ILR on the project



First time setup

Loading data from GTAPAGG

Running a simulation

Looking at results

Last updated: Friday, April 07, 2017