University of Neuchatel

Institute of Economic Research

IRENE, Working paper **16**-08

GTAPINGAMS, version 9:

Multiregional and small open economy

models with alternative demand systems

Bruno Lanz*

Thomas F. Rutherford**

* University of Neuchâtel, Department of Economics and Business; ETH

Zurich, Chair for Integrative Risk Management and Economics;

Massachusetts Institute of Technology, Joint Program on the Science and

Policy of Global Change. Mail: A.-L. Breguet 2, CH-2000 Neuchâtel,

Switzerland. email: bruno.lanz@unine.ch

** University of Wisconsin, Madison, Department of Agricultural and

Applied Economics. Mail: Taylor Hall, 427 Lorch Street, Madison, WI

53706, USA. email: rutherford@aae.wisc.edu.

GTAPINGAMS, version 9:

Multiregional and small open economy models

with alternative demand systems *

Bruno Lanz † Thomas F. Rutherford ‡

This version: November, 20**16**

Abstract

This paper describes the implementation in GAMS of an economic equilibrium model

based on the GTAP version 9 dataset. We call this model and the ancillary programming

tools GTAPINGAMS, version 9. Relative to previous installments of GTAPINGAMS, an innovation

in this model is that it can easily switch between global multiregional (GMR) and

small open economy (SOE) closures. We also include the possibility to evaluate results

for alternatives representations of final demand, based on Cobb-Douglas preferences,

linear expenditure system or the constant difference in elasticities function. In this paper

we outline the model structure, document the associated equilibrium conditions and

describe computer programs which calibrate the model to the desired regional and sectoral

aggregation from the GTAP9 dataset. We perform a few calculations which illustrate

how alternative structural assumptions influence the policy conclusions derived from the

model.

Keywords: Applied economic analysis; Multiregional models; Small open economy models;

Regulation; Trade policy; Computational models; Calibration.

JEL Codes: C6, C8, D5, F1, R1.

* This paper borrows material from the unpublished manuscripts Rutherford (1997) and Rutherford (2005).

The computer code associated with this paper can be accessed via http://www.mpsge.org/gtap9ingams.zip. We

would like to thank Christoph Boehringer, Justin Caron and Jan Imhof for their contributions to this work. We

remain responsible for any remaining error.

† University of Neuchâtel, Department of Economics and Business; ETH Zurich, Chair for Integrative Risk

Management and Economics; Massachusetts Institute of Technology, Joint Program on the Science and Policy of

Global Change. Mail: A.-L. Breguet 2, CH-2000 Neuchâtel, Switzerland. email: bruno.lanz@unine.ch.

‡ University of Wisconsin, Madison, Department of Agricultural and Applied Economics. Mail: Taylor Hall, 427

Lorch Street, Madison, WI 53706, USA. email: rutherford@aae.wisc.edu.

1 Introduction

Analysis of policies affecting markets in multiple countries requires both data and theory.

The GTAP consortium provides data, and the analysts confronts this data with a theoretical

perspective. 1 Despite some limitations in data coverage and quality, a key practical constraint

lies in the informed translation of theoretical insights into quantitative policy evidence. Our

paper is intended to facilitate this process. We provide computational tools to exploit GTAP

data in conjunction with general equilibrium theory, and thereby contribute to the development

of computable general equilibrium (CGE) analysis. In a nutshell, CGE models rationalize

micro-consistent input-output matrix with a standard Arrow-Debreu general equilibrium

representation of the economy, 2 and quantify ex-ante the impact of a policy relative to an

observed state of affair.

While CGE models represent an increasingly important area of policy research, quantitative

results from such analysis are inherently model-dependent, which offers a challenge for

their role to inform policy-makers. Therefore, expanding the set of modeling strategies is

important both to further the academic state-of-the-art and to foster confidence in the use of

the results for policy-design purposes. With this in mind, this paper introduces a new version

of the GTAPINGAMS model, building on previous contributions by Rutherford (1997) and

Rutherford (2005). As we detail below, this version of the distribution includes both global

multi-regional (GMR) and small open economy (SOE) versions of the GTAPINGAMS model, in

which the SOE model may be single or multi-regional. In addition, users can now toggle

across several representations of final consumer demand, and thus test robustness of model

results in that dimension.

