Contents
MPSGE Syntax

Thomas Rutherford
 (with the assistance of Ken Pearson)


Introduction

MPSGE is a non-algebraic language for the formulation of applied general equilibrium models. When you build a model using MPSGE you do not need to specify equations, but you instead work with a tabular representation of the model. The input tables make reference to source statistics, typically drawn from a single benchmark year. MPSGE input data describing your model characterize technology, preferences, tax rates, and factor endowments. These data, together with a set of equilibrium conditions, defines the equilibrium framework.

MPSGE is a framework designed primarily to permit rapid prototyping of applied models. The compact, non-algebraic format can substantially improve productivity through the automated generation of demand and supply functions. This approach reduces the scope for errors and simplifies sensitivity analysis of results with respect to model structure. To take advantage of the MPSGE framework, a user must learn the syntax and conventions of the MPSGE language.

MPSGE was developed by Rutherford in the 1980s (Rutherford, 1985, 1987).  MPSGE has been used primarily by GAMS modellers who use the MPSGE subsystem of GAMS (Brooke et al, 1988, 1998) to formulate the equations of their models and then solve their model using the MILES or PATH algorithms (Rutherford, 1995, 1999). The recently developed MGE2GP program makes it is possible also to solve certain MPSGE models using GEMPACK.

The Elements of an MPSGE Model

Calibrated Share Form

New Restrictions


Basic Rules of Syntax

The following rules apply the statements which define an MPSGE model, independent of whether the model is solved in GAMS or GEMPACK.

All input is free format (spaces and tabs are ignored), except for keywords which must be preceded by a "$" appearing in column 1.

Input is organized into records which may span one or more liens. Continuation lines which are indicated by a "+" in column 1.

Text is not case sensitive.

Numeric fields may be specified as computed values using expressions involving GAMS syntax based on parameters/coefficients or constants. Fields based on computed values must be enclosed in parentheses.

MPSGE Section Heading Keywords


Variable Declarations

MPSGE requires that variables be declared according to their specific role in a model.  The four MPSGE keywords $SECTORS:,$COMMODITIES:, $CONSUMERS: and$AUXILIARY: therefore refer to the four different types of unknowns which may appear in a general equilibrium model.

When variables are defined according to their classification the compiler is then able to verify that when a variable appears within a function declaration it is properly referenced.

Here is a typical declaration block, one that refers to three classes of production activities in a given model:

$SECTORS:

   Y(R,T)  ! Output in region R in period T

   K(T)    ! "Aggregate capital stock, period T"

   I0      ! Base year investment

In the MPSGE syntax trailing comments (signified by "!") are interpreted as variable descriptors which subsequently appear in the solution listing.  When a variable descriptor contains a punctuation symbol such as ",", it is required to enclosed in quotes.

Domain Restriction


Function Declarations

A general equilibrium model is based on technology, preferences, policy instruments (most notably tax rates) and primary factor endowments.  Technology and policy instruments are described in$PROD: blocks.  Preferences and primary factor endowments are described in $DEMAND: blocks.

$PROD Block Syntax

$DEMAND Block Syntax


CONSTRAINT Syntax
$CONSTRAINT Syntax

Auxiliary constraints in MPSGE models conform to standard GAMS equation syntax for complementarity problems.  The may reference variables defined under any of the four classes, $SECTORS,$COMMODITIES, $CONSUMERS and $AUXILIARY.

Complementarity conditions apply to upper and lower bounds on auxiliary variables and the associated constraints.  For this reason, the orientation of the equation is important.  When an auxiliary variable is designated POSITIVE (the default), the auxiliary constraint should be expressed as a "greater or equal" inequality (=G=).  If an auxiliary variable is designated FREE, the associated constraint must be expressed as an equality (=E=).

$CONSTRAINT:TAU

        G =G= X * Y;

It is important to remember that the equations associated with complementarity problems are oriented.  In the default case, where an auxiliary variable has a lower bound of zero, then complementary slackness implies that whenever the left-hand side of the associated constraint exceeds the right-hand side, the variable value must be zero.