The version of the model we present is based on version 9 of the GTAP database (Aguiar

1 The Global Trade Analysis Project (GTAP) is a research program initiated in 1992 to provide the economic

research community with a global economic dataset for use in the quantitative analysis of international

economic issues. GTAP has lead to the establishment of a global network of researchers who share a common

interest of multi-region trade analysis and related issues, notably climate and energy policy. The GTAP

research is coordinated by Thomas Hertel, Director of the Center for Global Trade Analysis at Purdue University

(see notably Hertel, 1997). As Deputy Director of this Center, Robert McDougall oversees the data base

work (see e.g. McDougall, 2005). Software development within the GTAP project has been assisted greatly

by the efforts of Ken Pearson, Mark Horridge and other researchers from Centre of Policy Studies, Monash

University (see http://www.gtap.org for a list of applications based on the GTAP framework).

2 Input-output matrices provide data on value flows between economic sectors and regions for primary production

factors, intermediate goods and final consumption products. In their micro-consistent versions, such

as those provided in the GTAP data, these matrices provide a complete representation of the economy, such

that no value is lost in transaction. The ensuing dataset represents value flows in a closed economic system.

1

et al., 20**16**), which represents global production and trade for 140 country/regions, 57 commodities

and nine primary factors, two of which (land and natural resources) are “sluggish”

(imperfectly mobile across sectors); see Appendix A for a complete list of sectors and factors

of production. The data characterize intermediate demand and bilateral trade in three

alternative base years (2004, 2007 and 2011), including tax rates on imports and exports

and other indirect taxes. Our implementation gives users the option to exploit recently developed

tools for parallel computation, which can significantly increase computational speed

and makes it less cumbersome to exploit the full dimensionality of the dataset. The dataset

also provides trade elasticities and Armington elasticities, which can be used to control the

international trade response of the model, as well as income and price elasticities for final demand

to parametrize final demand. See Narayanan (2015) for a comprehensive description

of key features of the GTAP 9 database.

By design, the GTAP database is well suited for the formulation of quantitative economic

models, which in turn can be used to simulate the effect of policies.

The principal programming

language for GTAP data and modeling work is GEMPACK (Harrison and Pearson,

1996, 2007). In the GEMPACK framework the model is solved as a system of nonlinear

equations. The present paper describes a version of the GTAP model which has been implemented

in GAMS. The GAMS model is essentially implemented as a nonlinear system of

equations, although it can be posed either as a (primal) constrained non-linear optimization

problem or a mixed complementarity problem (MCP). 3 One potentially important difference

between the GEMPACK framework and previous GTAPINGAMS releases is the representation of

final demand: 4 GEMPACK employs a constant difference of elasticities (CDE) demand system

(Hanoch, 1975), which allows introducing evidence about own-price and income elasticities,

while GTAPINGAMS models uses Cobb-Douglas preferences to represent final demand. The

present distribution includes an implementation of the CDE demand system together with a

least squares calibration code for the CDE which works with the full GTAP dataset and many

aggregations. In addition to the original Cobb-Douglas representation, we also provide the

3 The canonical GTAPINGAMS model is essentially a nonlinear system of equations, as the model does not

include activity analysis nor does it rely on free disposal. Formulation as an MCP imposes some modeling

discipline, as equations must be explicitly linked with variables. Extensions of the model to incorporate, e.g.,

tariff quotas (Hertel et al., 2009) or quantitative restrictions on carbon emissions which may or may not be

binding (Böhringer et al., 20**16**).

4 See Rutherford (2005) for a discussion of the key differences between the two modeling frameworks.

2

option to use a linear expenditure system (LES) representation, with code to parametrize the

function to match own-price and income elasticity data provided in the GTAP dataset.

Therefore, the first and principal contribution of this paper is to document programs included

in the GTAPINGAMS version 9 package. These programs permit analyst to: (i) select

an appropriate level of sectoral and regional aggregation from the GTAP 9 dataset and hence

target a representation that is relevant to the analysis of interest; (ii) systematically filter

out small and economically insignificant activity accounts, which significantly improves robustness

and efficiency of numerically solution; and (iii) re-balance the filtered dataset to

ensure that it represents a micro-consistent system and remains consistent with estimates of

own-price and income elasticities of demand. The paper also provides details about core CGE

models, which are calibrated to the full GTAP datasets for 2004, 2007 and 2011 benchmark

years.

A second contribution is to introduce a new SOE version of the model, and to propose

an approach to calibrate trade elasticity parameters in the SOE model to match the trade response

of the GMR model. This makes it possible to produce consistent comparisons across

trade closures. The SOE formulation necessitates a modest generalization of the standard

GTAP model in which goods produced for domestic and export markets are perfect substitutes.

Following a large literature based on Devarajan et al. (1990), our SOE model differentiates

goods produced for domestic and export markets, applying a constant-elasticity-oftransformation

(CET) revenue function. The SOE model can be used independently of the

GMR model for analysis of trade issues in a one or more countries with fixed terms of trade

relative to the rest of the world. It may also be used in combination with the multiregional

model to decompose the contribution of changes in terms of trade to economic outcomes, as

in Böhringer and Rutherford (2002).

The models developed here offer a very rich framework to evaluate the international

impacts of policies. In the present paper, however, we limit ourselves to a simple illustration

of how the GMR and SOE models can be used to better understand the role of terms of trade

in policy experiments. More specifically, in these simulations we assess the economic impact

of unilateral, proportional adjustment of regional import tariffs and export taxes in the US

and China. In the GTAP database, average trade taxes are a little less than 2% in the US, and

over 4% in China. Our results suggest that the optimal rate depends crucially on whether

3

one works with a multiregional or open economy closure, whereas the representation of final

demand only has a minor impact on the quantitative results.

The remaining of this paper is structured as follows.

Section 2 introduces the core

GTAPINGAMS model. Section 3 presents the equilibrium conditions associated with the dual

(cost minimization) version of the model, which form the basis for the GAMS software. Section

4 introduces the computer code for the model. It further discusses issues about data

aggregation, filtering, and re-balancing, and how GMR and SOE models can be calibrated to

obtain empirically consistent trade responses. Section 5 reports some forensic calculations of

our illustrative policy example. Concluding comments are provided in Section 6. The paper

is complemented by an online appendix which provides all the GAMS files discussed in the

paper (see http://www.mpsge.org/gtap9ingams.zip). 5

2 Canonical Models

This section introduces the structure of core GMR and SOE models included in the GTAPINGAMS

distribution. Both models are static, and track the production and distribution of goods in

the global economy. In GTAP the world is divided into 140 regions (typically representing

individual countries) and 57 commodities (or goods), but computational constraints tend

to limit the number of regions and goods which can be included in a single model. 6

In

each region, final demand structure is composed of public and private expenditure across

goods. Decisions about the allocation of resources are decentralized, and the representation

of behavior by consumers and firms in the model follows the canonical microeconomic optimization

framework: (i) consumers maximize welfare subject to budget constraint with fixed

levels of investment and public output; (ii) producers combine intermediate inputs, and primary

factors (several categories of labor, land, resources and physical capital) at least cost for

given technology. Details about GTAP sectors and primary factors are provided in Appendix

A.

5 The computer programs described here require data files from the GTAP 9 Flexagg package,

flexagg9aY04.zip, flexagg9aY07.zip and flexagg9aY11.zip. License for these data files must

be purchased separately by the users.

6 Datasets are easily aggregated which can be useful for both empirical applications focusing on a subset of

regions and for debugging steps at the model formulation stage.

4

While GMR and SOE models are based on the same data and employ the same representation

of production technology and consumer preferences, they of course differ in their

representation of trade. The GMR model is based on a standard Armington representation of

bilateral trade flows. An implication is that production and consumption decisions in a given

country (or group of countries) will affect world prices, and the magnitude of this effect will

mainly depend on the elasticity estimates (a measure of country-level market-power). By

contrast, the SOE model considers the case in which production and consumption decision in

a country (or group of country) do not affect world prices. This is modeled by treating supply

and demand by the “rest of the world” (ROW, i.e. countries that are not considered relevant

for the SOE analysis) as perfectly elastic. Corner solutions are avoided through the assumption

that output destined for the domestic and export markets are differentiated products

(see De Melo and Robinson, 1989). 7

Therefore, from the perspective of a given country or

group of countries, the impact of policy evaluated in GMR and SOE models will differ through

their impact on the terms of trade.

In the following, we start by describing the basic notation, and then present the structure

of the data together with benchmark accounting identities. We then present a “primal”

description of agents’ optimization problems (i.e. specified in terms of quantity variables),

which leads to the equilibrium conditions presented in the subsequent section.

2.1 Notation

The notation used in the model is summarized in the Tables 1 - 3.

Table 1 defines the

various dimensions which characterize an instance of the model, including the set of sectors/commodities

(i, j), the set of regions (r, s), the set of factors of production (f). Set g

combines the production sectors i and private and public consumption demand (indices "C"

and "G") and investment demand (index "I"). It allows for a much tighter formulation of

the model as they can all be conceived of “goods” produced in similar fashion. To simplify

the exposition of the model, however, we describe private consumption, public consumption

and investment demand as stand alone components.

7 In the present implementation, international closure between the region of interest and the ROW is achieved

by fixing the value of the current account at its benchmark level, and permitting the real exchange rate to

clear the market. Other assumptions are of course possible and are left for future research.

5

Table 1: Definitions of set indices

Set Definition

i, j Sectors, an aggregation of the 57 sectors in the GTAP 9 database

g Production sectors i, plus private consumption "C", public demand

"G" and investment "I"

r, s Regions, an aggregation of the 140 regions in the GTAP 9 database

f Factors of production (consisting of mobile factors, f ∈ m f , four

categories of skilled labor (i. officials, mangers and legislators

(ISCO-88 Major Groups 1-2), ii. technicians and associated professionals,

iii. clerks, and iv. service and market sales workers),

unskilled labor, capital, and sector-specific, f ∈ s f , agricultural land

and other resources)

Table 2: Definitions of activity levels (quantity variables)

Variable Definition

GAMS variable Benchmark (GTAP) value

Y ir Production Y(i,r) vom(i,r)

C r Discretionary consumption Y("c",r) vom("c",r)

G r Aggregate public Y("g",r) vom("g",r)

I r Aggregate investment Y("i",r) vom("i",r)

M ir Aggregate imports M(i,r) vim(i,r)

X ir Trade flows to or from rest of world regions X(i,r) vem(i,r)

FT fr Factor transformation FT(f,r) evom(f,r)

YT j International transport services YT(j) vtw(j)

Table 2 defines the primal variables (activity levels) which characterize an equilibrium.

The model determines values of all the variables except international capital flows, a parameter

which would be determined endogenously in an intertemporal model. Table 2 also

displays the concordance between the variables and their GAMS equivalents.

Table 3 defines the relative price variables for goods and factors in the model. As is the

case in any Shoven-Whalley CGE model, the equilibrium conditions determine relative rather

than nominal prices.

While the core GTAPINGAMS model is base on Cobb-Douglas final demand, the canonical

6

Table 3: Definition of price variables

Variable Definition

GAMS variable

p C r

Final demand price index for the Cobb-Douglas

demand system

P("C",r)

p G r Public provision price index P("G",r)

p I r Investment price index P("I",r)

p Y ir Supply price, gross of indirect producer taxes 8 P(i,r)

p M ir Import price, gross of export taxes and tariffs. PM(i,r)

p E ir

Export price from endogenous or exogenous regions.

PE(i,r)

p T j Marginal cost of transport services PT(j)

p F f,r

Factor prices for factors (mobile factors m f include

labor, land and resources)

PF(f,j)

p S s f ,ir Price of sector-specific primary factors PF(sf,i,j)

Table 4: Additional variables for LES and CDE demand systems

Variable Definition

GAMS variable

SD r Subsistence demand Y("sd",r)

DD r Discretionary demand Y("dd",r)

p DD

r Discretionary demand price index P("dd",r)

p SD

r Subsistence demand price index P("sd",r)

p A iCr

Armington composite price representing the market

price of goods entering CDE demand.

PA(i,r)

models incorporate logic for two additional demand systems: the LES and the CDE demand

system. In particular, the LES representation distinguishes between subsistence demand and

discretionary demand, and we define the additional variables in Table 4. Similarly, we define

an Armington composite price index for products entering CDE final demand.

Finally, Table 5 reports the definition of tax and subsidy rates applied in the model, both

in terms of the notation employed to describe the model and that used in the GAMS code.

7

Table 5: Tax and subsidy rates (net basis unless noted)

Parameter Definition

GAMS Parameter

t o ir Output taxes (gross basis) rto(i,r)

t f fir

Factor taxes rtf(f,i,r)

t fd

t fi

ijr Intermediate input taxes Domestic rtfd(i,j,r)

ijr Imported rtfi(i,j,r)

t pd

t pi

ir Consumption taxes 9 Domestic rtfd(i,"C",r)

ir Imported rtfi(i,"C",r)

t gd

t gi

ir Public demand taxes Domestic rtfd(i,"G",r)

ir Imported rtfi(i,"G",r)

t gd

t gi

ir Investment demand taxes Domestic rtfd(i,"I",r)

ir Imported rtfi(i,"I",r)

t xs

isr Export subsidies rtxs(i,s,r)

t ms

isr Import tariffs rtms(i,s,r)

Note that revenues from taxes and subsidy expenditures do not appear as explicit variables

in the GTAP database and are defined on the basis of expenditures and tax rates. We come

back to this below.

2.2 Benchmark data structure and accounting identities

The economic structure underlying the GTAP dataset and model is illustrated in Figure 1.

Symbols in this flow chart correspond to variables in the economic model (see Table 2): Y ir is

the production of good i in region r, C r , I r and G r portray private consumption, investment

and public demand, respectively, M ir portrays the import of good i into region r, RA r stand

for representative consumers, and F T sf r is the activity through which the set of sector-specific

factors of production (s f ) are allocated to individual sectors. Further, solid lines represent

commodity and factor market flows, while dotted lines indicate tax revenues and transfers.

Domestic and imported goods markets are represented by horizontal lines at the top of the

figure. Domestic production (vom ir ) is distributed to exports (vxmd irs ), international transportation

services (vst ir ), intermediate demand (vdfm ijr ), household consumption (vdfm iCr ),

8

Figure 1: Regional economic structure

vxmdir, vstir

vifm ijr

vdfm ijr vdfm iCr vifm iCr vifm iIr vdfm iIr vdfm iGr vifm iGr

vomir

vimir

Cr Ir Gr Mir

Yir

vomCr vomIr vomGr

vfm m f ,ir

vfm s f ,ir

RAr

FTsf ,r

evomsr

R Y ir R C r

R G r R M ir

vbr

vxmdisr, vtwrjisr

9

investment (vdfm iIr ), and government consumption (vdfm iGr ). 10 The accounting identity in

the GTAP 9 dataset is thus:

vom ir = ∑ s

vxmd irs + vst ir + ∑ j

vdfm ijr + vdfm iCr + vdfm iIr + vdfm iGr ,

where j indexes all goods. Similarly, imported goods (with aggregate value vim ir ) enter intermediate

demand (vifm ijr ), private consumption (vifm iCr + vifm iSDr ) and public consumption

(vifm iGr ). The accounting identity for these flows is thus:

vim ir = ∑ j

vifm ijr + vifm iCr + vifm iSDr + vifm iGr .

Inputs to production of good i (Y ir ) include intermediate inputs (domestic vdfm ijr and

imported vifm ijr ), mobile factors of production (vfm mf ,ir , where m f is a subset of the set f

designating all factors of production), and sector-specific factors of production (vfm sf ,ir , s f ⊂

f). Factor market equilibrium is given by an identity relating the value of factor payments to

factor income:

∑

vfm fir = evom fr ,

i

and factor earnings accrue to households.

International market clearance conditions require that region r exports of good i (vxmd ir

at the top of the figure) equal the imports of the same good from the same region summed

across all trading partners (vxmd isr at the bottom of the figure):

vxm ir = ∑ s

vxmd irs ,

where s, an alias for r, indexes regions. Likewise, market clearance conditions apply for

international transportation services. The supply-demand balance in the market for transportation

service j requires that the sum across all regions of service exports (vst ir , at the top

of the figure) equals the sum across all bilateral trade flows of service inputs (vtwr jisr at the

10 Recall that in the GAMS implementation of the model the index "g" includes all sectors represented in the

model plus private consumption "C", public demand "G" and investment "I". See Table 1. For the LES

demand representation, it also includes price indices for discretionary demand "dd" and subsistence demand

"sd".

10

ottom of the figure):

∑

vst jr = ∑

r

isr

vtwr jisr

Turning to tax revenues and transfers, shown as dotted lines in figure 1, flows labeled with

R correspond to tax revenues. For each country, tax flows consist of indirect taxes on production/exports

of each good (R Y ir ), on consumption (RC r ), on public demand (R G r ) and on

imports (R M ir ). The regional budget constraint thus relates tax payments (RY ir , RC r , R G r , R M ir ),

factor income (evom fr ), and the current account deficit (i.e., net transfers from abroad,

vb r ) to total private consumption expenditure vom Cr , total public consumption expenditure

vom Gr , and total investment vom Ir , yielding:

vom Cr + vom Gr + vom Ir = ∑ f

evom fr + ∑ i

R Y ir + R C r + R G r + ∑ i

R M ir + vb r .

To this point we have outlined two types of consistency conditions which are part of the

GTAP database: market clearance (supply = demand for all goods and factors), and income

balance (net income = net expenditure). A third set of identities involve net operating profits

by all sectors in the economy. In the core GTAP model “production” takes place under

conditions of perfect competition with constant returns to scale, hence there are no excess

profits, and the cost of inputs must equal the value of outputs. This condition applies for each

production sector:

Y ir : ∑ f vfm fir + ∑ ( )

j vdfmijr + vifm ijr + R

Y

ir = vom ir ,

C r : ∑ i (vdfm iCr + vifm iCr ) + RC ir = vom Cr ,

I r : ∑ i vdfm iIr = vom Ir

G r : ∑ i (vdfm iGr + vifm iGr ) + RG ir = vom Gr ,

M ir : ∑ (

s

vxmd isr + ∑ )

j vtwr jisr + R M ir = vim ir

F T fr : evom fr = ∑ i vfm fir

2.3 Decentralized optimization problems

The benchmark identities presented in the previous section indicate the market clearance,

zero profit and income balance conditions which define the GTAP model. The displayed equations

do not, however, characterize the behavior of agents in the model. In a competitive

equilibrium setting, the standard assumption of optimizing atomistic agents applies for both

producers and consumers. This section lays out the optimization problem of each component

11

in the model, and thereby provides the structure of production technology (production functions)

and preferences (characterizing final demand), as well as the representation of trade.

We also highlight where conceptual differences between GMR and SOE models intervene.

Note that in order to simplify notation, we denote decision variables corresponding to

the benchmark data structures with the initial “v” replaced by “d.” Hence, while vdfm jir

represents benchmark data on intermediate demand for good j in the production of good i

in region r, ddfm jir represents the corresponding decision variable in the equilibrium model.

This approach to the scaling of variables is consistent with the GAMS code, and it provides a

flexible and transparent approach with respect to the calibration of activity variables.

2.3.1 Production technology

Starting with producers, profit maximization in the constant returns to scale setting is equivalent

to cost minimization subject to technical constraints. For sector Y ir we characterize

input choices as though they arose from minimization of unit costs:

min

ddfm,dfm,difm

c D ir + cM ir + cF ir (1)

s.t.

c D ir = ∑ j

p Y jr(1 + t fd

jir )ddfm jir

c M ir = ∑ j

p M jr (1 + t fi

jir )difm jir

c F ir = ∑ f

(p F fr | f∈m f

+ p S fir | f∈s)(1 + t f fir )dfm fir

F ir (ddfm,difm,dfm) = Y ir

where F (·) represents the production function, which is described by a nested constantelasticity-of-substitution

(CES) form, with structure displayed in Figure 2.

In the figure, σ values at different nests represent substitution elasticities between inputs,

with σ D i

= esubd i measuring substitution possibility between intermediate inputs produced

domestically and imported from abroad, and esubva i representing substitution possibilities

between primary inputs in the value added nest. Both parameters are provided in the GTAP 9

database (see Hertel and van der Mensbrugghe, 2015). Note further that the specific source

of tax revenue is indicated in this figure, consisting of output taxes, taxes on intermediate

inputs and taxes on factor demands, all of which are applied on an ad-valorem basis.

12

Figure 2: CES nesting structure for production function Y ir = F ir (ddfm,difm,dfm)

˜p Y ir = pY ir (1 − to jr )

σ = 0

σ = 0

σ D . . .

i=1 σi=n D σ = esubva i

˜p Y i=1 ˜p M i=1 ˜p Y i=n ˜p M i=n

˜p Y ijr = pY ir (1 + tfd ijr )

˜p F m f ,r, ˜ p S s f ,ir

˜p M ijr = pM ir (1 + tfi ijr ) ˜pF m f ,jr = pF m f ,r(1 + t f m f ,jr )

˜p S s f ,jr = pS s f ,jr (1 + tf s f ,jr )

Figure 3: CET transformation between domestic and export markets Y ir = G IR (dxm, ddm)

p X ir

p D ir

η = etrndx i

p Y ir

One important difference between GMR and SOE models occurs in the differentiation of

output for domestic and export markets. In particular, the supply of goods to domestic and

export markets are portrayed as arising from the following profit-maximization problem:

max

dxm,ddm

p D irddm ir + p X ir dxm ir (2)

s.t. G ir (ddm ir , dxm ir ) = Y ir (3)

where G is the CET function with structure illustrated in Figure 3. In the GMR model, transformation

elasticities η DX

ir

= etrndx i are set to infinity, which is the default value in the GTAP

9 database. This implies that the supply price of output p Y jr is the same if output is used locally

or in a different region. By contrast, in the SOE model we have that etrndx i < ∞, which

implies that output price may differ when supplied domestically or abroad. In this case, p Y jr

in equation (1) is replaced by p D jr . We come back to the choice of etrndx i in the SOE model

when we present our illustrative calculations.

13

Figure 4: LES nesting for discretionary and subsistence consumption

p DD

r

σ = 1

p SD

r

σ = 0

σi=1 DM

σi=n

DM

. . .

˜p Y 1 ˜p M 1 ˜p Y n ˜p M n

2.3.2 Preferences and final demand

˜p Y ir = pY ir (1 + tpd ir )

˜p M ir = pM ir (1 + tpi

σi=1 DM . . . σi=n

DM

˜p Y 1 ˜p M 1 ˜p Y n ˜p M n

ir )

Private consumption consistent with utility maximization is portrayed by minimization of the

cost of a given level of aggregate consumption:

min

ddfm iCr ,difm iCr

s.t.

∑

i

p Y ir(1 + t pd

ir )ddfm iCr + pM ir (1 + t pi

ir )difm iCr (4)

H r (ddfm iCr , difm iCr ) = C ir

where H r represents final demand from the representative consumer.

Final demand in the core model is characterized by Cobb-Douglas preferences. Alternative

specifications included in the model logic include both the LES and CDE expenditure. 11 The

nested discretionary and subsistence demand functions are is displayed in Figure 4.

2.3.3 Government and public consumption

Public consumption in the model is represented as a fixed coefficient (Leontief) aggregation

of domestic-import composites. This formulation introduces substitution at the second

level between domestic and imported inputs while holding sectoral commodity aggregates

constant. Figure 5 illustrates the functional form.

11 The LES model involves subsistence and discretionary expenditure, which are represented through composite

price indices representing CES aggregates of both domestic and imported inputs, P("DD",r) and

P("SD",r), respectively. The CDE model requires the introduction of trade aggregation activities (A(i,r))

and associated Armington composite price indices, PA(i,r).

14

Figure 5: Nesting structure for public consumption G r = G r (ddfm iGr , difm iGr )

p G r

σ = 0

σ = esubd i=1

. . .

σ = esubd i=n

˜p Y 1 ˜p M 1 ˜p Y n ˜p M n

˜p Y ir = pY ir (1 + tgd ir )

˜p M ir = pM ir (1 + tgi ir )

Figure 6: Armington aggregation of traded goods M ir = A ir (dxmd,dtwr)

p M ir

σ = esubm i

σ = 0 σ = 0

. . .

˜p Y i,s=1

σ = 0 σ = 0

˜p Y i,s=n

˜p T j,s=1

˜p T j,s=n

˜p Y is = pY is (1 − txs isr )(1 + tms isr )

˜p T js = pT j (1 + tms isr )

2.3.4 International trade

The choice among imports from different trading partners is based on Armington’s idea of

regionally differentiated products. The following cost minimization problem formalizes this

choice:

min

dxmd,dtwr

s.t.

∑

(1 + t ms

s

isr)

⎛

A ir (dxmd,dtwr) = M ir

⎝p Y is(1 − t xs

isr)dxmd isr + ∑ j

p T j dtwr jisr

⎞

⎠ (5)

where A is the import aggregation function, described by the nested CES-Leontief function

shown in Figure 6. In the case of the SOE model, in which etrndx i < ∞, p Y is in (5) is replaced

by p X is .

Note that transportation services enter on a proportional basis with imports from different

countries, reflecting differences in unit transportation margins across different goods

15

Figure 7: International transportation services aggregator YT j = T j (dst)

p Y j,1

p T j

. . .

σ = 1

p Y j,n

and trading partners. Therefore, substitution at the top level in an Armington composite involves

trading off of both imported goods and associated transportation services. Trade flows

are subject to export subsidies and import tariffs, with subsidies paid by government in the

exporting region, and tariffs collected by government in the importing region.

The provision of international transportation services is modeled through an aggregation

of transportation services exported from countries throughout the world. More specifically,

we consider the following cost minimization problem for the aggregation of transportation

services:

min

dst

∑

p Y irdst ir s.t. T i (dst) = YT i

r

where the aggregation function T i combines transport service exports from multiple regions.

The functional form which aggregates services from different regions is illustrated in Figure

7.

2.3.5 Supply of sector-specific factors

Land and natural resources are portrayed as sector-specific factors of production supplied

through constant-elasticity-of-transformation (CET) production function allocates composite

factors to sectoral markets. Formally, the supply of sectoral factors of production is modeled

through the following profit-maximization problem:

max

dfm

∑

dfm sf ,jr pS s f ,jr (6)

j

s.t. Γ sf ,r(dfm) = evom sf ,r (7)

where Γ is the CET function with structure illustrated in Figure 8. Note that in the figure η

represents transformation elasticities provided in the GTAP 9 database.

**16**

Figure 8: Sector-specific factor CET transformation function FT sf = Γ sf (dfm)

p S s f ,1r

. . .

p F s f ,r

p S s f ,nr

η = etrae sf

3 Model formulation through equilibrium conditions

An Arrow-Debreu model concerns itself with the interactions of decentralized decisions by

consumers and producers in markets. Mathiesen (1985) proposed a representation of this

class of models in which two types of equations define an equilibrium: zero profit and market

clearance. The corresponding variables defining an equilibrium are activity levels (for

constant-returns-to-scale firms) and commodity prices. 12 Here we extend Mathiesen’s framework

with a third class of variables corresponding to consumer income levels. Commodity

markets encompass primary endowments of households with producer outputs. In equilibrium

the aggregate supply of each good must be at least as great as total intermediate and

final demand. Initial endowments are exogenous. Producer supplies and demands are defined

by producer activity levels and relative prices. Final demands are determined by market

prices.

Economists who have worked with conventional textbook equilibrium models can find

Mathiesen’s framework to be somewhat opaque because many quantity variables need not

be explicitly specified in the model. Variables such as final demand by consumers, factor

demands by producers and commodity supplies by producers, are defined implicitly in Mathiesen’s

model. For example, given equilibrium prices for primary factors, consumer incomes

can be computed, and given income and goods prices, consumers’ demands can then be determined.

The consumer demand functions are written down in order to define an equilibrium,

but quantities demanded need not appear in the model as separate variables. The same is

true of inputs or outputs from the production process: relative prices determine conditional

demand, and conditional demand times the activity level represents market demand. Omit-

12 Under a maintained assumption of perfect competition, Mathiesen (1985) may characterize technology

as constant-returns-to-scale without loss of generality. Specifically, decreasing returns are accommodated

through introduction of a specific factor, while increasing returns are inconsistent with the assumption of

perfect competition. Note that in this environment zero excess profit is consistent with free entry for atomistic

firms producing an identical product.

17

ting decisions variables and suppressing definitional equations corresponding to intermediate

and final demand provides significant computational advantages at the cost of a somewhat

more complicated model statement.

In the following, we detail (i) zero profit conditions, (ii) market clearance conditions,

and (iii) income balance conditions, which in the present case is equivalent to the regional

budget constraint. These three sets of conditions form the basic system of equation to be

solved. Note that the actual code for the model is implemented both in the algebraic mixed

complementarity format (GAMS/MCP, see Rutherford, 1995) and through the more compact

formulation afforded by the GAMS/MPSGE syntax (Rutherford, 1999).

3.1 Zero profit (arbitrage) conditions

All production activities in the model are represented by constant-returns-to-scale technologies,

and markets are assumed to operate competitively with free entry and exit. As a consequence,

equilibrium profits are driven to zero and the price of output reflects the cost of

inputs. The following sets of equations relating output price to marginal cost are part of the

definition of an equilibrium. 13

The calculation of unit cost and unit revenue functions involves the definition of a number

of ancillary variables (that do not appear in the GAMS code as explicit choice variables). In

the following we define ancillary variables in un-numbered equations, indicating that these

variables are “optional” in the sense that they may be substituted out of the non-linear system

of equations. Moreover, we use the symbol θ to portray value shares from the base year data.

In many cases subscripts on these value shares are omitted in order to economize on notation.

Finally, to denote benchmark values we use an overline, so that t pd

ir

value of t pd

ir .

represents the benchmark

3.1.1 Sectoral production (Y(j,r))

Sectoral production combines intermediate inputs with a value-added nest combining primary

inputs (see Figure 2). The unit cost of value-added is a CES composite of skilled and

unskilled labor, land, resources and capital inputs to production, gross of taxes. Factor inputs

13 To retain consistency with the MCP format, we express zero profit conditions as “oriented equations,” with

marginal cost on the LHS and marginal revenue on the RHS.

18

may be sector-specific or mobile across sectors:

⎧⎪ ⎨ p F (1+t f fjr )

p pf

fjr = fr 1+t f fjr

⎪ ⎩

p S (1+t f fjr )

fjr 1+t f fjr

f ∈ m f

f ∈ s f

and the unit cost function is given by:

c f jr = ⎛

⎝ ∑ f

⎞

( ) 1−σ

θ f p pf ⎠

fjr

1/(1−σ)

The user cost of intermediate inputs differs from the market price due to the presence of

taxes on intermediate inputs:

p d ijr = p Y 1 + t fd

ijr

ir

1 + t fd

ijr

p i ijr = p M ir

1 + t fi

ijr

1 + t fi

ijr

A CES cost function describes the minimum cost of a bundle of domestic and imported inputs

to production, based on benchmark value shares and an elasticity of substation σ = esubd i :

c i ijr =

(θ d (p d ijr) 1−σ + (1 − θ d )(p i ijr) 1−σ) 1/(1−σ)

Unit cost of sectoral output is then a Leontief (linear) composite of the costs of intermediate

and value-added composite inputs, based on base-year value shares:

c Y jr = ∑ i

θ i c i ijr + θ f c f jr

Having formulated the unit cost function, it is possible to compactly portray the zero

profit condition for y jr . In equilibrium, the marginal cost of supply equals the market price,

net of taxes:

c Y jr = p Y 1 − t o jr

jr

1 − t o jr

(8)

In the SOE model production for domestic and export markets are differentiated, and we

19

eplace p Y jr by a unit revenue function,

r Y jr = ( θ D jr(p D jr) 1+η + (1 − θ D jr)(p X jr) 1+η) 1/(1+η)

.

3.1.2 Consumer demand (Y("c",r))

In previous versions of GTAPINGAMS the consumer price index represented a Cobb-Douglas

demand system with an Armington substitution between domestic and imported goods prices

gross of tax. This model is retained as one option in the new model, price indices for domestic

and imported goods are given by:

and

ir = p Y 1 + t pd

ir

ir

1 + t pd ,

ir

p dc

p ic

ir = p M 1 + t pi

ir

ir

1 + t pi ,

ir

and the Armington composite price of good i is a CES composite price defined over these

indices

p c ir =

(

θ(p dc

ir ) 1−σ + (1 − θ)(p ic

ir) 1−σ) 1/(1−σ)

.

In addition to the Cobb-Douglas representation of the final demand system, our core

model includes a LES, which combines a Cobb-Douglas discretionary demand with a Leontief

subsistence demand activity. The added complexity of the LES specification permits the model

to be calibrated both to the income and average price elasticities of demand. The price indices

for discretionary and subsistence demand are defined by:

p DD

r

= ∏ i

(p c ir) θC ir , (9)

while the price index for subsistence demand is defined by a Leontief cost function:

p SD

r

= ∑ i

θ SD

i p c ir. (10)

Finally, GAMS code includes a third representation of final demand in the form of the CDE

demand system (Hanoch, 1975). This representation has been part of the GTAP model in

20

GEMPACK for many years, and our implementation follows those of Hertel and van der Mensbrugghe

(2015) and Chen (2015). Similar to the LES demand system, this approach permits

calibrating empirical evidence on both own-price and income elasticities. Some details of

CDE implementation and calibration are described in Appendix C.

3.1.3 Government demand (Y("g",r))

Public expenditure is a fixed-coefficient aggregate of Armington composite goods. Within

each composite domestic and imported goods trade off with a constant elasticity of substitution.

The unit price indices for domestic and imported goods are given by:

and

p dg

ir = pY ir

The composite price of the ith good is then:

pg ir =

1 + t dg

ir

1 + t gd

ir

p ig

ir = 1 + t ig

pM ir

ir

1 + t ig

ir

(

θ(p dg

ir )1−σ + (1 − θ)(p ig

ir )1−σ) 1/(1−σ)

The unit cost of public services (G r ) is defined by the Leontief cost coefficients:

∑

θ i pg ir = p G r . (11)

i

3.1.4 Aggregate imports (M(i,r))

Import cost index applies export taxes, trade and transport margins and import tariffs to the

producer supply prices in exporting regions:

pyisr m = p Y (1 − t xs

isr )(1 + tms

is

(1 − t xs

isr)(1 + t ms

isr )

isr) .

21

In the case of the SOE model, the supply price p Y is is replaced by export price pX is . The unit

price of transportation services is given by:

pt m jisr = p T j

1 + t ms

isr

1 + t ms .

isr

Transportation margins enter as fixed coefficients with bilateral trade flows, so the unit delivered

price is a convex combination of the unit prices with weights corresponding to base

year value shares:

pyt m isr = θpy m isr + ∑ j

θ T j pt m jisr .

Having formed a price index for bilateral imports from region s to region r, the CES cost

index can be defined on the basis of value shares and the elasticity of substitution across

imports from different regions, σ = esubm i :

cim ir =

( ∑

s

θ s (pyt m isr) 1−σ) ) 1/(1−σ)

.

The import activity (m ir ) has a zero profit condition which relates the unit cost of imports to

the market price of the import aggregate:

cim ir = p M ir . (12)

3.1.5 International transportation services (YT(j))

For simplicity, the unit cost of a transportation service depends on the benchmark value shares

of region-specific services through a Cobb-Douglas cost function. Under perfect competition

with free entry, the unit cost of international transport services equals the equilibrium market

price:

∏

(p Y jr) θ j

= p T j (13)

r

In the SOE model, the supply price p Y is in equation is replaced by export price pX is .

22

3.1.6 Sector-specific factor transformation (FT(f,r))

The unit value of sector-specific factors is defined as a CET revenue function based on the

base year value shares (θ j ):

⎛

pvfm fr = ⎝ ∑ j

θ j ps 1+η

fjr

⎞

⎠

1/(1+η)

f ∈ s f .

This defines the profit-maximizing allocation of factors to individual sectors. In equilibrium,

the unit value of the aggregate factor is equal to the maximum unit earnings:

p S fr = pvfm fjr f ∈ s f (14)

3.2 Market clearance

Supply-demand conditions apply to all goods and factors. Benchmark demand and supply

quantities appear as scale factors in many of these equations, typically multiplied by activity

levels which are equal to unity in the reference equilibrium. 14

3.2.1 Firm output (P(i,r))

Aggregate output of good i in region r in the reference equilibrium is vom(i,r):

Y ir vom ir = ∑ j

ddfm ijr + ddfm iCr + ddfm iIr + ddfm iGr + ∑ s

dxmd irs + dst ir (15)

14 While not crucial for representation of the model as a nonlinear system of equations, we follow the MCP convention

in writing out the market clearance conditions. The equations are “oriented”, with supply variables

on the LHS and demands on the RHS. Hence, the sense of the equation is supply ≥ demand. In the core

model equilibrium prices should always be positive, but in extensions of the standard model it might be quite

common to introduce inequalities and complementary slackness, in which case the proper orientation of the

equations is essential. Hence, in equilibrium should the price of a good be zero, economic equilibrium is then

consistent with a market in which supply > demand.

23

where the compensated demand functions can be obtained by differentiating the unit cost

functions:

ddfm ijr = Y jr vdfm ijr

(

) σ

ci ijr

p d ijr

ddfm iCr = C r

(

vdfm iCr

p C r

pc ir

)

ddfm iIr = I r vdfm iIr

ddfm iGr = G r vdfm iGr

dxmd isr = m ir vxmd isr

( p

M

ir

pyt m isr

dst jr = YT j vst jr

p T j

p Y jr

) σ

In the SOE model (etrndx i < ∞) equation (15) is replaced by two equations, one representing

the market for domestic output and another representing the market for exports:

Y ir ddm ir = ∑ j

Y ir dxm ir = ∑ s

ddfm ijr + ddfm iCr + ddfm iIr + ddfm iGr (**16**)

dxmd irs + dst ir . (17)

In these expressions, the compensated domestic and export supply coefficients are given by:

ddm ir = vdm ir

( r

Y

ir

p D ir

) η

( ) r

Y η

dxm ir = vxm ir ir

p X .

ir

3.2.2 Private consumption (P("c",r))

Consumer demand in region r in the reference equilibrium is vom Cr hence:

C r vom Cr = RA r

p C r

(18)

24

3.2.3 Composite imports (PM(i,r))

The aggregate value of imports of good i in region r in the reference equilibrium is vim ir :

M ir vim ir = ∑ j

difm ijr + difm iCr + difm iGr (19)

where compensated demand functions are given by:

3.2.4 Transport services (PT(j))

difm ijr = Y jr vifm ijr

(

) σ

ci ijr

p i ijr

( ) σ pcir p C r

difm iCr = C r vifm iCr

p ic

ir

( ) σ

pg ir p

G

difm iGr = G r vifm r

iGr

p ig

ir

The aggregate demand (and supply) for transport service j in the benchmark equilibrium is

vtw j :

pc ir

pg ir

YT j vtw j = ∑ isr

dtwr jisr (20)

where

( ) p

M σ

dtwr jisr = M ir vtwr ir

jisr

pyt m .

isr

3.2.5 Primary factors (PF(f,r))

The aggregate demand (and supply) of primary factor f in region r is evom fr :

⎧

⎪⎨

∑

j

evom fr =

dfm fjr f ∈ m f

(21)

⎪⎩ evom fr FT fr f ∈ s f

where the demand for primary factor is given by:

dfm fjr = Y jr vfm fjr

(

cf jr

p pf

fjr

) σ

.

25

3.2.6 Specific factors (PS(f,j,r))

The net value of benchmark payments to factor f in sector j in region r is vfm(f,j,r):

( )

p

S η

sf ,jr

vfm fjr

p F = dfm fjr (22)

m f ,r

where the demand for primary factor is written above.

3.3 Regional budget (RA(r))

Private and public incomes are given by :

RA r = ∑ f

p F fr evom fr + p C n vb r − p I rvom Ir − p G r vom Gr + R r (23)

The base year current account deficit in region r is vb(r), and region r = n corresponds

to the “numeraire region” who’s consumption prices denominates international capital flows

(following conventional static trade theory, we hold the current account deficit fixed in counterfactual

analysis). Furthermore, tax revenue in region r consists of output taxes, intermediate

demand taxes, factor taxes, final demand taxes, import tariffs and export subsidies:

R r =

∑ j Ro jr + ∑ ( )

ij

R fd

ijr + Rfi ijr

+ ∑ (

i

R pd

ir + Rpi ir + Rgd ir + Rgi ir

+ ∑ fj Rf fjr

)

− ∑ is Rxs irs + ∑ is Rms isr

(24)

Each of these components of tax revenue can be calculated as an ad-valorem or proportional

tax rate times a market price times the quantity demanded or produced.

Taxes related to Y ir include output taxes: 15

R o jr = t o jrvom jr p Y jrY jr [REV TO(g,r)] ,

tax revenue from intermediate inputs:

R fd

ijr = tfd ijr pY irddfm ijr [REV TFD(i,j,r)] ,

15 Tax revenues in the GAMS codes – both MCP and MGE are represented by the macros indicated in square

brackets.

26

R fi

ijr = tfi ijr pM ir difm ijr , [REV TFI(i,j,r)] ,

and factor tax revenue:

R f fjr = tf fjr pF fr dfm fjr [REV TF(f,g,r)] .

Taxes on household consumption of domestic and imported goods are:

R pd

ir = tpd ir pY irddfm iCr , [REV TFD(i,"C",r)] ,

and

R pi

ir = tpi ir pM ir difm iGr [REV TFI(i,"C",r)] .

Taxes on public demand for domestic and imported goods are:

R gd

ir = tgd ir pY irddfm iGr [REV TFD(i,"G",R)] ,

and

R gi

ir = tgi ir pM ir difm iGr [REV TFI(i,"G",r)] .

Export subsidies (paid by the government in the exporting region) are:

R xs

irs = t xs

irsp Y irdxmd irs [REV TXS(i,r,s)] ,

and import tariff revenues are given by:

R ms

isr = t ms

isr

⎛

⎝p Y is(1 − t xs

isr)dxmd isr + ∑ j

p T j dtwr jisr

⎞

⎠ [REV TMS(i,s,r)] .

4 Implementation and computer code

This section describes the implementation of GMR and SOE models in GAMS using the GTAP 9

dataset. We first describe the content of the distribution directory, and provide the logic of the

model buildstream. We then discuss a number of issues related to data manipulation, namely

aggregation across commodities and regions, data filtering and re-balancing.

Finally, we

27

discuss calibration of elasticities for international trade in GMR and SOE models, providing

an intuitive (Marshallian) argument on how both models can be parametrized in order to

approximate the same responsiveness to policy shocks.

4.1 Distribution Folders

We now overview the structure of the distribution directory. Practicalities on how to run the

code is provided in Appendix B. Additional details about the directories and GAMS programs

provided in GTAPINGAMS version 9 are provided in Appendix Appendix D. More detailed

comments may also be found in comments interspersed in the GAMS code portions of which

are presented in Appendix Appendix E.

The distribution directory contains eight second-level subdirectories, whose content we

now overview in alphabetical sequence:

BUILD contains a command script which automates dataset construction.

This script calls

programs stored in the CODE subfolder, including FLEX2GDX.GMS, which translates data

from .HAR to .GDX format, **16** FILTER.GMS, a program which filters and then rebalances

the core dataset (see data filtering section below), GTAP9DATA.GMS, a program which

reads a .GDX GTAPINGAMS dataset, GTAPAGGR.GMS, a program which performs dataset

aggregation, and CDECALIB.GMS, a program which computes coefficients of the CDE

demand system which are consistent with price and income elasticities of demand.

The distributed copy of build.gms reads, filters and aggregates data files for 2011.

At the end of the computational process, listing files can be found in the BUILD directory,

while the associated .GDX data files generated by these routines are saved in the

GAMSDATA directory. See Appendix D for more details about the build process.

CODE contains the main GAMS program files which are included in this distribution. These

files need not reside in this directory, but they are self contained and should always

be moved as a collection.

Two of the files in this directory contain GAMS code for

the canonical static model, both specified as a mixed complementarity problem in two

alternative representations:

**16** The .HAR format is used in the original distribution of the GTAP dataset. These data files need to be obtained

separately and stored in the GTAPDATA subdirectory, which is discussed below.

28

MGE.GMS The standard model with tabular GAMS/MPSGE representation, and

MCP.GMS The standard model with an algebraic GAMS/MCP representation.

DEFINES contains mapping files for aggregations of GTAP 9 datasets.

Files ending with .MAP

define an aggregation in terms of the source dataset and mappings from sets in the

source to sets in the target. Three single dimensional sets and three two-dimensional

tuples are included in each mapping file. The sets and tuples are defined as follows:

set rr

ii

ff

mapr(r,rr)

mapi(i,ii)

mapf(f,ff)

Regions in the aggregation,

Commodities in the aggregation,

Primary factors in the aggregation,

Mapping of source to target regions (from-to),

Mapping from source to target commodities

Mapping from source to target factors;

As an example, here is a set and mapping which aggregates skilled labor types:

set ff Factors in the aggregated data /

skl Skilled workers,

lab Agricultural and unskilled workers,

lnd Land,

cap Capital,

res Natural resources /;

set mapf(f,ff) Factor aggregation assignments /

mgr.skl Officials and Mangers legislators (ISCO-88 Major Groups 1-2),

tec.skl Technicians technicians and associate professionals

clk.skl Clerks

srv.lab Service and market sales workers

lab.lab Agricultural and unskilled workers (Major Groups 6-9)

lnd.lnd Land,

cap.cap Capital,

res.res Natural resources /;

Four alternative regional / commodity aggregation are included in the DEFINES directory

to illustrate how aggregation works in GTAPINGAMS. The first is the full disaggregate

database GTAPINGAMS.MAP which retains all regions and markets from the

GTAP database after original data have been filtered and a few sector labels have been

changed. 17

Three aggregated datasets are based on regional disaggregation which distinguishes

the G20, other oil exporters, a composite region representing other low income coun-

17 The sectoral identifier which differ from the GEMPACK model are as follows: OIL (crude oil) is relabeled CRU,

COA (coal) becomes COL, P C (petroleum and coal products) becomes OIL, ELY (electricity) becomes ELE, and

ELE (electronic equipment) becomes EEQ.

29

tries and a composite region representing other middle income countries. The G20 IEA

aggregates commodities into 23 sectors included in the International Energy Agency

energy database, and G20 MACRO aggregates to a four commodity sectoral mapping

distinguishing agriculture, manufacturing, services and energy.

DOC contains the paper you are reading (please check the version).

FORENSICS contains GAMS programs illustrating how the distribution can be used to carry out policy

analysis. Specifically, we provide code to evaluate the sensitivity of unilateral trade tax

reform with respect to final demand system and model closure. Program RUNS.GMS

generates RUNS.BAT, a Windows batch command file for systematic sensitivity analysis.

This executes a sequence of calculations under alternative closures and policy region,

each corresponding to an invocation of the scenario file TGRID.GMS. Results from the

sequence of simulations are merged into a PivotChart dataset in an Excel workbook.

GAMSDATA contains the datasets generated by running build.gms in the BUILD directory. More

specifically, files that are created and stored in this directory have a GAMS data-exchange

(*.GDX) extension and are constructed data files that are either used as the source data

for aggregation (e.g. GSD.GDX) or the target data emerging from the data aggregation

(e.g. the fill GTAP data stored as GTAP9INGAMS.GDX), data files which are then then used

in conjunction with the model files). Here are the sizes of the 2011 datasets produced

for a 2011 base year:

gsd.gdx 43,910,349 ! Produced by flex2gdx.gms

gsd_5.gdx 26,690,775 ! Produced by filter.gms -- nd=5

gtap9ingams.gdx 25,923,318 ! Aggregated from gsd_5 to relabel

g20.gdx 3,770,394 ! Aggregated from gtap9ingams.

g20_iea.gdx 992,710 ! Aggregated from g20 (23 sectors)

g20_macro.gdx 113,224 ! Aggregated from g20 (4 sectors)

GTAPDATA contains .zip files from the GTAP distribution (Flexagg package). These files are not

provided in the GTAPINGAMS distribution, but must be copied here by the user. They

may include any or all of these files:

23-Aug-20**16** 2:57:22p 77,6**16**,861 flexagg9aY04.zip

23-Aug-20**16** 2:57:38p 80,406,868 flexagg9aY07.zip

23-Aug-20**16** 2:57:08p 80,056,730 flexagg9aY11.zip

30

TEST contains programs which provide a consistency test of models. See Appendix D for a

description of these programs.

4.1.1 Aggregation across commodities

Any GTAPINGAMS dataset may be aggregated into fewer regions, sectors and primary factors.

This permits a modeler to do preliminary model development using a small dataset to ensure

rapid response and a short debug cycle. After having implemented a small model, it is then