If you are unsure about how to orient a constraint for an auxiliary variable, think about how a constraint might become slack in case the variable is zero.  Complementary slackness in the case of the central variables is quite clear: if equilibrium unit cost exceeds equilibrium unit revenue for a particular activity, its level must be zero.  If equilibrium supply of a good exceeds demand, the associated market price must be zero.  In the case of auxiliary variables, the complementarity idea may enter differently.  Here are a few examples:

o	Classical unemployment:

$CONSTRAINT:U

     PL / PC =G= minwage;

The real wage is rigid downward, then the unemployment rate must be zero if the real wage exceeds the mandated minimum wage.  Given the way that complementarity constraints are defined in GAMS, the constraint shown above is not equivalent to the constraint:

     minwage =L= PL/PC;

o	Income support payments: when a transfer payment to a particular industry is defined by a target level of sectoral sales

$CONSTRAINT:TRNPAY

       Y =G= YLEVEL;

When formulated in this way the transfer payment must be zero if the equilibrium output level exceeds the target.


The Elements of an MPSGE Model

MPSGE is based on the modeling format for Arrow-Debreu general economic equilibrium models proposed by Mathiesen (1985) which was in turn based on Scarf (1973).  Mathiesen demonstrated that Arrow-Debreu models could be formulated and efficiently solved as complementarity problems.  Mathiesen's formulation may be posed in terms of three sets of "central variables'':

p	a non-negative n-vector of commodity prices including all final goods, intermediate goods and primary factors of production

y	a non-negative m-vector of activity levels associated with constant returns to scale production sectors in the economy

M	an h-vector of income levels, one for each "household'' in the model, including any government entities.


Calibrated Share Form

  Calibration formulae for CES functions are messy and difficult to remember.  Consequently, the specification of function coefficients is complicated and error-prone.  For applied work using calibrated functions, it is much easier to use the "calibrated share form'' of the CES function.  In the calibrated form, the cost and demand functions explicitly incorporate

o	benchmark factor demands

o	benchmark factor prices

o	the elasticity of substitution

o	benchmark cost

o	benchmark output

o	benchmark value shares  In this form, the production function is written:

The only calibrated parameter, θ, represents the value share of capital at the benchmark point, i.e.

The corresponding cost functions in the calibrated form is written:

where

and the compensated demand functions are:

and


New Restrictions

The version of MPSGE which has been developed for GEMPACK models follows the syntax and semantic rules as laid out in Rutherford (1999), but with the following restrictions:

o	Each sector must be defined in just one $prod: block.

o	Each consumer must be defined in just one $demand: block.

o	The declared domain for sectors must exactly match the domain of the associated  $prod: blocks.

o	The declared domain for consumers must exactly match the domain of the associated  $demand:  block.


MPSGE Section Heading Keywords

There are nine MPSGE keywords which appear in an MPSGE model declaration.  These are:

1.	$MODEL: modelID

This statement assigns an identifier to the present model.  This must be the first statement within the MGE file.  All records appearing prior to the $MODEL keyword within the MGE file are treated as comments.

modelID must be both a legitimate model identifier and a valid file name.  This name is used to form modelID.GEN.

2.	$SECTORS:, $COMMODITIES:,$AUXILIARY:, $CONSUMERS:

These four keywords define the variables which are used to define the MPSGE model.  Entries in these blocks share the same syntax.

3.	$AUXILIARY:

The $AUXILIARY keyword is only used in models with side constraints and endogenous taxes or rationed endowments.

4.	$PROD:sector

This statement indicates the start of a set of records which define technology and taxes for a particular activity.

5.	$DEMAND:consumer

This statement indicates the start of a set of records which define initial endowments and preferences for consumers in the model.

6.	$CONSTRAINT:auxiliary