a simple matter to expand the number of sectors and/or regions in order to obtain a more

precise empirical estimate.

Conveniently, all GTAP datasets are defined in terms of three primary sets: i, the set of

sectors and produced commodities, r the set of countries and regions, and f the set of primary

factors. Table A1 presents the identifiers for the 59 GTAP 9 sectors in their most disaggregate

form (see Appendix A). These sectors may be aggregated freely to produce more compact

dataset.

Aggregation across commodities involves the reclassification of goods at a benchmark

point in the price space. If we index the disaggregate goods using i, j and index the corresponding

aggregated goods with I, J, we can identify commodities combined to form I as

i ∈ I I . Aggregation at reference prices ¯p i implies that the value of aggregate demand equals

the value of the constituent disaggregate demand: 18

¯p I C I (¯p) = ∑ i∈I I

¯p i C i (¯p). (25)

Furthermore, consistent aggregation implies that both demand and the elasticity of demand

at the benchmark point in the aggregate model coincides with the demand response in the

disaggregate model, taking benchmark prices into account. Formally:

¯p J

∂C I

∂p J

∣ ∣∣∣¯p

=

∑

i∈I I ,j∈I J

¯p j

∂C i

∂p j

∣ ∣∣∣¯p

. (26)

18 We use ¯p i and ¯p I in this expression to emphasize the role of price as an aggregation weight, but without loss

of generality, we may assume that the reference price vectors ¯p i = 1 ∀i and ¯p I = 1 ∀I. This Harberger

normalization greatly simplifies notation. When units are scaled so that the unit cost at this point is one,

values shares at this point are identically equal to share parameters in the CES function, i.e. α i = θ i, and

benchmark demands are equal to value shares, i.e. ¯Ci = θ i.

31

An implication is that the Allen-Uzawa elasticity of substitution (AUES) matrix of the aggregate

model has to correspond to valueshare-weighted average of terms in the AUES matrix of

the disaggregate model:

ˆσ IJ =

∑

i∈I I ,j∈I J

θ i

ˆθ I

θ j

ˆθ J

σ ij (27)

where ˆθ I , ˆθ J are the value share of inputs I and J in the aggregate cost function, and ˆσ is the

AUES matrix in terms of the aggregate prices. 19

In practice, our aggregation routine proceeds as follows. First, we construct the full AUES

matrix from the CDE parameters at the benchmark point (subpar ir in the GTAP database),

using expression (33) in Appendix C. Second, to ensure a consistent demand response when

the data is aggregated across commodities, we use the aggregated value shares and the diagonal

terms of the AUES matrix to recalibrate coefficients of the CDE demand system (as

described in Appendix C).

19 Note that exact aggregation based on (27) is only possible when working with a specific functional form, in

which case own-price elasticities in the aggregated model are:

ɛ I = ˆθ Iσ II = ˆθ I

∑

(ij)∈I I

θ i

ˆθ I

θ j

ˆθ I

σ ij (28)

Note also that if we had information about benchmark value shares (θ i) and benchmark elasticities of demand

(ɛ i), but no information regarding off-diagonal terms in the AUES matrix σ ij, i ≠ j, the vectors θ i and ɛ i

may or may not be consistent with a given cost function. In this setting, aggregation can use a simplifying

assumption that the average off-diagonal AUES in the aggregation-relevant terms equals the overall average

off-diagonal value for each of the constituent goods. From this it follows that average share-weight offdiagonal

AUES value associated with input i is given by:

¯σ i =

ɛi

θ i − 1

Substituting ¯σ i for σ ij in (28), we have a formula for an inexact aggregation:

ˆɛ I = ∑ ( )

1 − 1/ˆθ I θ i

ɛ i (29)

1 − 1/θ i θ I

i∈I I

In either exact aggregation (working from a full AUES matrix) or inexact aggregation (based on average offdiagonal

values), we find that θ i < θ I ∀i ∈ I i, hence the elasticity of demand for composite good I is less

than a weighted sum of the elasticities of demand in the constituent goods:

|ˆɛ I| < ∑ i∈I I

θ i

ˆθ I

|ɛ i| .

32

4.1.2 Aggregation across regions

Suppose that we aggregate across regions as well as across commodities. 20

Cost functions

in regions r and r ′ are disjoint, so the demand response for p ir does not depend on p ir ′. We

therefore begin by calculating price elasticities for the aggregate goods within each region,

and then produce a quantity-weighted aggregation of elasticities across regions. Therefore,

the own-price elasticity of demand for aggregate commodity I in aggregate region R is given

by:

ɛ IR =

∑

r∈R R

ɛ Ir ¯CIr

∑r∈R R

¯CIr

,

where ¯C Ir is benchmark consumption. As noted in footnote 18, because of the Harbgerger

normalization, it is also equal to the value shares.

Own-price elasticities together with value shares define diagonal terms in the Allen-

Uzawa elasticity matrix. To compute off-diagonal AUES terms, we use a value-weighted aggregation

of cross-price elasticities across regions. In particular, cross-price (compensated)

elasticities are given by:

ɛ IJr =

∑

i∈I I ,j∈I J

σ ijr ¯Cir ¯Cjr

∑i∈I I ,j∈I J

¯Cir ¯Cjr

θ Jr .

To ensure that these terms are consistent with the adding up condition of the AUES matrix,

we average these terms across constituent regions and scale them approproately:

(∑

)

r∈R

σ IJR = λ R

ɛ IJr ψ IJrR

IR

θ JR

∀I ≠ J ,

in which

ψ IJrR =

¯C Ir ¯CJr

∑

r ′ ∈R

¯CIr ′ ¯CJr ′

R

,

and the scaling factor λ IR is chosen so that ∑ J σ IJR θ JR = 0. Given our somewhat adhoc

treatment of off-diagonal terms, it seems sensible to define aggregations from the GTAP

dataset with full commodity and regional details rather than from a dataset which has already

been aggregated.

20 Note that regional identifiers in the full dataset correspond to ISO alpha-3 country codes. Users can define

their own aggregations of the GTAP data and use any labels to describe regions. For technical reasons, if

a GTAP dataset is to be used with MPSGE, then regional identifiers can have at most 4 characters. Table A2

presents the three-character identifiers which are normally used for primary factors.

33

4.2 Data filtering

The GTAP source data in original form presents substantial challenges for calibrated models

processed using direct solution methods (e.g., PATH, CONOPT or IPOPT). In our experience,

most numerical problems with GTAPINGAMS models can be traced to density of the source

data in which we find large numbers of small coefficients. These coefficients portray economic

flows which are a negligible share of overall economic activity, yet impose a significant

computational burden during matrix factorization.

In order to “filter” these economically insignificant value and reduce dimensionality of the

problem, GTAPINGAMS includes a GAMS program (FILTER.GMS) which removes small values

which are smaller than a specified tolerance level. An input to this program (ND) determines

the filter tolerance, i.e. the number of decimals for the smallest coefficient to be retained

in the data. For example, when nd = 4, the smallest coefficient in the benchmark social

accounting matrix is 0.0001. When nd = 6, the smallest number is 0.000001, etc. Larger

values of ND retain a larger number of small coefficients in the filtered dataset. Filtering

makes a GTAP database smaller, as illustrated in Table 6 in which it can be seen that filtering

reduces the size of a GTAP database by somewhere between 20% and 50%, depending on the

filtering tolerance.

Most of the reduction in non-zeros results from the elimination of small intermediate inputs

and bilateral trade flows. Importantly, the filtering procedure has differential impacts

on regions and markets in the database, and the choice of a filter tolerance depends to some

extent on the size of the countries to be included in a given analysis. For our analysis of the

G20 countries in the present paper, a filter tolerance nd = 5 seems suitable, whereas nd = 7

leads to numerical problems due to small coefficients. Therefore, depending on the nature

of the policy question under investigation, different filtering strategies may be adopted. Individual

researchers may have their own opinions about how to select parameter values should

be rounded to zero. The version of filter.gms provided with the GTAPINGAMS distribution

is intended to provide a starting point for this step in the dataset development process.

Removing small entries from the dataset implies that the resulting filtered dataset no

longer represent a micro-consistent matrix. However, unlike earlier versions of GTAPINGAMS,

we do not use a nonlinear optimization framework to rebalance the data. Instead, filter.gms

34

Table 6: Filtering results for entire dataset (2011 data)

Nonzeros Nonzeros After Filtering % Reduction in Nonzeros

Before nd = 4 nd = 5 nd = 6 nd = 4 nd = 5 nd = 6

Domestic Intermediate vdfm 478800 233267 290668 342177 51 39 29

Imported Intermediate vifm 478798 186521 247571 300255 61 48 37

Bilateral trade vtwr 776358 175449 314173 463832 77 60 40

Transport margins vxmd 1097628 400882 591129 766803 63 46 30

moves imbalances resulting from omitted coefficients into either factor supplies or investment

demand depending on the sign of imbalance which appears following filtering. This approach

to reconciliation is simple to implement provided that the inconsistencies resulting from filtering

are small. The reconciliation methodology implemented in filter.gms is perhaps

less useful for large scale recalibration exercises such as might arise with a whole change in

benchmark tax rates or production structure.

In practice, we note that for nd = 5, the data rebalancing procedure imposes very small

changes in the remaining nonzero elements, but it substantially reduces the number of coefficients

in the dataset as indicated in Table 6. Nearly half of the trade flow and imported

intermediate demand coefficients can be dropped, resulting in a reduction in the size of the

dataset from nearly 44 MB to 27 MB. More importantly, sparsity tends to improve robustness.

Larger models are easier to solve when the underlying datasets have been carefully filtered.

4.3 Calibration of trade elasticities

The objective of this section is to outline a strategy to parametrize CET elasticity of transformation

between domestic production and exports (etadx(g)) and elasticity of substitution

between domestic production and imports (esubdm(i)). Intuitively, in the SOE model, a

finite export supply elasticity is specified, the import demand elasticity is adjusted to maintain

a consistent with the empirical elasticity estimates in the GTAP dataset. This ensures that

aggregate trade response is consistent in both GMR and SOE models.

For simplicity, we approach the problem from a Marshallian perspective. Suppose that on

a given trade flow, the import demand elasticity is ¯ɛ, and benchmark rate of protection is ¯t.

Scaling units so that the FOB supply price is 1, the demand price is 1 + ¯t, and the quantity

demanded in the benchmark is 1.

35

Figure 9: Market Clearance ɛ = 5, η = ∞

1.4

1.3

1.2

a

Price (P)

1.1

1

b

c

0.9

0.8

0 0.5 1 1.5 2 2.5 3

Quantity (Q)

In a setting in which the supply elasticity of exports, ¯η, is infinite, which is aligned with

assumptions underlying our SOE representation, the supply price of exports is constant (p =

1). Therefore, if the tariff were removed, and demand is isoelastic, the new equilibrium

quantity and price are given by:

q ∗ = (1 + ¯t) |¯ɛ| . (30)

Under this free trade outcome with constant supply price, the quantity demanded at p = 1

is the new equilibrium quantity. This outcome is illustrated in Figure 9, in which benchmark

import demand is at price-quantity point a, benchmark import supply is at point b, and there

is a benchmark trade barrier equal to 20%. The free-trade equilibrium is at point c, reflecting

benchmark import demand elasticity ¯ɛ = 5.

Now instead of a perfectly elastic supply function, suppose that we consider η < ∞ as is

the case in the GMR model. In this case, removing tariffs implies a new equilibrium supply

price p ∗ , and the associated equilibrium supply and demand q ∗ from (30) is given by:

q ∗ =

( 1 + ¯t

p ∗ ) |ɛ|

= (p ∗ ) η .

36

Figure 10: Market Clearance ɛ = **16**.7, η = 7.1

1.4

1.3

1.2

a

d

Price (P)

1.1

1

b

c

0.9

0.8

0 0.5 1 1.5 2 2.5 3

Quantity (Q)

This expression shows that in order for the aggregate trade response under η < ∞ to be equal

to the one prevailing under η = ∞, demand elasticity (ɛ) has to be adjusted as the export

supply elasticity η is reduced. Formally, given equilibrium price:

p ∗ = (1 + ¯t) |¯ɛ|/η ,

the reparametrized elasticity of demand is given by:

|ɛ| =

|¯ɛ|

1 − |¯ɛ|/η .

Let θ = 1 − |¯ɛ|/η. Consistency of trade quantity responses in the revised model implies

that θ ≥ 0. When η = ∞, then we have the original model with a horizontal supply curve.

Setting θ = 0.3, the new Marshallian model appears in Figure 10.

As in the previous model, a and b are benchmark demand and supply with a 20% tariff

barrier. While free trade in the original model is at point c, free trade in the revised model is

at point d. Supply is less elastic, so social surplus increases are captured by the supply side

of the market, and the equilibrium price following tariff removal increases by over 10% from

37

the benchmark level.

In the GAMS code, this adjustment takes place at the top of gtap9data.gms file. The

run-time environment variable thetadx defines how the adjustment of export supply and

import demand is to be calibrated to match the GMR GTAP model. The associated assignments

are reported here.

parameter etadx(g) Export elasticity of transformation D vs E,

esubdm(i) Elasticity of substitution D vs M,

vxm(g,r) Export market supply;

$if not set thetadx $set thetadx 0.5

etadx(i)$(1-%thetadx%) = esubd(i)/(1-%thetadx%);

etadx(i)$(not (1-%thetadx%)) = +inf;

esubdm(i) = esubd(i)/%thetadx%;

vxm(i,s) = (vst(i,s) + sum(r,vxmd(i,s,r)))$(1/etadx(i));

5 A few forensic calculations

We conclude by reporting on a few calculations which illustrate of the importance of model

closure for assessing the economic effects of policy reform. The GMR and SOE models are

well suited to help understand the role of terms of trade in policy experiments. In these

simulations, we consider on the economic impact of unilateral, proportional adjustment of

regional import tariffs and export taxes. Furthermore, as a matter of illustration, we will

focus only on results for the United States (USA) and China (CHN). 21

Figure 11 summarizes the commodity-based taxes on imports to USA and CHN in the

2011 base year database. Taxes applied to USA imports are highest on wearing apparrel

(WAP), textiles (TEX), and leather (LEA). In the GTAP9 database, these goods are subject

to substantial export taxes. Among the highest taxed goods, the highest tariff revenue is

associated with imports of chemicals, rubber and plastic products (CRP). Imports to China

of sugar (SGR), “wool, silk-worm cocoons” (WOL), and “motor vehicles and parts” (MVH) are

subject to tariffs of 20% or more, but the largest tariff revenue (among the highest taxed

imports) are on “machinery and equipment” (OME), CRP and crude oil (CRU).

Figure 12 summarizes the region structure of taxes on imports to CHN in 2011.

The

21 Region CHN in our G20 aggregation includes GTAP regions CHN and HKG.

38

Figure 11: Trade taxes and tariff revenue by commodity

(a) USA

50

350

Tax rate (%)

40

30

20

10

300

250

200

150

100

50

Tariff revenue ($M)

0

WAP

TEX

LEA

MIL

OIL

SGR

NMM

FMP

OMF

CMT

CRP

LUM

OCR

OFD

0

Commodity

(b) China

Tax rate (%)

50

40

30

20

10

350

300

250

200

150

100

50

Tariff revenue ($M)

0

SGR

WOL

MVH

B T

NMM

CMT

FMP

OCR

VOL

LEA

OAP

OFD

OIL

OME

OMF

CRP

PFB

TEX

CRU

I S

MIL

OMT

WAP

FSH

0

Commodity

Import tariff rate (left axis)

Export tax rate (left axis)

Tariff revenue (right axis)

39

Figure 12: Trade taxes and tariff revenue by partner

(a) USA

25

500

20

400

Tax rate (%)

15

10

300

200

Tariff revenue ($M)

5

100

0

RUS

CHN

IND

IDN

LIC

BRA

TUR

ITA

ZAF

ARG

MIC

OEX

JPN

REU

KOR

DEU

FRA

ANZ

GBR

SAU

CAN

MEX

0

Trading partner

25

(b) China

500

20

400

Tax rate (%)

15

10

300

200

Tariff revenue ($M)

5

100

0

RUS

DEU

JPN

ITA

GBR

KOR

IND

USA

FRA

REU

BRA

MEX

LIC

ARG

IDN

MIC

CAN

OEX

ANZ

CHN

TUR

ZAF

SAU

0

Trading partner

Import tariff rate (left axis)

Export tax rate (left axis)

Tariff revenue (right axis)

40

highest trade taxes are applied on imports from Russia (RUS), China, India and Indonesia.

Export taxes are the largest fraction of taxes on imports from Russia, China and India. Tariff

revenue is concentrated on the countries which have the highest exports to the USA, China,

Canada, Mexico and the European Union.

Tariff rates are, however, quite low on these

imports.

Taxes on imports to China are highest from Russia, again largely on the basis of export

taxes applied by Russia.

China’s import tariffs average around 5% on CHN imports from

the OECD coutries (Japan, European Union states, USA). The largest share of import tariff

revenue is associated with imports from middle income countries (MIC). For the US, average

taxes on imports (including both export taxes applied by trade parnters and import tariffs

collected by USA are a little less than 2%). Taxes on imports to China average a bit more than

4%. We note that relative to other countries in the database, the US and China have relatively

low trade taxes. Taxes in both the US and China are far from uniform, hence proportional

increases in trade taxes might be expected to increase the distortionary cost of the existing

tax system.

The results of our stylize policy experiment, in both the SOE and GMR models, are shown

in Figure 13. We report the Hicksian equivalent variation as a function of the proportional

adjustment of trade taxes, which ranges from zero (free trade) to a ten percent increase.

Note that for these simulations, final demand is based on the CDE model. Results

In the GMR franework, the model suggest that the US can only slightly increase welfare

by increasing trade taxes (up to a maximum of around 4.5%). By contrase, China increases

welfare through a small decrease in trade taxes (to 3%). However, in our simulations the

welfare impact depends whether one works with a multiregional or open economy closure.

While in the GMR model China gains from a small reduction in tariffs, in the SOE model it

gains the most from free trade.

Therefore, although the GMR and SOE models are based

on identical benchmark datasets, the absence of terms of trade effects in the open economy

setting has significant implications for the effects of changes in tax policy.

In contrast to the importance of the model closure, the structure of final demand only

modestly influences results for this specific set of simulations. This is illustrated in Figure 14.

This is especially striking for the US, as the welfare effect of trade taxes is almost identical

across alternative final demand specification.

For China, differences are somewhat more

41

Figure 13: Welfare effect of unilateral policy

(a) USA

1.5

1

0.5

Hicksian EV (%)

0

−0.5

−1

−1.5

−2

0 1 2 3 4 5 6 7 8 9 10

Average trade tax rate (%)

1.5

(b) China

1

0.5

Hicksian EV (%)

0

−0.5

−1

−1.5

−2

0 1 2 3 4 5 6 7 8 9 10

Average trade tax rate (%)

Global multiregional (GMR) model

Small open economy (SOE) model

42

Figure 14: Demand system sensitivity

(a) USA

1.5

1

Hicksian EV (%)

0.5

0

−0.5

−1

−1.5

−2

0 2 4 6 8 10

Average trade tax rate (%)

1.5

(b) China

1

Hicksian EV (%)

0.5

0

−0.5

−1

−1.5

−2

0 2 4 6 8 10

Average trade tax rate (%)

CDE demand system

Cobb Douglas demand system

Linear expenditure system

43

pronounced, but they are quantitatively much less important than differences that can be

attributed to alternative trade closures.

6 Concluding comments

This paper has documented two general models implemented in GAMS based on the GTAP

version 9 database. The global multiregional model based on an Armington representation

of bilateral trade flows in which terms of trade is endogenous, and a small open economy

model, in which relative prices between distinguished regions are endogenous, but rest of

world prices and the current account are fixed. These two models represent the “canonical”

representations of international trades responses, one in which terms of trade are endogenous

and another in which relative prices in rest-of-world are held fixed.

The model also integrates three different options for the representation of final demand.

While the model based on Cobb-Douglas preferences is the most parsimonious, it cannot

accommodate empirical evidence on own-price and income elasticity. This limitation is addressed

by the two other alternatives, the linear expenditure system and the constant difference

of elasticities model. For these models, however, there are additional challenges associated

with the aggregation of the AUES matrix. We have discussed a possible approach to do so, but

more work in this area seems necessary.

All in all, the set of models made available through this paper offer a very rich setup

to study the quantitative impact of international policies. We stress that it is particularly

important to study how alternative structural assumption affect the results. For the particular

policy illustration we considered, our results suggest that trade closures matter a lot, whereas

the representation of final demand is quantitatively less important.

This will, of course,

depend on the specific sort of policies considered.

44

Appendix A

List of GTAP sectors and primary factors

Table A1: Commodities and Industries in the GTAP 9 database

Identifier Definition

Identifier Definition

PDR Paddy rice LUM Wood products

WHT Wheat PPP Paper products, publishing

GRO Cereal grains nec P C Petroleum, coal products

V F Vegetables, fruit, nuts CRP Chemical,rubber,plastic prods

OSD Oil seeds NMM Mineral products nec

C B Sugar cane, sugar beet I S Ferrous metals

PFB Plant-based fibers NFM Metals nec

OCR Crops nec FMP Metal products

CTL Cattle,sheep,goats,horses MVH Motor vehicles and parts

OAP Animal products nec OTN Transport equipment nec

RMK Raw milk ELE Electronic equipment

WOL Wool, silk-worm cocoons OME Machinery and equipment nec

FRS Forestry OMF Manufactures nec

FSH Fishing ELY Electricity

COA Coal GDT Gas manufacture, distribution

OIL Oil WTR Water

GAS Gas CNS Construction

OMN Minerals nec TRD Trade

CMT Meat: cattle,sheep,goats,horse OTP Transport nec

OMT Meat products nec WTP Sea transport

VOL Vegetable oils and fats ATP Air transport

MIL Dairy products CMN Communication

PCR Processed rice OFI Financial services nec

SGR Sugar ISR Insurance

OFD Food products nec OBS Business services nec

B T Beverages and tobacco products ROS Recreation and other services

TEX Textiles OSG PubAdmin/Defence/Health/Educat

WAP Wearing apparel DWE Dwellings

LEA Leather products CGD Aggregate investment

45

Table A2: Primary Factors in the GTAP 9 database

Identifier Definition

Mobile factors:

Sector-specific factors:

MGR Officials and Managers legislators (ISCO-88 Major Groups 1-2),

TEC Technicians and associate professionals

CLK Clerks

SRV Service and market sales workers

LAB Agricultural and unskilled workers (Major Groups 6-9)

CAP Capital

LND

RES

Land

Natural resources

46

Appendix B

Practicalities

System Requirements

You will need to have the following:

• A computer.

• A GAMS system, Version 24.7.1 or newer.

• The PATH or CONOPT solvers.

• MPSGE subsystem (optional)

Getting Started

The GTAPINGAMS package is distributed as a zip file containing the directory structure and

GAMS programs which can be unzipped into a clean working directory. GTAP source data

are not distributed with the GTAPINGAMS system.

In order to generate models with the

GTAPINGAMS tools, it is necessary to obtain the GTAP 9 distribution archives.

Here are the steps involved in installing GTAPINGAMS:

1. Create an empty root directory for GTAP.

2. Unzip gtap9ingams.zip in this directory.

3. Install the GTAP data file flexagg9aY11.zip into the gtapdata subdirectory. 22

4. Connect to the build directory and execute gams build.gms This will take some

time to complete. The batch file is set up to begin with the 2011 base year data.

Choose a different year if you wish.

5. Connect to the test directory and execute run.gms to assess benchmark consistency.

6. The GAMS programs in the forensics directory provide a template for how to conduct

counterfactual policy simulations, using Excel PivotTables and PivotCharts to synthesize

model output.

22 You need only one data files, but these data are provided for three different years in the GTAP “flexhar”

distribution.

47

Appendix C

The CDE demand system

Theory and Analytics

Our implementation of the CDE model follows Chen (2015). In the CDE model, the utility

index U is defined implicitly by the following equation:

∑

θ i U e i(1−α i )

i

( ) 1−αir Pi

= 1 , (31)

C

where C is the unit cost index, α ir is the substitution parameter (subpar ir in the GTAP

database), and e ir is the income parameter (incpar ir ).

The unit cost (C) in the CDE model is determined by a budget constraint,

∑

P i x i = M

and demand functions can be derived using Roy’s identify: 23

i

x i = ∂C/∂P i

∂C/∂M = θ U (1−α i)e i

(P i /C) −α i

i ∑

j , U (1−α j)e j (P j /C) −α j

Here is a GAMS model which evaluates CDE demand across commodities i and regions

r ∈ rc. We have n + 2 variables (x i , C and U) determined by n + 2 equations. While the CDE

model is essentially a nonlinear system of equations, we write down the model using mixed

complementarity syntax so as to associate equations with variables. 24

variables D(i,r) Demand,

C(r) Price index,

U(r) Utility index;

equations

ddef, budget, choice;

ddef(i,rc(r))$theta(i,r)..

D(i,r) * sum(j, theta(j,r) * U(r)**((1-alpha(j,r))*e(j,r))

* (P(j,r)/C(r))**(1-alpha(j,r)))

=e= theta(i,r)*U(r)**((1-alpha(i,r))*e(i,r))

* (P(i,r)/C(r))**(-alpha(i,r));

budget(rc(r))..

sum(i, D(i,r)*P(i,r)) =e= M(r);

23 The partial derivatives ∂C/∂P i and ∂C/∂M are obtained by differentiating (31).

24 If U(r) is fixed prior to a CDE solve, the corresponding budget(r) constraint is automatically dropped

thereby providing the compensated demand response.

48

choice(rc(r))..

sum(i, theta(i,r) * U(r)**((1-alpha(i,r))*e(i,r))

* (P(i,r)/C(r))**(1-alpha(i,r))) =e= 1;

model cdeeval /ddef.D, budget.U, choice.C/;

The price elasticity of demand in this model is given by:

( ∑

ɛ CDE

i = θ i

(2α i −

k

θ k α k

))

− α i

and the income elasticity of demand is given by:

η CDE

i

= e i(1 − α i ) + ∑ k θ ke k α

∑

k

k θ ke k

+ α i − ∑ k

θ k α k

Calibration

Calibration of the CDE parameters involves a least squares optimization model of the form:

min

α,e

∑

i

θ i

( (ɛ

CDE

i

− ɛ i

) 2

+

(

η

CDE

i − η i

) 2

)

(32)

Here is a GAMS model which calibrates CDE demand across commodities i and regions r ∈ rc:

variables

E(i,r)

ALPHA(i,r)

EPSILONV(i,r)

ETAV(i,r)

Substitution parameter,

Income parameter

Calibrated own-price elasticity of demand,

Calibrated income elasticity of demand;

equations

objcde, epsilondef, etadef;

objcde.. OBJ =e= sum((i,rb(r))$theta(i,r), theta(i,r) *

(sqr(EPSILONV(i,r) - epsilon(i,r))) +

sqr(ETAV(i,r) - eta(i,r)));

epsilondef(i,rb(r))$theta(i,r)..

EPSILONV(i,r) =e= theta(i,r) * (2*ALPHA_(i,r)-sum(k,theta(k,r)*ALPHA_(k,r)))

- ALPHA_(i,r);

etadef(i,rb(r))$theta(i,r)..

ETAV(i,r) =e=

(E(i,r)*(1-ALPHA_(i,r)) + sum(k,theta(k,r)*E(k,r)*ALPHA_(k,r))) /

sum(k,theta(k,r)*E(k,r))

+ (ALPHA_(i,r) - sum(k,theta(k,r)*ALPHA_(k,r)));

model cdecalib /objcde, epsilondef, etadef/;

Finally, we note that in the CDE model the Allen-Uzawa elasticities of substitution for

49

compensated demand are given by:

⎧

⎪⎨

σij CDE =

⎪⎩

α i + α j − ( ∑ k θ kα k )

2α i − ( ∑ k θ kα k ) − α i

θ i

i ≠ j

i = j

(33)

The “constant difference of elasticities” feature of the CDE demand system is evident through

the calculation based on the AUES elasticities of sustitution:

σ ik − σ jk = α i − α j

Parallel Processing

The GAMS program cdecalib.gms has a runtime environment variable name maxthreads.

This variable determines whether the CDE calibration is executed one region at a time or, taking

advantage of multi-core processors, several regions at a time. When threads=1, the

program runs in serial model and solutions listings are generated for each calibration. Otherwise,

solution listings are suppressed and multiple (typically 8) demand system calibrations

are solved at once.

The grid computing facilities are a relative new and evolving feature in GAMS programming,

and they are very useful for applied general equilibrium modeling, so we provide some

annotated GAMS code which describes how jobs are submitted and collected:

* When handle(r)=0, region r is inactive, otherwise

* it is currently being solved:

parameter handle(r) Pointer to a grid solve job;

* When submit(r)=yes, the calibration job for region r

* is ready to submit. done(r)=yes when region r is completed.

set submit(r) List of regions to submit,

done(r)

List of regions which are completed;

* Initialization:

done(r) = no;

handle(r) = 0;

* Open a file which can be used to update the title bar:

file ktitle;

ktitle.lw=0; ktitle.nd=0;

repeat

submit(r) = no;

* Submit as many as maxthreads jobs, choosing from regions

50

* which are neither completed or currently running.