This statement specifies the equilibrium condition which is to be associated with a particular auxiliary variable.  Equilibrium conditions are written following the conventional rules for expressing equations in an algebraic form.  An auxiliary constraint may reference variables corresponding to commodity prices, production activity levels, consumer income levels or report variables.


Domain Restriction

MPSGE is designed so that all and only those variables which are declared are actually employed in a particular model.  This form of "explicit declaration" helps to catch nuisance bugs in large-dimensional datasets.

The explicit declaration feature in MPSGE means that "wildcard declarations", such as X(*,*,*) are not permitted.  It also means that some care must be exercised when a database includes "missing goods".  Consider, for example, a model in which gis the set of goods in the underlying database, and P(g) is the associated vector of prices for these commodities. If a subset of the goods are missing from the database, then the declaration of P(g) must be restricted to those goods which are actually  appear in the model.  If y0(g) is a vector in which a value  of zero indicates that the associated good is not in the dataset. Appropriate declaration for the price vector could then be:

$COMMODITIES:

        P(g)$y0(g)      ! Commodity price vector

Detailed cross-checking can be somewhat annoying for users accustomed to the conventional algebraic syntax in which the declared domain of a variable may include many more scalar elements than are actually used in the model.

In order to simplify the declaration of "irregular domains" for variables in MPSGE, the declaration syntax accommodates the conditional operator "$".

To illustrate how this might work in a more complicated situation, suppose that a dynamic, multi-sectoral, multi-regional model accounts for the production of good i in region r and time period t withX(i,r,t).  Suppose that base year production levels are given byx0(i,r), and suppose, furthermore, that the model includes an upper bound on production in later periods given by u(i,r,t).

We would then only want to declare X(i,r,t) when bothx0(i,r) and u(i,r,t) are nonzero.  The MPSGE declaration to do this could be:

$SECTORS:

  X(i,r,t)$(min(x0(i,r),u(i,r,t)) > 0)  ! Production levels

The computed conditional ("$()") is handy because it avoids the need to introduce any additional symbols into the program.  If, however, the same conditional restriction appears at several points in a model it may be helpful to define a set with which to control declarations for several variables.

Using a coefficient array, the previous example could be written:

$SECTORS:

        X(i,r,t)$IX(i,r,t)      ! Production levels

        ...

$COMMODITIES:

        PX(i,r,t)$IX(i,r,t)     ! Output prices

        RK(i,r,t)$IX(i,r,t)     ! Capital returns

        ...


PROD Block Syntax
$PROD Block Syntax

Most of the power and subtleties of the MPSGE framework for applied general equilibrium analysis centers on the $PROD tables.  The information conveyed in a $PROD block includes which is characterized:

o	Reference quantities for inputs and outputs.

o	Reference producer prices of inputs and outputs.

o	Exogenous taxes applied to inputs and outputs.

o	Endogenous taxes applied to inputs and outputs.

The nested constant elasticity of substitution (CES) / constant elasticity of transformation (CET) elasticity structure at the reference point.

All records in a $PROD block must begin with either an

o	I: or O: record.  The recognized labels in these records within a $PROD block include:

o	Q: Reference quantity.  Default value is 1.  When specified, it must be the second field, immediately followingI: or O:.

o	P: Reference price.  The default value of the reference price is 1.

o	A: Tax revenue agent.  This field must be followed by a consumer name.

o	T: Tax rate field identifier.  (More than one tax may apply to a single entry.

o	N: Endogenous tax.  This label must be followed by the name of an auxiliary variable.

o	M: Exogenous tax multiplier.  The ad valorem tax rate is the product of the value of the endogenous tax (as in theN: field) and this multiplier.

o	va:, kle:, etc.  Nesting assignments referencing identifiers introduced in the $PROD record. Only one such label may be applied at a time, although several nesting assignemnts may be included on a given line when exception operators identify only a single nest assignment to be included.

A given structure of nest and subnest elasticities corresponds to a particular set of own- and pairwise elasticities and a specific second-order approximation to the Jacobian matrix at the benchmark point.

A Simple $PROD Block

$PROD Block with Nested Functions

$PROD Block -- Joint Outputs

Taxes on Inputs in a $PROD Block

Taxes on Outputs in a $PROD Block

Allocating Margins: .TL and #

Nesting Assignments with Exception Operators

Representing Technical Change


DEMAND Block Syntax
$DEMAND Block Syntax

A demand block provides an indicator of the commodity which a consumer demands and and a list of initial endowment.  The information provided in a $DEMAND block includes:

o	Q:       Reference quantity.

o	R:       Rationing instrument indicating an auxiliary variable.

Here is a typical demand function for a representative household in  region r who holds exogenous endowments of labor and sector-specific capital:

$DEMAND:RH(r)

    E:PL(r)      Q:le0(r)

    E:RK(r,s)    Q:ke0(r,s)

    D:PC(r)

If this representative consumer earns no tax revenue, the following value will be assigned to the consumer income variable:

RH(r) = PL(r) * le0(r) + sum(s, RK(r,s)*ke0(r,s));

Here is an example of a demand block for a consumer which holds exogenous endowment of labor and an endogenous endowment of foreign exchange, based on the value of the auxiliary variable BOPDEF

$DEMAND:HH(h)

    E:PL        Q:labor(h)

    E:PFX       Q:bopdef0(h)    R:BOPDEF(h)

    D:PCON

In this example, assuming no tax revenue accrues to tHH(h), the value assigned to the consumer income variable is:

HH(h) = PL * labor(h) + PFX * BOPDEF(h) * bopdef0(h);


A Simple $PROD Block

Here is a typical production function, one in which factors of production from each region r are combined in a Cobb-Douglas function to produce output:

$PROD:Y(r)  s:1

    O:P(r)      Q:y0(r)

    I:W(f,r)    Q:x0(f,r)   P:w0(f,r)

The price variables which appear in this function are P andW (both declared as $COMMODITIES:).  The activity variable in the function is Y, a variable which must have been declared in $SECTORS:.  Both f and rwhich appear in this function are sets, and y0, x0and w0 must have been declared previously in the program as parameters.

This $PROD block characterizes a Cobb-Douglas production function in which the elasticity of substitution between inputs is one, as indicated by "s:1" in the first line.  The s:field in a $PROD block relates the top level substitution.

The O: label indicates an output, and the I: label indicates an input.  The Q: fields in both records represent "reference quantities".  The P: field in the input record refers to the reference price of the input.


PROD Block with Nested Functions
$PROD Block with Nested Functions

The following production function describes a nested CES production function, one in which good X is produced using labor, capital and intermediate inputs:

$PROD:X  s:esub  id:0  va:(esub/5)

    O:PX        Q:x0

    I:PY(g)     Q:yx0(g)  id:

    I:PL        Q:lx0     P:pl0  va:

    I:PK        Q:kx0     P:pk0  va:

The first record in the $PROD block contains the nest identifier for top level inputs (a reserved name), s:.  The record introduces two new nest identifiers, id: and va:.  These nest identifiers are arbitrary names with up to four characters.  The nest identifier for top level outputs ist:.  Both t: and s: are reserved names.

In the $PROD block shown here, commodities PY(g)enter jointly in fixed proportions in nest id:, while labor (PL) and capital (PK) enter as part of the value-added nest (va:).

This production function can be portrayed graphically using a nesting diagram:

Provided that esub is not equal to 1 or 5, the function form described by this $PROD block could be written in conventional algebraic format as:

In this function rho = 1-1/esub and gamma=1-5/esub. The share parameters, in the function, alpha andbeta could be defined on the basis of data in the$PROD block, but their values are messy and difficult to derive.  Given the values of those share parameters, however, the value of phi can be calibrated using base year output.

The values of share parameters are chosen such that a solution to the following problem is consistent with the benchmark point.  That is, if we solve:

minimize  PL * L + PK * K + SUM(g, PY(g) * y(g))

subject to  f(y,K,L) = x0

the optimal value is L=lx0, K=kx0, y(g)=yx0(g).  The key idea here is that when the functional form is calibrated to a reference price-quantity point, then if we evaluate the cost-minimization problem at the same price point we get back the benchmark quantity point.


PROD Block -- Joint Outputs
$PROD Block -- Joint Outputs

The following production function describes a production function which produces goods D and E as joint products:

$PROD:E  t:eta

    O:PD        Q:d0        P:pd0

    O:PE        Q:e0        P:pe0

    I:PY        Q:y0

The first record in this $PROD block specifies a value fort:, the top-level elasticity of transformation.  Commodities with prices PD and PE are produced using inputs of the commodity with price PY.


Taxes on Inputs in a $PROD Block

An input record in a production block may contain the following fields related to ad valorem taxes:

o	A: Tax revenue agent.  This field must reference a consumer name.

o	T: Tax rate field identifier.  (More than one tax may apply to a single entry.)

o	N: Endogenous tax.  This label must be followed by the name of an auxiliary variable.

o	M: Exogenous tax multiplier.  The ad valorem tax rate is the product of the value of the endogenous tax (as in theN: field) and this multiplier.

Rules relating to the application of taxes on inputs are as follows:

A tax revenue agent must be specified prior to a T: or N: field.  One important extremely valuable service provided by MPSGE is that taxes may not be applied without consistent accounting of associated tax revenue in consumer incomes.  A tax therefore cannot be introduced without have specifying a consumer which receives the revenue.

If revenue from a particular tax is to be paid to more than one consumer, then two (or more) tax fields may be introduced on a single input with revenue accruing to different consumers.  In the following example two taxes are applied on the input of PL, one of which accrues to consumer FED (the federal government) and another which accrues to consumer STATE (the state government):

I:PL   Q:l0   A:FED  T:tlfica  A:STATE  T:tlinc

The tax rate on an input is evaluated on a net basis.  The user cost of an input is the market (net) price marked up by all applicable taxes.  In the previous example the user cost of labor is given by:

PLUSER = PL * (1 + tlfica + tlinc)

The net tax must be greater than -1, i.e. the user cost of any input must be positive.

Endogenous taxes are described by a pair of fields, labelledN: and M:.  The N: field identifies the auxiliary variable which is proportional to the tax rate, and the M: field indicates the proportionality factor.  Consider the input record:

I:PL Q:l0 A:FED N:TFED M:tlfica  A:STATE  N:TSTATE M:tlinc

In this case the user cost of labor is given by:

PLUSER = PL * (1 + TFED*tlfica + TSTATE*tlinc)


Taxes on Outputs in a $PROD Block

An output record in a production block may contain fields relating to proportional taxes:

o	A: Tax revenue agent.  Must be followed by a consumer name.

o	T: Tax rate field identifier.  (More than one tax may apply to a single entry.)

o	N: Endogenous tax.  This label must be followed by the name of an auxiliary variable.

o	M: Exogenous tax multiplier.  The ad valorem tax rate is the product of the value of the endogenous tax (as in theN: field) and this multiplier.

Rules relating to the application of taxes on outputs are as follows:

A tax revenue agent must be specified prior to a T: orN: field.

If revenue from a particular tax is to be paid to more than one consumer, then two (or more) tax fields must be introduced.  In the following example two taxes are applied on the output of PX, one of which accrues to consumer FED (the federal government) and another which accrues to consumer STATE (the state government):

I:PX   Q:l0   A:FED  T:tvat  A:STATE  T:tsales

The tax rate on an output is evaluated on a gross basis.  The user price of an output is the market (gross) price marked down by all applicable taxes.  In the previous example the producer price ofX is given by:

PXUSER = PX (1 - tvat - tsales)

The gross tax must be less than 1, i.e. the producer price of any output must be positive.

Endgenous taxes are described by a pair of fields, labelledN: and M:.  The N: field identifies the auxiliary variable which is proportional to the tax rate, and theM: field indicates the proportionality factor.  Consider the output record:

I:PX   Q:l0   A:FED  N:TFED  M:tvat  A:STATE  N:TSTATE M:tsales

In this case the user cost of labor is given by:

PXUSER = PX * (1 - TFED * tvat - TSTATE * tsales)


Allocating Margins: .TL and #

A special syntax is used in MPSGE to allocating margins on commodity inputs within a production block.  Consider the following production block in which i refers to the set(i1,i2,i3):

$PROD:C  s:1 i.tl:0

    O:PC        Q:ct0

    I:P(i)      Q:c0(i)   i.tl:

    I:PM#(i)    Q:m0(i)   i.tl:

There are two new syntax elements employed here.  The first is the use of a set to define nests in a production function.  This is indicated by the term i.tl:0 which appears on the first line of the block.  This is interpreted to mean "create a nest for each element of set i''.  The .TL suffix indicates that the sets are to be named according to the labels in set i.   (1)

The assignment of inputs to sets is achieved through the fieldsi.tl: which appear in the input records for P(i) andPM.  These fields are meant to be interpreted as: "assign these inputs to the nest which shares the same label i.tl''.

Finally, "#'' is used to produce multiple inputs of a particular commodity.  In this case, I:PM(i) is interpreted to mean: create one input of commodity PM for each element of seti.  The "spanning set'' in this case is i, and this set can be reference in any of the subsequent fields.

The production block shown here generates a technology which can be portrayed in the following nesting diagram:


Nesting Assignments with Exception Operators

MPSGE accomodates the specification of arbitrary multilevel CES production functions.  The use of the exception operator ("$'') and subsets makes it quite easy to generate specific assignments of goods to nests.  Here is an example of how such an assignment can be done.

o	  In GAMS it is convenient to use sets to define the characteristics of different categories of goods.  In the present model, we only distinguish between goods used in transportation (oil and vehicles) and all other goods.   (2)

SET  i  Goods /  foo    Food,

                 hou    Housing,

                 veh    Vehicle use,

                 oil    Vehicle fuel /,

     trn(i)  Commodities used jointly for transport /veh,oil/;

(In GEMPACK, the set of commodities can be partition using coefficient arrays rather than subsets.)

o	 Once the sets have been defined, they may be used as exception operators on inputs to a production activity, as is illustrated here:

$PROD:C  s:0.5  cons:1  trns:0

    O:PY        Q:ct0

    I:P(i)      Q:c0(i)   trns:$trn(i)  con:$(not trn(i))

o	This production block generates the following nested CES technology:


Representing Technical Change

Suppose that good X is produced using inputs of Kand L.  Write the production function in calibrated share form:

X = X0 * (theta*(L/L0)**rho + (1-theta)*(K/K0)**rho)**(1/rho)

At reference prices PL0, PK0, the demands for labor and capital are L0 and K0, and the level of output is X0.

We use this point to define the value share, i.e.

theta = PL0*L0/(PL0*L0+PK0*K0)

Now, suppose we have a technical change parameter which is labor augmenting, so:

X=X0*(theta*(L*gamma/L0)**rho+(1-theta)*(K/K0)**rho)**(1/rho)

where gamma>1.

We can alter the function by setting L0'=L0/gamma, but we need to holdtheta fixed, we let PL0'=gamma*PL0.

In the MPSGE program, technical change then is represented as:

$PROD:X s:esub

    O:PX Q:X0

    I:PL Q:(L0/gamma) P:(PL0*gamma)

    I:PK Q:K0 P:PK0

The intuitive explanation for introducing gamma in the reference price is that this incorporates the "rebound effect" which is commonly part of technical change.


The four character restriction on nest labels means that no element in seti can have a length of greater than four characters.


In more complicated applications it may be useful to define many more subsets.  For example, in energy demand models it may be helpful to define subsets which summarize fossil fuels, liquid fuels and energy carriers, as all of these concepts may be relevant to the description of energy substitution options in different sectors of the economy.