loop(r$(not (done(r) or handle(r))),

submit(r) = yes$(card(submit)+card(handle) 300;

* Issue a warning if some jobs did not complete:

abort$(card(done)card(r)) ’CDECALIB jobs did not return:’, handle;

Integrating CDE Demand in MPSGE

The integration of CDE demand in the MPSGE model is subtle. To begin with, we need to

introduce an Armington composite price for final demand. This is done with the A(i,r)

activity which converts domestic and imported goods into the PA(i,r) commodity:

51

$prod:A(i,r)$(rm(r)*vcm(i,r)) s:esubdm(i)

o:PA(i,r) q:vcm(i,r)

i:P(i,r) q:vdfm(i,"c",r) p:(1+rtfd0(i,"c",r)) a:RA(r) t:rtfd(i,"c",r)

i:PM(i,r) q:vifm(i,"c",r) p:(1+rtfi0(i,"c",r)) a:RA(r) t:rtfi(i,"c",r)

The CDE demand functions are represented by auxiliary variables, and they enter the

MPSGE model as rationing multipliers on regional endowments. The assigned set cde(r) is

used to indicate whether region r has a CDE demand system.

Here is the tricky business: MPSGE insists that all consumers entering the model demand

something. We therefore need to include “phantom” demand and endowment entries which

will offset one another in equilibrium. The budget balance condition in the CDE model (the

constraint associated with U(r) imposes that in equilibrium the value of expenditure for

region r (RA(r)) equal to the value of the phantom factor endowment vector.

$demand:RA(r)$rm(r) s:0

* Demand and endowment coefficients for the CD and

* LES demand systems:

d:P(cd,r)$(not cde(r))

e:P("sd",r)$(not cde(r))

q:vom(cd,r)

q:(-vom("sd",r))

* Coefficient for the CDE demand system:

e:PA(i,r)$cde(r) q:(-vcm(i,r)) R:D(i,r)

* Phantom demand and endowment entries which offset

* in equilibrium:

...

d:PF(f,r)$cde(r)

e:PF(f,r)$cde(r)

q:evom(f,r)

q:evom(f,r)

$constraint:U(r)$(cde(r)*rm(r))

sum(f, PF(f,r)*evom(f,r)) =e= RA(r);

$constraint:CC(r)$(cde(r)*rm(r))

sum(i, thetac(i,r) * U(r)**((1-subpar(i,r))*incpar(i,r)) *

(PA(i,r)/CC(r))**(1-subpar(i,r))) =e= 1;

$constraint:D(i,r)$(rm(r)*vcm(i,r))

D(i,r) * sum(j$thetac(j,r), thetac(j,r) *

U(r)**((1-subpar(j,r))*incpar(j,r)) *

(PA(j,r)/CC(r))**(1-subpar(j,r)))

=e= U(r)**((1-subpar(i,r))*incpar(i,r)) *

(PA(i,r)/CC(r))**(-subpar(i,r));

52

Appendix D

Subdirectories and GAMS Programs

build/

Working directory for dataset construction.

build.gms

Command script to read, filter and aggregate a set of

GTAP datasets. Default configuration: produces datasets

gtapingams.gdx, g20.gdx, g20 macro.gdx and

g20 iea.gdx for 2011.

Calls code/flex2gdx.gms,

code/filter.gms, code/gtapaggr.gms and

code/cdecalib.gms.

filterchk.gms Command script to generate data for Table 6:

Filtering results. Calls code/flex2gdx.gms,

code/filter.gms.

Results are written to a PivotData

sheet in filterchk.xlsx.

code/

Code repository – not a working directory.

flex2gdx.gms

Routine which translates the HAR files from a GTAP .zip

archive into GAMS .gdx files.

The routine produces an

echoprint report of benchmark consistency of the database.

filter.gms

Filter routine, based on environment parameter –nd, the

number of decimal points in the filter.

gtap9data.gms Utility routine for read a GTAPINGAMS version 9 dataset.

gtapaggr.gms

Dataset aggregation routine (call to cdecalib.gms following

aggregation must be made by user).

aggr.gms

Utility routines called by gtapaggr.gms.

chktarget.gms

checkset.gms

53

domain.gms

Standard purpose libinclude routine for extracting the

nonzero domain of a parameter, using the mysterios

”option pd 1

mcpmge.gms Is designed to perform a check of consistency for the MCP

and MGE models at a point away from the benchmark equilibrium.

It can be used to verify that a solution computed with

mge.gms also solves mcp.gms, and that a solution computed

with mcp.gms solves mge.gms. The GAMS savepoint

and loadpoint commands are used for this purpose.

cdechk.gms Verifies that the CDE demand system reproduces the exogenous

own-price and income demand elasticities at the benchmark

point.

forensics/

Produces some calculations assessing the economic consequences

of propotional unilateral changes in trade taxes.

runs.gms

This GAMS script generates a Windows batch script for sensitivity

analysis. The script executes tgrid.gms for several alternative

model closures and demand system specifications,

and it also executess calls to GDXMERGE which combine the

model output in a PivotChart database in Excel workbook

results.xlsx.

runs.bat

Is the batch program written by runs.gms.

tgrid.gms Performs a sequence of counterfactual calculations for a

single region,

with proportional scaling tariff and export

subsidy rates to average values between 0 and 10%.

These counterfactual calculations are computed with Cobb-

Douglas, LES and CDE demand.

Macro results (welfare,

model status, and global welfare) are returned in parameter

results(dsys,tlvl,*). GDP calculations are stored

in gdpresults(dsys,tlvl,gdpcat,r,gdpitem).

55

Macros for model configuation

Two user-callable macros provided in loadmdl.gms:

$macro loaddsys(ff,r) Loads demand system ff for region r where ff is one of LES,

CD or CDE and r is a region identifier, either a quoted set element or a subset of the

regions r. This function alters:

les(r) LES demand system flag for model regions

cde(r) CDE demand system flag

esub() Elasticities of substitution in subsistence and discretionary demand.

rtfd(),rtfi() Tax rates in final demand

vdfm(),vifm() Levels of subsistence and discretionary demand

vom() Output level used to activate aggregate consumer demand, subsistence and discretionary

demand.

$macro loadrm(rr) Load regions rr(r) as endogenous elements of the current model.

If rr is a set which includes all regions in r, then a global multiregional model is

produced. If rr is singleton or a subset of regions in r, then a small open economy

closer is provided. This routine alters:

rm(r) Set of regions in the model,

rx(r) Set of regions in rest of world,

rnum(r) Set defining the numeraire region – the region in the model with the largest consumption.

vem(i,r) Exports to ROW regions by regions in the model,

rtxs row(i,r) Average subsidy rates on exports to ROW regions.

rowpfx Current account balance for the rest of world regions.

56

The user-callable macros provided in loadmdl.gms are invoked as follows in the tgrid.gms

program:

* Load regions in the model, either a global multiregional

* model containing all regions or a small open economy model

* with a single region.

$if not set mdl

$if not set rcalc

$set mdl gmr

$set rcalc chn

$if %mdl%==gmr loadrm(r);

$if %mdl%==soe loadrm("%rcalc%");

In the same program, a loop over functional forms is used to calculate scenario results for

three different demand systems, as shown below.

GDP reporting

gdpcalc.gms declares the following identifiers: 25

set gdpcat GDP Categories /

expend

Expenditure (C + G + I - (X-M)),

income

Income (Factor income + taxes),

valueadded Sectoral factor earnings plus tax payments,

total

Total GDP/,

gdpitem /"X-M",set.g,set.f,

revto,revtfd,revtfi,revtf,revtxs,revtms,

expend,income,valueadded,chksum/;

alias (gdpitem, gdpi);

parameter gdp(gdpcat,*,gdpitem) Real GDP accouting,

vadd(g, gdpitem, r) GDP on a value-added basis;

GDP reporting in tgrid.gms consists of an include statement at the beginning of the

program, just after having read mge.gms, in a context permitting declarations:

* Read the model and calculate GDP at the benchmark point:

$include %code%mge

$include %code%gdpcalc

25 These names may not be used in the calling program.

57

The GDP routine is included following scenarios solutions inside the loop over alternative

demand systems:

loop(dsys,

* Load the demand system:

loaddsys(dsys,r);

* Initialize tax instruments at benchmark values:

rtms(i,s,r) = rtms0(i,s,r);

rtxs(i,s,r) = rtxs0(i,s,r);

loop(tlvl,

* Assign tax rates for the counterfactual simulation:

rtms(i,s,rcalc)$max(rtms0(i,s,rcalc),0) = rtms0(i,s,rcalc) * tlvl.val/averate;

rtxs(i,rcalc,s)$max(-rtxs0(i,rcalc,s),0) = rtxs0(i,rcalc,s) * tlvl.val/averate;

* Compute the equilibrium values:

$include gtap9.gen

solve gtap9 using mcp;

abort$(gtap9.objval>1e-3) "Simulation fails: gtap9.";

* Store the GDP results for this simulation:

$include %code%gdpcalc

gdpresults(dsys,tlvl,gdpcat,r,gdpitem) = gdp(gdpcat,r,gdpitem);

...

))

58

Appendix E

GAMS Code

Declarations

$title

GTAP9inGAMS -- GAMS/MCP Formulation

$if not set yr $set yr 11

$if not set ds $set ds g20_macro

$include "%system.fp%gtap9data"

nonnegative

variables

*$sectors:

Y(g,r)

M(i,r)

YT(j)

FT(f,r)

X(i,r)

A(i,r)

*$commodities:

P(g,r)

PA(i,r)

PE(g,r)

PM(j,r)

PT(j)

PF(f,r)

PS(f,g,r)

PFX

*$consumers:

RA(r)

ROW

*$auxiliary:

D(i,r)

U(r)

CC(r)

equations

prf_y(g,r)

prf_a(i,r)

prf_x(i,r)

prf_m(i,r)

prf_yt(j)

prf_ft(f,r)

mkt_p(g,r)

mkt_pe(g,r)

mkt_pm(j,r)

mkt_pa(i,r)

mkt_pt(j)

mkt_pf(f,r)

mkt_ps(f,j,r)

mkt_pfx

inc_ra(r)

inc_row

constraint_D

constraint_U

constraint_CC

Supply

Imports

Transportation services

Specific factor transformation

Exports to rest of world (SOE model)

Armington final demand quantity index (CDE model)

Domestic output price

Armington final demand price

Export market

Import price

Transportation services

Primary factors rent

Sector-specific primary factors

Real exchange rate (SOE model)

Representative agent

Rest of world (SOE model)

CDE Demand (index)

CDE Utility (index)

CDE Consumption cost index;

Supply,

Armington demand,

Exports,

Imports,

Transportation services,

Factor transformation,

Domestic market,

Export market,

Import market,

Armington market,

Transportation service market,

Primary factor markets,

Specific factor markets,

Market for foreign exchange,

Representative agent

Rest of world agent

Defines D (CDE model)

Defines U (CDE model)

Defines CC (CDE model);

59

Zero profit (arbitrage) conditions

Sectoral production – Y(g,r)

* Define some macros which diagnose the functional form:

$macro Leontief(sigma) (yes$(round(sigma,2)=0))

$macro CobbDouglas(sigma) (yes$(round(sigma-1,2)=0))

$macro CES(sigma) (yes$(round(sigma-1,2)0 and round(sigma,2)0))

* -------------------------------------------------------------------------------

* Profit function for production and consumption activities:

* $prod:Y(g,r)$ydm(g,r) s:0 m:esub(g,r) t:etadx(g) i.tl(m):esubd(i) va:esubva(g)

* o:P(g,r) q:(vom(g,r)-vxm(g,r)) a:RA(r) t:rto(g,r)

* o:PE(g,r) q:vxm(g,r) a:RA(r) t:rto(g,r)

* i:P(i,r) q:vdfm(i,g,r) p:(1+rtfd0(i,g,r)) i.tl: a:RA(r) t:rtfd(i,g,r)

* i:PM(i,r) q:vifm(i,g,r) p:(1+rtfi0(i,g,r)) i.tl: a:RA(r) t:rtfi(i,g,r)

* i:PS(sf,g,r) q:vfm(sf,g,r) p:(1+rtf0(sf,g,r)) va: a:RA(r) t:rtf(sf,g,r)

* i:PF(mf,r) q:vfm(mf,g,r) p:(1+rtf0(mf,g,r)) va: a:RA(r) t:rtf(mf,g,r)

* $prod:Y(g,r)$(rm(r)*vom(g,r)) s:0 m:esub(g,r) t:etadx(g) i.tl(m):esubdm(i) va(s):esubva(g)

* o:P(g,r) q:(vom(g,r)-vxm(g,r)) a:RA(r) t:rto(g,r)

* o:PE(g,r) q:vxm(g,r) a:RA(r) t:rto(g,r)

* i:P(i,r) q:vdfm(i,g,r) p:(1+rtfd0(i,g,r)) i.tl: a:RA(r) t:rtfd(i,g,r)

* i:PM(i,r) q:vifm(i,g,r) p:(1+rtfi0(i,g,r)) i.tl: a:RA(r) t:rtfi(i,g,r)

* i:PS(sf,g,r) q:vfm(sf,g,r) p:(1+rtf0(sf,g,r)) va: a:RA(r) t:rtf(sf,g,r)

* i:PF(mf,r) q:vfm(mf,g,r) p:(1+rtf0(mf,g,r)) va: a:RA(r) t:rtf(mf,g,r)

* Benchmark value shares:

parameter

cf0(g,r)

cm0(g,r)

cy0(g,r)

theta_f(g,r)

thetaf(f,g,r)

thetam(i,g,r)

thetad(i,g,r)

theta_e(g,r)

thetayt(j,r)

thetavxmd(i,s,r)

thetavtwr(j,i,s,r)

theta_m(i,s,r)

vxmt(i,s,r)

vxmd0(i,r,s)

vtwr0(j,i,r,s)

thetavfm(f,j,r)

Factor cost

Material cost

Reference total cost,

Value added share of cost,

Factor share of value added,

Armington share of material cost,

Domestic share of Armington composite,

Export share of output,

Value share,

Value share of goods in imports,

Value share of transportation services,

Bilateral import value share

Value of imports gross transport cost,

Trade - bilateral exports at market prices (dataset values),

Trade - margins for international transportation at world prices,

Value shares of specific factors;

vxmd0(i,r,s) = vxmd(i,r,s);

vtwr0(j,i,r,s) = vtwr(j,i,r,s);

$setlocal datetime %system.date%%system.time%

$echo * Calibration code for mcp.gms (%datetime%) >gtap9.gen

* Save copy of the benchmark trade flows so that we can turn off

* demand as needed in the SOE model:

vxmd(i,r,s) = vxmd0(i,r,s);

vxmd(i,rx(r),rm(s)) = vxmd0(i,r,s)$vem(i,r);

vtwr(j,i,r,s) = vtwr0(j,i,r,s);

vtwr(j,i,rx(r),rm(s)) = vtwr0(j,i,r,s)$vem(i,r);

* User cost indices for factors, domestic and imported

* intermediate inputs:

$macro P_PF(f,g,r) (((PF(f,r)$mf(f)+PS(f,g,r)$sf(f))*(1+rtf(f,g,r)) \

/ (1+rtf0(f,g,r)))$thetaf(f,g,r) + 1$(thetaf(f,g,r)=0))

60

$macro P_D(i,g,r) ((P(i,r)*(1+rtfd(i,g,r)) \

/ (1+rtfd0(i,g,r)))$thetad(i,g,r) + 1$(not thetad(i,g,r)))

$macro P_I(i,g,r) ((PM(i,r)*(1+rtfi(i,g,r)) \

/ (1+rtfi0(i,g,r)))$(1-thetad(i,g,r)) + 1$(thetad(i,g,r)=1))

* Compensated cost functions:

$if defined f_ $abort "The CF(g,r) macro requires a uniquely defined alias for f."

alias (f,f_);

* Factor cost index:

$macro C_F(g,r) ( \

( (sum(f_$thetaf(f_,g,r), thetaf(f_,g,r)*P_PF(f_,g,r)))$Leontief(esubva(g)) + \

(prod(f_$thetaf(f_,g,r), P_PF(f_,g,r)**thetaf(f_,g,r)))$CobbDouglas(esubva(g)) + \

(sum(f_$thetaf(f_,g,r), \

thetaf(f_,g,r)*P_PF(f_,g,r)**(1-esubva(g)) \

)**(1/(1-esubva(g))))$CES(esubva(g)))$cf0(g,r) )

* Armington cost index:

$macro C_A(i,g,r) ( \

(thetad(i,g,r)*P_D(i,g,r) + (1-thetad(i,g,r))*P_I(i,g,r))$Leontief(esubdm(i)) + \

(P_D(i,g,r)**thetad(i,g,r) * P_I(i,g,r)**(1-thetad(i,g,r)))$CobbDouglas(esubdm(i)) + \

( (thetad(i,g,r) *P_D(i,g,r)**(1-esubdm(i)) + \

(1-thetad(i,g,r))*P_I(i,g,r)**(1-esubdm(i)))**(1/(1-esubdm(i))))$CES(esubdm(i)))

$if defined i_ $abort "The C_M(g,r) macro requires a uniquely defined alias for i."

alias (i,i_);

$macro C_M(g,r) ( \

( (sum(i_$thetam(i_,g,r), thetam(i_,g,r) * \

C_A(i_,g,r)**(1-esub(g,r)))**(1/(1-esub(g,r))))$CES(esub(g,r)) + \

prod(i_$thetam(i_,g,r), C_A(i_,g,r)**thetam(i_,g,r))$CobbDouglas(esub(g,r)) + \

sum(i_$thetam(i_,g,r), thetam(i_,g,r) * C_A(i_,g,r))$Leontief(esub(g,r)) ) )

* Unit cost function:

$macro C_Y(g,r) (theta_f(g,r)*C_F(g,r) + (1-theta_f(g,r))*C_M(g,r))

* Unit revenue function:

$macro R_Y(g,r) ( P(g,r)$(not vxm(g,r)) + \

(((1-theta_e(g,r))* P(g,r)**(1+etadx(g)) + \

theta_e(g,r) * PE(g,r)**(1+etadx(g)))**(1/(1+etadx(g))))$vxm(g,r) )

* Demand functions:

$macro DDY(i,g,r) ((vdfm(i,g,r)*Y(g,r)*(C_A(i,g,r)/P_D(i,g,r))**esubdm(i) * \

(C_M(g,r)/C_A(i,g,r))**esub(g,r))$vdfm(i,g,r))

$macro DDA(i,r) ((vdfm(i,"C",r)*A(i,r)*(C_A(i,"C",r)/P_D(i,"C",r))**esubdm(i) * \

(C_M("C",r)/C_A(i,"C",r))**esub("c",r))$vdfm(i,"c",r))

$macro DIY(i,g,r) ((vifm(i,g,r) * Y(g,r) * (C_A(i,g,r) /P_I(i,g,r) )**esubdm(i) * \

(C_M(g,r)/C_A(i,g,r))**esub(g,r))$vifm(i,g,r))

$macro DIA(i,r) ((vifm(i,"c",r) * A(i,r) * \

(C_A(i,"C",r)/P_I(i,"C",r))**esubdm(i))$(vifm(i,"C",r)*vcm(i,r)))

$macro DDFM(i,g,r)

$macro DIFM(i,g,r)

(DDY(i,g,r)$vom(g,r) + DDA(i,r)$(sameas(g,"c") and vcm(i,r)))

(DIY(i,g,r)$vom(g,r) + DIA(i,r)$(sameas(g,"c") and vcm(i,r)))

$macro DFM(f,g,r) (vfm(f,g,r) * Y(g,r) * (C_F(g,r)/P_PF(f,g,r))**esubva(g))$vfm(f,g,r)

$macro S_D(g,r) ((1$(not vxm(g,r)) + ((P(g,r) /R_Y(g,r))**etadx(g))$vxm(g,r)) * \

(vom(g,r)-vxm(g,r)) * Y(g,r))

$macro S_E(g,r)

(vxm(g,r)*Y(g,r)*(PE(g,r)/R_Y(g,r))**etadx(g))

61

* Associated tax revenue flows:

$macro REV_TO(g,r)

(rto(g,r)*R_Y(g,r)*vom(g,r)*Y(g,r))

$macro REV_TFD(i,g,r) ((rtfd(i,g,r) * P(i,r) * DDFM(i,g,r))$(rm(r)*rtfd(i,g,r)*vdfm(i,g,r)))

$macro REV_TFI(i,g,r)

((rtfi(i,g,r) * PM(i,r) * DIFM(i,g,r))$(rm(r)*rtfi(i,g,r)*vifm(i,g,r)))

$macro REV_TF(f,g,r) ((rtf(f,g,r) * DFM(f,g,r) * \

((PS(f,g,r))$sf(f)+(PF(f,r))$mf(f)))$(rm(r)*vom(g,r)*rtf(f,g,r)*vfm(f,g,r)))

prf_y(g,r)$(rm(r)*vom(g,r))..

cy0(g,r)*C_Y(g,r) =e= vom(g,r)*(1-rto(g,r))*R_Y(g,r);

International transportation services – YT(j)

* $prod:YT(j)$vtw(j) s:1

* o:PT(j) q:vtw(j)

* i:PE(j,r)$(rm(r)*vxm(j,r)) q:vst(j,r)

* i:P(j,r)$(rm(r)*(not vxm(j,r))) q:vst(j,r)

* i:PFX q:(sum(rx(r),vst(j,r)))

$macro PYT(j,r) (PX(j,r)$rm(r) + (PFX)$rx(r))

prf_yt(j)$vtw(j).. sum(r,vst(j,r)) *

prod(r, PYT(j,r)**thetayt(j,r)) =e= vtw(j)*PT(j);

* Demand Function:

$macro DST(j,r)

((vst(j,r)*YT(j)*PT(j)/PYT(j,r))$vst(j,r))

Aggregate imports – M(i,r)

* $prod:M(i,r)$(rm(r)*vim(i,r)) s:esubm(i) s.tl:0

* o:PM(i,r) q:vim(i,r)

* i:PE(i,s)$(rm(s)*vxm(i,s)) q:vxmd(i,s,r) p:pvxmd(i,s,r) s.tl:

* + a:RA(s) t:(-rtxs(i,s,r)) a:RA(r) t:(rtms(i,s,r)*(1-rtxs(i,s,r)))

* i:P(i,s)$(rm(s)*(not vxm(i,s))) q:vxmd(i,s,r) p:pvxmd(i,s,r) s.tl:

* + a:RA(s) t:(-rtxs(i,s,r)) a:RA(r) t:(rtms(i,s,r)*(1-rtxs(i,s,r)))

* i:PT(j)#(s) q:vtwr(j,i,s,r) p:pvtwr(i,s,r) s.tl:

* + a:RA(r) t:rtms(i,s,r)

* i:PE(i,rx)$vem(i,rx) q:vxmd(i,rx,r) p:pvxmd(i,rx,r) rx.tl:

* + a:ROW t:(-rtxs(i,rx,r)) a:RA(r) t:(rtms(i,rx,r)*(1-rtxs(i,rx,r)))

* User cost indices:

$macro P_M(i,s,r) ((PX(i,s) * \

(1-rtxs(i,s,r))*(1+rtms(i,s,r))/pvxmd(i,s,r))$vxmd(i,s,r) + 1$(vxmd(i,s,r)=0))

$macro P_T(j,i,s,r) ((PT(j)*(1+rtms(i,s,r))/pvtwr(i,s,r))$vtwr(j,i,s,r)+1$(vtwr(j,i,s,r)=0))

* Price index of bilateral imports (Leontief cost function):

$if defined j1 $abort "The PT_M(i,s,r) macro requires a uniquely defined alias for j."

alias (j,j1);

$macro PT_M(i,s,r) (P_M(i,s,r)*thetavxmd(i,s,r) + sum(j1, P_T(j1,i,s,r)*thetavtwr(j1,i,s,r)))

* Unit cost function for imports (CES):

$if defined s_ $abort "The CIM(i,r) macro requires a uniquely defined alias for s."

alias (s,s_);

$macro CIM(i,r) ( \

sum(s_, theta_m(i,s_,r) * PT_M(i,s_,r) )$Leontief(esubm(i)) + \

prod(s_, PT_M(i,s_,r)**theta_m(i,s_,r) )$CobbDouglas(esubm(i)) + \

62

(sum(s_, theta_m(i,s_,r) * PT_M(i,s_,r)**(1-esubm(i)))**(1/(1-esubm(i))))$CES(esubm(i)) )

prf_m(i,rm(r))$vim(i,r)..

CIM(i,r)*vim(i,r) =e= PM(i,r)*vim(i,r);

* Demand function:

$macro DXMD(i,s,r) ((vxmd(i,s,r) * M(i,r) * (PM(i,r)/PT_M(i,s,r))**esubm(i))$vxmd(i,s,r))

$macro DTWR(j,i,s,r) ((vtwr(j,i,s,r) * M(i,r) * (PM(i,r)/PT_M(i,s,r))**esubm(i))$vtwr(j,i,s,r))

* Associated tax revenue:

alias (rm,sm);

$macro XMD(i,s,r) ((DXMD(i,s,r)/vxmd(i,s,r))$(rm(r)*vim(i,r)*vxmd(i,s,r)) \

+ X(i,s)$(rm(s) and rx(r) and vxmd(i,s,r)))

$macro REV_TXS(i,s,r) ((XMD(i,s,r)*vxmd(i,s,r)*PX(i,s)*rtxs(i,s,r))$(rm(s) and vxmd(i,s,r)))

$if defined j2 $abort "The REVTMS(r) macro requires a uniquely defined alias for j."

alias (j,j2);

$macro REV_TMS(i,s,r) ((XMD(i,s,r)*rtms(i,s,r)* \

((1-rtxs(i,s,r))*vxmd(i,s,r)*PX(i,s) + \

sum(j$vtwr(j,i,s,r), PT(j)*vtwr(j,i,s,r))))$(rm(r)*vxmd(i,s,r)*rtms(i,s,r)))

Sector-specific factor transformation – FT(f,r)

* $prod:FT(sf,r)$evom(sf,r) t:etrae(sf)

* o:PS(sf,j,r) q:vfm(sf,j,r)

* i:PF(sf,r) q:evom(sf,r)

$if defined j3 $abort "The PVFM(sf,r) macro requires a uniquely defined alias for j."

alias (j,j3);

$macro PVFM(sf,r) (sum(j3,thetavfm(sf,j3,r)*PS(sf,j3,r)**(1+etrae(sf)))**(1/(1+etrae(sf))))

prf_ft(sf,rm(r))$evom(sf,r)..

evom(sf,r)*PF(sf,r) =e= evom(sf,r)*PVFM(sf,r);

Market clearance

These equations do not appear explicitly in the MPSGE model, as they are generated automatically

on the basis of the production function information provided above.

Domestic production and final demand – PY(g,r)

alias (g,gg);

mkt_p(g,rm(r))$(rm(r)*(vom(g,r)-vxm(g,r)))..

S_D(g,r) =e= (RA(r)/P(g,r))$(vom(g,r) and cd(g)) +

vom(g,r)$(sameas(g,"G") or sameas(g,"I") or sameas(g,"sd")) +

sum(i$sameas(i,g),

sum(gg,DDFM(i,gg,r)) +

(X(i,r)*vem(i,r)+sum(sm(s),DXMD(i,r,s)) + DST(i,r))$(not vxm(i,r)));

Export supply and demand – PE(i,r)

mkt_pe(i,r)$(rm(r)*vxm(i,r) or rx(r)*vem(i,r))..

S_E(i,r)$rm(r) + (X(i,r)*vem(i,r))$rx(r) =e=

sum(sm(s),DXMD(i,r,s)) + (X(i,r)*vem(i,r) + DST(i,r))$rm(r);

63

Composite imports – PM(i,r)

mkt_pm(i,rm(r))$vim(i,r)..

M(i,r) * vim(i,r) =e= sum(g, DIFM(i,g,r));

Transport services – PT(j)

mkt_pt(j)$vtw(j)..

YT(j) * vtw(j) =e= sum((i,s,r)$vtwr(j,i,s,r),

DTWR(j,i,s,r)$rm(r) + vtwr(j,i,s,r)$rx(r));

Primary factors – PF(f,r)

mkt_pf(f,rm(r))$evom(f,r)..

evom(f,r) =e= sum(j, DFM(f,j,r))$mf(f) + (evom(f,r)*FT(f,r))$sf(f);

Specific factors – PS(f,j,r)

mkt_ps(sf,j,rm(r))$vfm(sf,j,r)..

vfm(sf,j,r) * (PS(sf,j,r)/PF(sf,r))**etrae(sf) * FT(sf,r) =e= DFM(sf,j,r);

Regional income balance – RA(r)

* $demand:RA(r)$rm(r) s:0

* d:P("c",r) q:vom("c",r)

* e:P("g",r) q:(-vom("g",r))

* e:P("i",r) q:(-vom("i",r))

* e:P("i",rnum)$rm(rnum) q:vb(r)

* e:PFX$rx(rnum) q:vb(r)

* e:PF(f,r) q:evom(f,r)

* d:PF(f,r)$cde(r) q:evom(f,r)

* e:PF(f,r)$cde(r) q:evom(f,r)

* e:PA(i,r) q:(-vcm(i,r)) R:D(i,r)

inc_ra(rm(r))$(RA.LO(r) < RA.UP(r))..

RA(r) =e= ( sum(f$evom(f,r), PF(f,r)*evom(f,r))

- sum(i$vcm(i,r), PA(i,r)*vcm(i,r)*D(i,r)) )$cde(r)

+ vb(r)*((PFX)$rx(rnum)+P("i",rnum)$rm(rnum))

- P("g",r)*vom("g",r)

- P("i",r)*vom("i",r)

- (P("sd",r)*vom("sd",r))$vom("sd",r)

+ sum(f$evom(f,r), PF(f,r)*evom(f,r))

+ sum(g,REV_TO(g,r))

+ sum((i,g),REV_TFD(i,g,r))

+ sum((i,g),REV_TFI(i,g,r))

+ sum((f,g),REV_TF(f,g,r))

- sum((i,s),REV_TXS(i,r,s))

+ sum((i,s),REV_TMS(i,s,r));

Model Declaration

* Two flavors: The MCP declaration declares equations

* and associates these with variables. The CNS declaration simply declares

* equations:

model gtap9 /

prf_y.Y,prf_x.X,prf_a.A,prf_m.M,prf_yt.YT,prf_ft.FT,

64

mkt_p.P,mkt_pe.PE,mkt_pa.PA,mkt_pm.PM,mkt_pt.PT,mkt_pf.PF,mkt_ps.PS,mkt_pfx.PFX,

constraint_D.D, constraint_U.U, constraint_CC.CC,

inc_ra.RA, inc_row.ROW/;

model gtap9cns /

prf_y,prf_x,prf_a,prf_m,prf_yt,prf_ft,

mkt_p,mkt_pe,mkt_pa,mkt_pm,mkt_pt,mkt_pf,mkt_ps,mkt_pfx,

constraint_D, constraint_U, constraint_CC,

inc_ra, inc_row/;

* Assign default values:

Y.L(g,r) = 1;

A.L(i,r) = 1;

X.L(i,r) = 1;

M.L(i,r) = 1;

YT.L(j) = 1;

FT.L(sf,r) = 1;

P.L(g,r) = 1;

PA.L(i,r) = 1;

PM.L(j,r) = 1;

PM.FX(j,r)$(not vim(j,r)) = 0;

PT.L(j) = 1;

PF.L(f,r) = 1;

PS.L(sf,j,r) = 1;

PFX.L = 1;

X.L(i,r)$vem(i,r) = 1;

PE.L(i,r)$vxm(i,r) = 1;

65

Macros to Move Between Closures and Demand Systems

* Declare some macros to move between model types:

$macro loaddsys(ff,r) \

if (sameas(ff,"les"), loadles(r); ); \

if (sameas(ff,"cd"), loadcd(r); ); \

if (sameas(ff,"cde"), loadcde(r); );

$macro loadles(r) \

loadcd(r); \

les(r) = yes; \

esub("sd",r) = 0; \

esub("dd",r) = 1; \

rtfd(i,lesd,r) = rtfd(i,"c",r); \

rtfi(i,lesd,r) = rtfi(i,"c",r); \

vdfm(i,"sd",r) = vdfm(i,"c",r)*(1-betales(r)*eta(i,r)); \

vifm(i,"sd",r) = vifm(i,"c",r)*(1-betales(r)*eta(i,r)); \

vdfm(i,"dd",r) = vdfm(i,"c",r)*betales(r)*eta(i,r); \

vifm(i,"dd",r) = vifm(i,"c",r)*betales(r)*eta(i,r); \

vom(lesd,r) = sum(i,vdfm(i,lesd,r)*(1+rtfd(i,lesd,r)) + \

vifm(i,lesd,r)*(1+rtfi(i,lesd,r))); \

vom("c",r) = 0;

$macro loadcde(r) \

loadcd(r); \

cde(r) = yes; \

vcm(i,r) = vdfm(i,"c",r)*(1+rtfd(i,"c",r)) + vifm(i,"c",r)*(1+rtfi(i,"c",r)); \

vom(cd,r) = 0; \

U.L(r) = 1; \

D.L(i,r)$vcm(i,r) = 1; \

CC.L(r) = 1;

$macro loadcd(r) \

unloadcde(r) \

unloadles(r)

$macro unloadles(r) \

rtfd(i,lesd,r) = 0; \

rtfi(i,lesd,r) = 0; \

vdfm(i,lesd,r) = 0; \

vifm(i,lesd,r) = 0; \

vom("c",les(r)) = sum(i,vdfm(i,"c",r)*(1+rtfd(i,"c",r)) + \

vifm(i,"c",r)*(1+rtfi(i,"c",r))); \

vom(lesd,les(r)) = 0; \

les(r) = no;

$macro unloadcde(r) \

vom("c",cde(r)) = sum(i,vdfm(i,"c",r)*(1+rtfd(i,"c",r)) + \

vifm(i,"c",r)*(1+rtfi(i,"c",r))); \

vcm(i,cde(r)) = 0; \

U.L(cde(r)) = 0; \

D.L(i,cde(r)) = 0; \

CC.L(cde(r)) = 0; \

cde(r) = no;

$if defined ii_ $abort "The loadrm(r) macro requires a uniquely defined alias for i."

$if defined ss_ $abort "The loadrm(r) macro requires a uniquely defined alias for s."

alias (r,r_,rr), (j,j_),(i,ii_), (s,ss_), (f,f_);

$macro loadrm(r) \

rm(r_) = no; \

rm(r) = yes; \

rnum(r) = yes$(rm(r) and (vom("c",r)+vom("sd",r)+vom("dd",r)= \

smax(rm,vom("c",rm)+vom("sd",rm)+vom("dd",rm)))); \

rx(r_) = (not rm(r_)); \

vem(ii_,r_) = sum(rx,vxmd(ii_,r_,rx))$rm(r_) + sum(rm,vxmd(ii_,r_,rm))$rx(r_); \

vem(ii_,r_)$(not round(vem(ii_,r_),5)) = 0; \

rtxs_row(ii_,r_) = \

(sum(rx,vxmd(ii_,r_,rx)*rtxs(ii_,r_,rx))/vem(ii_,r_))$(rm(r_) and vem(ii_,r_));\

66

owpfx = sum(rx, vom("c",rx)+vom("sd",rx)+vom("dd",rx)+ \

sum(ii_,vcm(ii_,rx))+sum((j_,ii_,ss_),vtwr(j_,ii_,ss_,rx))) + sum(rm,vb(rm));\

pem0(ii_,r_) = (1-rtxs_row(ii_,r_))$rm(r_);

GDP Reporting Code

$stitle

GAMS Code for GDP Reporting from the MGE or MCP Model

$ifthen.undefined not defined gdpcat

* Declaration:

set

gdpcat /expend,income,valueadded, total/,

$endif.undefined

gdpitem /"X-M",set.g,set.f,

revto,revtfd,revtfi,revtf,revtxs,revtms,

expend,income,valueadded,chksum/;

alias (gdpitem, gdpi);

parameter gdp(gdpcat,*,gdpitem) Real GDP accouting

vadd(g, gdpitem, r) GDP on a value-added basis;

$ondotl

loop(rm(r),

gdp("expend",r,"C") = RA(r)/pnum

+ ( sum(i$vcm(i,r), PA(i,r)*vcm(i,r)*D(i,r))/pnum

- sum(f_$evom(f_,r), PF(f_,r)*evom(f_,r)) /pnum )$cde(r)

+ (P("sd",r)*vom("sd",r)/pnum )$vom("sd",r);

gdp("expend",r,"X-M") = -vb(r)*(PFX$rx(rnum)+P("i",rnum)$rm(rnum))/pnum;

gdp("expend",r,"g") = P("g",r)*vom("g",r)/pnum ;

gdp("expend",r,"i") = P("i",r)*vom("i",r)/pnum ;

vadd(i,gdpitem(f),r) = DFM(f,i,r)*(PF.L(f,r)*mf(f)+PS.L(f,i,r)$sf(f))/pnum;

vadd(g,"revto",r) = REV_TO(g,r)/pnum;

vadd(g,"revtfd",r) = sum(i,REV_TFD(i,g,r))/pnum;

vadd(g,"revtfi",r) = sum(i,REV_TFI(i,g,r))/pnum;

vadd(g,"revtf",r) = sum(f,REV_TF(f,g,r))/pnum;

vadd(i,"revtxs",r) = -sum(s,REV_TXS(i,r,s))/pnum;

vadd(i,"revtms",r) = sum(s, REV_TMS(i,s,r))/pnum;

gdp("valueadded",r,gdpitem(g)) = sum(gdpi,vadd(g,gdpi,r));

gdp("income",r,gdpitem(f)) = PF(f,r)*evom(f,r)/pnum;

gdp("income",r,"revto") = sum(g,REV_TO(g,r))/pnum;

gdp("income",r,"revtfd") = sum((i,g), REV_TFD(i,g,r))/pnum;

gdp("income",r,"revtfi") = sum((i,g), REV_TFI(i,g,r))/pnum;

gdp("income",r,"revtf") = sum((f,g), REV_TF(f,g,r))/pnum;

gdp("income",r,"revtxs") = -sum((i,s), REV_TXS(i,r,s))/pnum;

gdp("income",r,"revtms") = sum((i,s), REV_TMS(i,s,r))/pnum;

gdp("total",r,"valueadded") = sum((g,gdpitem),vadd(g,gdpitem,r));

gdp("total",r,"expend") =

gdp("expend",r,"c")

+ gdp("expend",r,"i")

+ gdp("expend",r,"g")

+ gdp("expend",r,"x-m");

gdp("total",r,"income") =

sum(gdpitem(f), gdp("income",r,gdpitem))

+ gdp("income",r,"revto")

+ gdp("income",r,"revtfd")

+ gdp("income",r,"revtfi")

+ gdp("income",r,"revtf")

67

);

+ gdp("income",r,"revtxs")

+ gdp("income",r,"revtms");

gdp("total",r,"chksum") =

abs(gdp("total",r,"expend") - gdp("total",r,"income")) +

abs(gdp("total",r,"expend") - gdp("total",r,"valueadded")) ;

68

GAMS/MPSGE Version

$title

GTAP9inGAMS -- GAMS/MPSGE Formulation

$if not set yr $set yr 11

$if not set ds $set ds g20

$include "%system.fp%gtap9data"

$ontext

$model:gtap9

$sectors:

Y(g,r)$(rm(r)*vom(g,r))

! Supply

M(i,r)$(rm(r)*vim(i,r))

! Imports

YT(j)$vtw(j)

! Transportation services

FT(f,r)$(rm(r)*sf(f)*evom(f,r)) ! Specific factor transformation

A(i,r)$(rm(r)*vcm(i,r))

! Armington final demand quantity index (CDE model)

X(i,r)$vem(i,r)

! Exports to or from rest of world (SOE model)

$commodities:

P(g,r)$(rm(r)*(vom(g,r)-vxm(g,r)))

PE(g,r)$(rx(r)*vem(g,r)+rm(r)*vxm(g,r))

PM(j,r)$(rm(r)*vim(j,r))

PT(j)$vtw(j)

PF(f,r)$(rm(r)*evom(f,r))

PS(f,g,r)$(rm(r)*sf(f)*vfm(f,g,r))

PFX$card(rx)

PA(i,r)$(rm(r)*vcm(i,r))

! Domestic output price

! Export market

! Import price

! Transportation services

! Primary factors rent

! Sector-specific primary factors

! Real exchange rate (SOE model)

! Armington final demand price

$consumers:

RA(r)$rm(r)

ROW$card(rx)

! Representative agent

! Rest of world (SOE model)

$auxiliary:

D(i,r)$(rm(r)*vcm(i,r)) ! Demand (index)

U(r)$(rm(r)*cde(r)) ! Utility (index)

CC(r)$(rm(r)*cde(r)) ! Consumption cost index

$prod:Y(g,r)$(rm(r)*vom(g,r)) s:0 t:etadx(g) m:esub(g,r) va:esubva(g) i.tl(m):esubdm(i)

o:P(g,r) q:(vom(g,r)-vxm(g,r)) a:RA(r) t:rto(g,r) p:(1-rto(g,r))

o:PE(g,r) q:vxm(g,r) a:RA(r) t:rto(g,r) p:(1-rto(g,r))

i:P(i,r) q:vdfm(i,g,r) p:(1+rtfd0(i,g,r)) i.tl: a:RA(r) t:rtfd(i,g,r)

i:PM(i,r) q:vifm(i,g,r) p:(1+rtfi0(i,g,r)) i.tl: a:RA(r) t:rtfi(i,g,r)

i:PS(sf,g,r) q:vfm(sf,g,r) p:(1+rtf0(sf,g,r)) va: a:RA(r) t:rtf(sf,g,r)

i:PF(mf,r) q:vfm(mf,g,r) p:(1+rtf0(mf,g,r)) va: a:RA(r) t:rtf(mf,g,r)

$prod:YT(j)$vtw(j) s:1

o:PT(j)

q:vtw(j)

i:PE(j,r)$(rm(r)*vxm(j,r)) q:vst(j,r)

i:P(j,r)$(rm(r)*(not vxm(j,r))) q:vst(j,r)

i:PFX

q:(sum(rx,vst(j,rx)))

$prod:M(i,r)$(rm(r)*vim(i,r)) s:esubm(i) s.tl:0

o:PM(i,r)

q:vim(i,r)

i:PE(i,rm)$vxm(i,rm) q:vxmd(i,rm,r) p:pvxmd(i,rm,r) rm.tl:

+ a:RA(rm) t:(-rtxs(i,rm,r)) a:RA(r) t:(rtms(i,rm,r)*(1-rtxs(i,rm,r)))

i:P(i,rm)$(not vxm(i,rm)) q:vxmd(i,rm,r) p:pvxmd(i,rm,r) rm.tl:

+ a:RA(rm) t:(-rtxs(i,rm,r)) a:RA(r) t:(rtms(i,rm,r)*(1-rtxs(i,rm,r)))

i:PT(j)#(s)

q:vtwr(j,i,s,r) p:pvtwr(i,s,r) s.tl: a:RA(r) t:rtms(i,s,r)

i:PE(i,rx)$vem(i,rx) q:vxmd(i,rx,r) p:pvxmd(i,rx,r) rx.tl:

+ a:ROW t:(-rtxs(i,rx,r)) a:RA(r) t:(rtms(i,rx,r)*(1-rtxs(i,rx,r)))

$prod:FT(sf,r)$(rm(r)*evom(sf,r)) t:etrae(sf)

o:PS(sf,j,r) q:vfm(sf,j,r)

i:PF(sf,r) q:evom(sf,r)

$demand:RA(r)$rm(r) s:0

d:P(cd,r)

e:P("g",r)

e:P("i",r)

q:vom(cd,r)

q:(-vom("g",r))

q:(-vom("i",r))

69

e:P("i",rnum)$rm(rnum)

e:PFX$rx(rnum)

e:PF(f,r)

q:vb(r)

q:vb(r)

q:evom(f,r)

* Coefficient for the LES demand system:

e:P("sd",r)

q:(-vom("sd",r))

* Coefficient for the CDE demand system:

d:PF(f,r)$cde(r) q:evom(f,r)

e:PF(f,r)$cde(r) q:evom(f,r)

e:PA(i,r)$cde(r) q:(-vcm(i,r)) R:D(i,r)

* -------------------------------------------------------------------

* Additional code for the SOE closure:

$prod:X(i,r)$(rm(r)*vem(i,r))

o:PFX

q:(pem0(i,r)*vem(i,r))

i:P(i,r)$(not vxm(i,r)) q:vem(i,r) a:RA(r) t:(-rtxs_row(i,r))

i:PE(i,r)$vxm(i,r) q:vem(i,r) a:RA(r) t:(-rtxs_row(i,r))

$prod:X(i,r)$(rx(r)*vem(i,r))

o:PE(i,r)

i:PFX

$demand:ROW$card(rx)

e:PFX

e:P("i",rnum)$rm(rnum)

e:PT(j)

d:PFX

q:vem(i,r)

q:vem(i,r)

q:rowpfx

q:(-sum(rm,vb(rm)))

q:(-sum((i,s,rx), vtwr(j,i,s,rx)))

$prod:A(i,r)$(rm(r)*vcm(i,r)) s:esubdm(i)

o:PA(i,r) q:vcm(i,r)

i:P(i,r) q:vdfm(i,"c",r) p:(1+rtfd0(i,"c",r)) a:RA(r) t:rtfd(i,"c",r)

i:PM(i,r) q:vifm(i,"c",r) p:(1+rtfi0(i,"c",r)) a:RA(r) t:rtfi(i,"c",r)

$constraint:D(i,r)$(rm(r)*vcm(i,r))

D(i,r) * sum(j$thetac(j,r), thetac(j,r) *

U(r)**((1-subpar(j,r))*incpar(j,r)) *

(PA(j,r)/CC(r))**(1-subpar(j,r)))

=e= U(r)**((1-subpar(i,r))*incpar(i,r)) *

(PA(i,r)/CC(r))**(-subpar(i,r));

$constraint:U(r)$(cde(r)*rm(r))

sum(f, PF(f,r)*evom(f,r)) =e= RA(r);

$constraint:CC(r)$(cde(r)*rm(r))

sum(i, thetac(i,r) * U(r)**((1-subpar(i,r))*incpar(i,r)) *

(PA(i,r)/CC(r))**(1-subpar(i,r))) =e= 1;

$report:

v:V_VST(i,r)$(vst(i,r) and rm(r) and (not vxm(i,r))) i:P(i,r) prod:YT(i)

v:V_VST(i,r)$(vst(i,r) and rm(r) and vxm(i,r)) i:PE(i,r) prod:YT(i)

v:V_VDM(g,r)$(rm(r)*(vom(g,r)-vxm(g,r))) o:P(g,r) prod:Y(g,r)

v:V_XMD(i,s,r)$(vxmd(i,s,r)*rm(s)*vxm(i,s)) i:PE(i,s) prod:M(i,r)

v:V_XMD(i,s,r)$(vxmd(i,s,r)*rx(s)) i:PE(i,s) prod:M(i,r)

v:V_VXM(g,r)$(rm(r)*vom(g,r)*vxm(g,r)) o:PE(g,r) prod:Y(g,r)

v:V_DFM(i,g,r)$(rm(r)*vom(g,r)*vdfm(i,g,r)) i:P(i,r) prod:Y(g,r)

v:V_IFM(i,g,r)$(rm(r)*vom(g,r)*vifm(i,g,r)) i:PM(i,r) prod:Y(g,r)

v:V_FM(f,g,r)$(sf(f)*rm(r)*vom(g,r)*vfm(f,g,r)) i:PS(f,g,r) prod:Y(g,r)

v:V_FM(f,g,r)$(mf(f)*rm(r)*vom(g,r)*vfm(f,g,r)) i:PF(f,r) prod:Y(g,r)

v:V_XMD(i,s,r)$(vxmd(i,s,r)*rm(s)*(not vxm(i,s))) i:P(i,s) prod:M(i,r)

v:V_VDA(i,r)$(RM(R)*vcm(i,r)*vdfm(i,"c",r)) i:P(i,r) PROD:A(i,r)

v:V_VIA(i,r)$(RM(R)*vcm(i,r)*vifm(i,"c",r)) i:PM(i,r) PROD:A(i,r)

$offtext

$sysinclude mpsgeset gtap9

alias (i,i_,j_), (f,f_);

70

$macro pnum (P("c",rnum))

$macro DFM(f,g,r) (V_FM.L(f,g,r)$(rm(r)*vom(g,r)*vfm(f,g,r)))

$macro DDFM(i,g,r) (V_DFM.L(i,g,r) + V_VDA.L(i,r)$(vcm(i,r) and sameas(g,"c")))

$macro DIFM(i,g,r) (V_IFM.L(i,g,r) + V_VIA.L(i,r)$(vcm(i,r) and sameas(g,"c")))

$macro REV_TO(g,r) ((rto(g,r)*((P.L(g,r)*V_VDM.L(g,r))$(vom(g,r)-vxm(g,r))+\

(PE.L(g,r)*v_vxm.L(g,r))$vxm(g,r)))$(rm(r)*vom(g,r)))

$macro REV_TFD(i,g,r) (rtfd(i,g,r) * P.L(i,r) * DDFM(i,g,r))

$macro REV_TFI(i,g,r) (rtfi(i,g,r) * PM.L(i,r) * DIFM(i,g,r))

$macro REV_TF(f,g,r) ((rtf(f,g,r) * v_fm.L(f,g,r) * ((PS.L(f,g,r))$sf(f)+\

(PF.L(f,r))$mf(f)))$(rm(r)*vom(g,r)*vfm(f,g,r)))

$macro XMD(i,s,r) ((V_XMD.L(i,s,r)/vxmd(i,s,r))$(rm(r)*vim(i,r)*vxmd(i,s,r)) \

+ X.L(i,s)$(rm(s) and rx(r) and vxmd(i,s,r)))

$macro PX(i,r)

((P.L(i,r)$(not vxm(i,r)) + PE.L(i,r)$vxm(i,r))$rm(r) + PE.L(i,r)$rx(r))

$macro REV_TXS(i,s,r) ((XMD(i,s,r)*rtxs(i,s,r)*vxmd(i,s,r) * PX(i,s))$(rm(s)*vxmd(i,s,r)*rtxs(i,s,r)))

$macro REV_TMS(i,s,r) ((XMD(i,s,r)*rtms(i,s,r)*(PX(i,s)*(1-rtxs(i,s,r))*vxmd(i,s,r) + \

sum(j_$vtwr(j_,i,s,r), PT.L(j_)*vtwr(j_,i,s,r))))$(rm(r)*vxmd(i,s,r)*rtms(i,s,r)))

gtap9.workspace = 1024;

gtap9.iterlim = 0;

$include gtap9.gen

solve gtap9 using mcp;

parameter maxdev /1e-3/;

abort$(gtap9.objval > maxdev) "GTAP9 replication fails.", gtap9.objval;

71

References

Aguiar, A., B. Narayanan, and R. McDougall (20**16**) “An overview of the GTAP 9 data base,”

Journal of Global Economic Analysis, 1 (1), pp. 181 – 208.

Böhringer, C., J. Carbone, and T. F. Rutherford (20**16**) “The strategic value of carbon tariffs,”

American Economic Journal: Economic Policy, 8, 1, pp. 28–51.

Böhringer, C. and T. F. Rutherford (2002) “Carbon abatement and international spillovers,”

Environmental and Resource Economics, 22(3), pp. 391–417.

Chen, H. (2015) “Economic projection with non-homothetic preferences: The performance

and application of a CDE demand system.” GTAP Conference Paper, resource # 4746, Purdue

University.

De Melo, J. and S. Robinson (1989) “Product differentiation and the treatment of foreign

trade in computable general equilibrium models of small economies,” Journal of International

Economics, 27, pp. 47–67.

Devarajan, S., J. Lewis, and S. Robinson (1990) “Policy lessons from trade-focused two-sector

models,” Journal of Policy Modeling, 12, pp. 625–657.

Hanoch, G. (1975) “Production and demand models with direct or indirect implicit additivity,”

Econometrica, 43, pp. 395 – 419.

Harrison, W. and K. Pearson (1996) “Computing solutions for large general equilibrium models

using GEMPACK,” Computational Economics, 9, 1, pp. 83–127.

(2007) “GEMPACK user documentation release 8.0.” Centre of Policy Studies and

Impact Project Monash University, Melbourne, Australia.

Hertel, T. ed. (1997) Global Trade Analysis: Modeling and Applications: Cambridge University

Press, Massachutes, USA.

Hertel, T., J. Grant, and T. F. Rutherford (2009) “Dairy tariff-quota liberalization,” American

Journal of Agricultural Economics, 91, 3, pp. 673–684.

Hertel, T. and D. van der Mensbrugghe (2015) “Behavioral parameters. database documentation:

Chapter 3,”Technical report, Purdue University.

72

Mathiesen, L. (1985) “Computation of economic equilibrium by a sequence of linear complementarity

problems,” Mathematical Programming Study, 23, pp. 144–**16**2.

McDougall, R. (2005) “The GTAP 6 database,”Technical report, Purdue University.

Narayanan, B. (2015) “What’s new in GTAP 9: Chapter 3,”Technical report, Purdue University.

Rutherford, T. (1999) “Applied general equilibrium modeling with MPSGE as a GAMS subsystem:

An overview of the modeling framework and syntax,” Computational Economcis,

14, pp. 1 – 46.

Rutherford, T. F. (1995) “Extension of GAMS for complementarity problems arising in applied

economic analysis,” Journal of Economic Dynamics and Control, 19(8), pp. 1299–1324.

(1997) “GTAPinGAMS,”Technical report, University of Colorado.

(2005) “GTAP6inGAMS: The dataset and static model.” mimeo,

http://www.mpsge.org/gtap6/gtap6gams.pdf (accessed July 20**16**).

73