## General Equilibrium Modeling with MPSGE: Some Examples for Self-Study

### 1995

This file contains a number of simple models in which we introduce basic concepts related to general equilibrium modeling with MPSGE. These examples are intended for self-study by students and practioners who are interested in using MPSGE to formulate and solve applied general equilibrium models. All of the models presented in this file may be retrieved in a self-extracting archive file, markusen.exe.

 Model Description m1-1s Closed 2x2 Economy -- A Quick Introduction to the Basics m1-1v Closed 2x2 Economy -- Introduces Vector Syntax m1-2s Closed 2X2 Economy with Intermediate Inputs and Nesting m1-3s Closed 2x2 Economy with Joint Production m1-4s Closed 2x2 Economy with labor-leisure choice m1-4as Closed 2x2 Economy with labor-leisure (alt. formulation) m1-5s Closed 2x2 Economy with Specific Factors m1-6s Closed 2x2 Economy with Two Consumers m1-7s Closed 2x2 Economy with an Unprofitable Activity m1-8s Closed 2x2 Economy -- Stone Geary (LES) Preferences m4-1s Small open economy model. Two goods, two factors. m4-2s Small open economy model with a benchmark trade imbalance. m4-3s Small open economy model with a benchmark tariff. m4-4s Small open economy model with a benchmark tariff. m4-5s Small open economy model with an Armington formulation. m4-6s Large open economy model: elastic export demand m4-7s Small open economy model with benchmark VER import quota.

```
\$ontext

November, 1995 (revised)

The Social Accounting Matrix

The starting point for many models is a balanced input social
accounting matrix (SAM).  Traditionally, SAMs are presented as square
matrices in which row i and column i refer to a single account.  In
the traditional SAM, rows correspond to receipts and columns are
expenditures.  A 9x9 SAM describes the benchmark equilibrium for the
first model we consider:

PX      PY      PW      PL      PK      X       Y       W       CONS
PX                                                              100
PY                                                              100
PW                                                                      200
PL                                              40      60
PK                                              60      40
X       100
Y               100
W                       200
CONS                            100     100

Reading rows as receipts, we see from the first row of the SAM that
100 is spent on good X in sector W.  Likewise, reading across row 4
we see that 40 units of labor enter sector X and 60 units enter
sector Y.  SAMS can be quite detailed in their representation of an
economy, and they are also quite flexible.  All sorts of
inter-account taxes, subsidies and transfers can be represented
through an appropriate definition of the accounts.  (For an
introduction, see Pyatt and Round, "Social Accounting Matrices: A
Basis for Planning", The World Bank, 1985.)

For simple MPSGE models, it is convenient to use a rectangular SAM
format.  This format emphasizes how the MPSGE program structure is
connected to the benchmark data.  In the rectangular SAM, we have one
row for every market (traded commodity).  In the present model, there
are five markets, for goods X, Y and W and factors L and K.

There are two types of columns in the rectangular SAM, corresponding
to production sectors and consumers.  In the present model, there are
three production sectors (X, Y and W) and a single consumer (CONS).

The numbers which appear in a conventional SAM are typically
positive, apart from very special circumstances.  In the MPSGE SAM,
there are both positive and negative entries.  A positive entry
signifies a receipt (sale) in a particular market.  A negative entry
signifies an expenditure (purchase) in a particular market.  Reading
down a production column, we then observe a complete list of the
transactions associated with that activity.

The following rectangular SAM conveys the same information as the

Production Sectors          Consumers
Markets   |    X       Y        W    |       CONS
------------------------------------------------------
PX   |  100             -100    |
PY   |          100     -100    |
PW   |                   200    |       -200
PL   |  -40     -60             |        100
PK   |  -60     -40             |        100
------------------------------------------------------

A square SAM is "balanced" when the vector of row sums equals the
vector of column sums.  A rectangular SAM is "balanced" when row and
column sums are zeros.

Positive numbers represent the value of commodity flows into the
economy (sales or factor supplies), while negative numbers represent
the value of commodity flows out of the economy (factor demands or
final demands).  With this interpretation, a row sum is zero if the
total amount of commodity flowing into the economy equals the total
amount of commodity flowing out of the economy.  This is market
clearance, and one such condition applies for each commodity in the
model.

Columns in this matrix correspond to production sectors or consumers.
A production sector column sum is zero if the value of outputs equals
the cost of inputs.  A consumer column is balanced if the sum of
primary factor sales equals the value of final demands.

In this simple model there are really only two produced commodities
(X and Y), two factors of production (L and K) and one consumer
(CONS).  An extra column (W) and extra row (PW) have been introduced
to represente aggregate consumption index and the corresponding
price index.

\$OFFTEXT

*       Next, we specify a general equilibrium model based on
*       this data using MPSGE syntax.

*       First, declare GAMS parameters which we will use in model
*       specification.

SCALAR  TX      Ad-valorem tax rate for X sector inputs /0/,
LENDOW  Labor endowment multiplier              /1/;

\$ONTEXT

*       An MPSGE model is specified within an \$ONTEXT / \$OFFTEXT
*       block, and the first keyword must define the model name.
*       The model name must conform to the usual rules for GAMS
*       MODEL names (e.g., maximum 10 characters):

\$MODEL:M1_1S

*       The declaration of variables for an MPSGE model immediately
*       follows the \$MODEL statement.  There are three classes of
*       variables, \$SECTORS, \$COMMODITIES and \$CONSUMERS.  A
*       variable definition may include a description in the trailing
*       comment (following a "!" -- Not that this is unlike the
*       ordinary GAMS syntax for variable and equation definitions,
*       in which any trailing text, up to a comma, is interpreted as
*       a description.).

\$SECTORS:
X       ! Activity level for sector X
Y       ! Activity level for sector Y
W       ! Activity level for sector W (Hicksian welfare index)

\$COMMODITIES:
PX      ! Price index for commodity X
PY      ! Price index for commodity Y
PL      ! Price index for primary factor L
PK      ! Price index for primary factor K
PW      ! Price index for welfare (expenditure function)

\$CONSUMERS:
CONS    ! Income level for consumer CONS

*       Cobb-Douglas technology is characterized by unitary elasticity
*       of substitution at the top level (s:1).  Taxes are always
*       applied on a value-added basis.  Here, the user cost of labor
*       inputs is then PL*(1+TX) and the user cost of capital inputs
*       is PK*(1+TX).  The A: field indicates that tax revenue should
*       accrue to CONS.

\$PROD:X s:1
O:PX  Q:100
I:PL  Q:40 A:CONS T:TX
I:PK  Q:60 A:CONS T:TX

\$PROD:Y s:1
O:PY  Q:100
I:PL  Q:60
I:PK  Q:40

\$PROD:W s:1
O:PW   Q:200
I:PX   Q:100
I:PY   Q:100

*       Here we represent final excess demand.  This function
*       represents preferences (using reference demands), and
*       initial factor endowments:

\$DEMAND:CONS
D:PW   Q:200
E:PL   Q:(100*LENDOW)
E:PK   Q:100

\$OFFTEXT

*       Include a compiler directive instructing MPSGE to compile
*       the functions.  This statement must be issue, otherwise the
*       MPSGE functions are invisible to GAMS:

\$SYSINCLUDE mpsgeset M1_1S

*       An equilibrium in this model determines only relative prices --
*       there is no "money illusion" and the absolute price level is
*       irrelevant.  This must be considered when reporting induced
*       changes in relative prices.  It is convenient to select one
*       good as numeraire and fix its price as unity.  Labor is
*       a traditional choice as numeraire, so we use it:

PL.FX = 1;

*       N.B.  Fixing a price instructs MPSGE to omit the corresponding
*       equation -- In equilibrium, this equation will be satisfied
*       automatically through Walras' law.

*       It is not necessary to fix a numeraire, however if a numeraire
*       is not specified, the normalization of prices is arbitrary.
*       (When no price is exogenously fixed, the system uses one consumer
*       income as normalization, and this income level is determined by the
*       initial price vector).

*       Instruct GAMS to generate and evaluate the model.  The data
*       for this model is balanced, so this model should return
*       with "solved" status.  If it is not solved, the solution
*       listing can be used to identify the source of the inconsistency.

M1_1S.ITERLIM = 0;
\$INCLUDE M1_1S.GEN
SOLVE M1_1S USING MCP;
M1_1S.ITERLIM = 2000;

*       Solve a counterfactual: 50% tax on inputs to X production.

TX = 0.5;
LENDOW = 1;

\$INCLUDE M1_1S.GEN
SOLVE M1_1S USING MCP;

*       Solve a counterfactual: 100% increase in labor endowment (TX=0)

TX = 0;
LENDOW = 2;

\$INCLUDE M1_1S.GEN
SOLVE M1_1S USING MCP;

*       Finally, to remove some of the mystery from the model
*       description, we provide an algebraic presentation of the
*       same equations which have been generated automatically by
*       MPSGE.

*       We write these equations using precisely the same variables
*       which have already been delcared within the MPSGE model
*       (hence, they need not be declared a second time).

*       We need to give names to the equations, however, because the
*       MPSGE-generate equations are not named.

EQUATIONS
PRF_X   Zero profit for sector X
PRF_Y   Zero profit for sector Y
PRF_W   Zero profit for sector W (Hicksian welfare index)

MKT_X   Supply-demand balance for commodity X
MKT_Y   Supply-demand balance for commodity Y
MKT_L   Supply-demand balance for primary factor L
MKT_K   Supply-demand balance for primary factor L
MKT_W   Supply-demand balance for aggregate demand

I_CONS  Income definition for CONS;

*       Zero profit conditions are produced for all of the production
*       sectors.  These are interpreted as:

*               Cost of Production Gross of Tax  =  Value of Output

PRF_X..         100 * PL**0.4 * PK**0.6 * (1+TX) =E= 100 * PX;

PRF_Y..         100 * PL**0.6 * PK**0.4 =E= 100 * PY;

PRF_W..         200 * PX**0.5 * PY**0.5 =E= 200 * PW;

*       Market clearance conditions for each of the final goods and
*       primary factors.  These are interpreted as:

*               Output plus Initial Endowment  = Intermediate + Final Demand

MKT_X..         100 * X =E= 100 * W * PX**0.5 * PY**0.5 / PX;

MKT_Y..         100 * Y =E= 100 * W * PX**0.5 * PY**0.5 / PY;

MKT_W..         200 * W =E= CONS / PW;

MKT_L..         100 * LENDOW =E= 40 * X * PL**0.4 * PK**0.6 / PL +
60 * Y * PL**0.6 * PK**0.4 / PL;

MKT_K..         100 =E= 60 * X * PL**0.4 * PK**0.6 / PK +
40 * Y * PL**0.6 * PK**0.4 / PK;

*       Income balance states that the level of expenditure (CONS)
*       equals the value of factor income plus tax revenue:

I_CONS..        CONS =E= 100*LENDOW*PL + 100*PK + TX*100*X*PL**0.4*PK**0.6;

*       We declare this model using the mixed complementarity syntax
*       in which equation identifiers are associated with variables.

*       One advantage of this syntax is that if a variable value is
*       fixed within an MCP model, the associated equation is
*       automatically omitted from the model:

MODEL ALGEBRAIC /PRF_X.X, PRF_Y.Y, PRF_W.W, MKT_X.PX, MKT_Y.PY, MKT_L.PL,
MKT_K.PK, MKT_W.PW, I_CONS.CONS /;

*       Check the benchmark (again):

X.L=1; Y.L=1; W.L=1; PX.L=1; PY.L=1; PK.L=1; PW.L=1; CONS.L=200;

TX = 0;
LENDOW=1;
SOLVE ALGEBRAIC USING MCP;

*       Solve the same counterfactuals:

TX = 0.5;
LENDOW = 1;
SOLVE ALGEBRAIC USING MCP;

TX = 0;
LENDOW = 2;
SOLVE ALGEBRAIC USING MCP;

\$ontext

Exercises for M1_1S:

(1) Remove the PL.FX = 1.  This will cause MPSGE to select use the
default normalization of prices. (Note that if the PL is not fixed,
the algebraic model may not solve because the Jacobian is singular at
the solution.)

Rerun the counter-factual simulations using the MPSGE model and the
default price normalization.  Verify that relative price in the new
solution are identical to the original solution.

(2) Introduce a "typo" in a sector X input, e.g. O:PX Q:101, and then
examine the benchmark replication listing to see how this error is
manifested in the output.

(3) Consult a microeconomics text book to verify that the algebraic
model is properly specified.  A close familiarity with CES algebra is
useful but not essential.  One motivation for the development of
MPSGE is that the algebraic approach is difficult and error prone.

\$offtext
```

#### \$TITLE Model M1_1V: Closed 2x2 Economy -- Introduces Vector Syntax

```
\$ontext

November, 1995 (revised)

In this program, the scalar model, M1_1S, is interepreted as a
general model using GAMS sets and the MPSGE vector syntax.

\$offtext

TABLE BENCH(*,*)  Benchmark financial flows (e.g. an input-output table)

X       Y        W           CONS
X     100             -100
Y             100     -100
W                      200           -200
L     -40     -60                     100
K     -60     -40                     100;

*       Declare the underlying sets:

SET     I   Produced goods          /X, Y/,
F   Factors of production   /L, K/;

*     Use I and J to both index goods:

ALIAS (I,J), (F,FF);

PARAMETER       Y0(I)         Benchmark sectoral output,
FD0(F,I)      Benchmark factor demands,
C0(I)         Benchmark consumption demand,
E(F)          Factor endowments,
W0            Benchmark total consumption;

*       Extract data from the original format into model-specific arrays:

Y0(I)         = BENCH(I,I);
FD0(F,I)      = -BENCH(F,I);
C0(I)         = -BENCH(I,"W");
W0            = SUM(I, C0(I));
E(F)          = BENCH(F,"CONS");
T(I)          = 0;

DISPLAY Y0, FD0, C0, E, T;

*       MPSGE model declaration follows:

\$ONTEXT

\$MODEL:M1_1V

*     Here we define production activities over the set I:

\$SECTORS:
Y(I)            ! Commodity production index
W               ! Welfare index

\$COMMODITIES:
PW              ! Utility price index
PC(I)           ! Commodity price index
PF(F)           ! Factor price index

\$CONSUMERS:
CONS            ! Representative consumer

\$PROD:Y(I) s:1
O:PC(I)         Q:Y0(I)
I:PF(F)         Q:FD0(F,I)   A:CONS  T:T(I)

\$PROD:W  s:1
O:PW            Q:W0
I:PC(I)         Q:C0(I)

\$DEMAND:CONS
D:PW            Q:W0
E:PF(F)         Q:E(F)

\$OFFTEXT
\$SYSINCLUDE mpsgeset M1_1V

*       Check the calibration:

M1_1V.ITERLIM = 0;
\$INCLUDE M1_1V.GEN
SOLVE M1_1V USING MCP;
M1_1V.ITERLIM = 2000;

*       Use labor as the numeraire commodity:

PF.FX("L") = 1;

*       Declare a GAMS parameter to hold the solution values:

PARAMETER REPORT        Summary report;

*       Extract solution values into this parameter:

REPORT("WELFARE"," ","BENCH") = W.L;
REPORT("PRICE",I,"BENCH")     = PC.L(I);
REPORT("PRICE",F,"BENCH")     = PF.L(F);
REPORT("OUTPUT",I,"BENCH")    = Y.L(I);

*       Solve some counterfactuals: 50% tax on inputs to X production:

T("X") = 0.5;
\$INCLUDE M1_1V.GEN

SOLVE M1_1V USING MCP;

REPORT("WELFARE"," ","50%TAX") = W.L;
REPORT("PRICE",I,"50%TAX")     = PC.L(I);
REPORT("PRICE",F,"50%TAX")     = PF.L(F);
REPORT("OUTPUT",I,"50%TAX")    = Y.L(I);

*       100% increase in labor Ement, tax set back to zero:

E("L") = 2 * E("L");
T(I) = 0;

\$INCLUDE M1_1V.GEN
SOLVE M1_1V USING MCP;

REPORT("WELFARE"," ","100%L") = W.L;
REPORT("PRICE",I,"100%L")     = PC.L(I);
REPORT("PRICE",F,"100%L")     = PF.L(F);
REPORT("OUTPUT",I,"100%L")    = Y.L(I);

*       Place all the output at the bottom of the listing file:

DISPLAY REPORT;

*     Present the algebraic syntax for the sake of completeness:

PARAMETER   ALPHA(F,I)  Factor input benchmark value share
BETA(I)           Consumption value share;

ALPHA(F,I) = FD0(F,I) / SUM(FF, FD0(FF,I));
BETA(I) = C0(I) / W0;

EQUATIONS
PROFIT(I)   Zero profit condition
CMKT(I)           Commodity market clearance
FMKT(F)           Factor market clearance
PRF_W       Zero profit for aggregate consumption
MKT_W       Market clearance for aggregate consumption
I_CONS            Income = factor earnings plus taxes;

PROFIT(I)..    (1+T(I)) * PROD(F, PF(F)**ALPHA(F,I)) =E= PC(I);

PRF_W..         PROD(I, PC(I)**BETA(I)) =E= PW;

CMKT(I)..   Y0(I) * Y(I) =E= C0(I) * W * PROD(J, PC(J)**BETA(J)) / PC(I);

MKT_W..         W0 * W =E= CONS / PW;

FMKT(F)..   E(F) =E= SUM(I, FD0(F,I) * Y(I)
* PROD(FF, PF(FF)**ALPHA(FF,I))) / PF(F);

I_CONS..        CONS =E= SUM(F, PF(F) * E(F)) + SUM(I, T(I) * Y0(I) * Y(I) *
PROD(F, PF(F)**ALPHA(F,I)) );

MODEL ALGEBRAIC /PROFIT.Y, PRF_W.W, CMKT.PC, FMKT.PF, MKT_W.PW, I_CONS.CONS/;
SOLVE ALGEBRAIC USING MCP;
```

#### \$TITLE Model M1_2S: Closed 2X2 Economy with Intermediate Inputs and Nesting

```
\$ontext

November, 1995 (revised)

Production Sectors          Consumers
Markets  |    X       Y        W    |       CONS
------------------------------------------------------
PX   |  120     -20     -100    |
PY   |  -20     120     -100    |
PW   |                   200    |       -200
PL   |  -40     -60             |        100
PK   |  -60     -40             |        100
------------------------------------------------------

\$offtext

SCALAR  TX      Ad-valorem tax rate for X sector inputs /0/;

\$ONTEXT

\$MODEL: M1_2S

\$SECTORS:
X       ! Activity level for sector X
Y       ! Activity level for sector Y
W       ! Activity level for sector W (Hicksian welfare index)

\$COMMODITIES:
PX      ! Price index for commodity X
PY      ! Price index for commodity Y
PL      ! Price index for primary factor L
PK      ! Price index for primary factor K
PW      ! Price index for welfare (expenditure function)

\$CONSUMERS:
CONS    ! Income level for consumer CONS

*       MPSGE is based on the use of composite CES functions.

*       The following production function is a two-level CES.
*       In the VA, L and K form a Cobb-Douglas aggregate.
*       In the top level, Y and VA(L,K) have an elasticity of
*       substituion equal to 0.5

*       Syntax issues regarding aggregate labels:
*
*       (i)   Labels may have 1-4 characters.
*       (ii)  These names are not case sensitive ("va:" = "VA:").
*       (iii) Names s: and t: are reserved for top level input and
*               output (substitution and transformation) aggregates.

\$PROD:X s:0.5  va:1
O:PX  Q:120
I:PY  Q: 20
I:PL   Q:40  va: A:CONS  T:TX
I:PK   Q:60  va: A:CONS  T:TX

\$PROD:Y s:0.75  va:1
O:PY   Q:120
I:PX   Q: 20
I:PL   Q: 60  va:
I:PK   Q: 40  va:

\$PROD:W s:1
O:PW   Q:200
I:PX   Q:100
I:PY   Q:100

\$DEMAND:CONS
D:PW   Q:200
E:PL   Q:100
E:PK   Q:100

\$OFFTEXT
\$SYSINCLUDE mpsgeset M1_2S

*       Benchmark replication:

M1_2S.ITERLIM = 0;
\$INCLUDE M1_2S.GEN
SOLVE M1_2S USING MCP;
M1_2S.ITERLIM = 2000;

*       Fix the wage rate as numeraire:

PL.FX = 1;

*       Counterfactual:  100% tax on X sector inputs:

TX = 1.0;
\$INCLUDE M1_2S.GEN
SOLVE M1_2S USING MCP;

*       Algebraic representation -- note the complexity of two-
*       level CES functions which are automatically generated within
*       MPSGE.

EQUATIONS
PRF_X   Zero profit for sector X
PRF_Y   Zero profit for sector Y
PRF_W   Zero profit for sector W (Hicksian welfare index)

MKT_X   Supply-demand balance for commodity X
MKT_Y   Supply-demand balance for commodity Y
MKT_L   Supply-demand balance for primary factor L
MKT_K   Supply-demand balance for primary factor L
MKT_W   Supply-demand balance for aggregate demand

I_CONS  Income definition for CONS;

PRF_X.. 120 * ( 1/6 * PY**(1-0.5) +
5/6 * (PL**0.4 * PK**0.6 * (1+TX))**(1-0.5) )**(1/(1-0.5))
=E= 120 * PX;

PRF_Y.. 120 * ( 1/6 * PX**(1-0.75) +
5/6 * (PL**0.6 * PK**0.4)**(1-0.75) )**(1/(1-0.75))
=E= 120 * PY;

PRF_W.. 200 * PX**0.5 * PY**0.5 =E= 200 * PW;

MKT_X.. 120 * X =E= 100 * W * PX**0.5 * PY**0.5 / PX + 20*Y*(PY/PX)**0.75;

MKT_Y.. 120 * Y =E= 100 * W * PX**0.5 * PY**0.5 / PY + 20*X*(PX/PY)**0.5;

MKT_W.. 200 * W =E= CONS / PW;

MKT_L.. 100  =E= 40 * X * (PX/((1+TX)*PL**0.4*PK**0.6))**0.5
* PL**0.4 * PK**0.6 / PL +
60 * Y * (PY/(PL**0.6 * PK**0.4))**0.75
* PL**0.6 * PK**0.4 / PL;

MKT_K.. 100 =E=  60 * X * (PX/((1+TX)*PL**0.4*PK**0.6))**0.5
* PL**0.4 * PK**0.6 / PK +
40 * Y * (PY/(PL**0.6 * PK**0.4))**0.75
* PL**0.6 * PK**0.4 / PK;

I_CONS.. CONS =E= 100*PL + 100*PK +
TX * 100 * X * PL**0.4*PK**0.6 *
(PX/((1+TX)*PL**0.4*PK**0.6))**0.5;

MODEL ALGEBRAIC /PRF_X.X, PRF_Y.Y, PRF_W.W, MKT_X.PX, MKT_Y.PY, MKT_L.PL,
MKT_K.PK, MKT_W.PW, I_CONS.CONS /;

*       Check the benchmark:

X.L=1; Y.L=1; W.L=1; PX.L=1; PY.L=1; PK.L=1; PW.L=1; CONS.L=200;

TX = 0;
SOLVE ALGEBRAIC USING MCP;

*       Solve the same counterfactual:

TX = 1;
SOLVE ALGEBRAIC USING MCP;

\$ontext

Exercises for M1_2S:

1. Revise the X sector production to nest Y with K at the bottom
(Cobb-Douglas) level, and then let these inputs trade off with L
at the top (CES) nest.

\$PROD:X s:0.5  LY:1
O:PX  Q:120
I:PY  Q: 20  LY:
I:PL   Q:40  A:CONS  T:TX
I:PK   Q:60  LY: A:CONS  T:TX

Before running TX=1 experiment, guess as to whether this revised
nesting will increase or decrease the excess burden of taxation.  Run
the experiment, and see if the results confirm or contradict your
economit economic intuition.

2. Rewrite the algebraic model in accordance with the new nesting
structure, and verify that you obtain identical solution values.
(This exercise is tedious but educational, with a level of
difficulty roughly comparable to 500 piece jig-saw puzzle.

\$offtext
```

#### \$TITLE Model M1_3S: Closed 2x2 Economy with Joint Production

```
\$ontext

November, 1995 (revised)

Joint production is easily accomodated in the general equilibrium
framework.  Here we revise the data from model M1_1 so that goods
X and Y are each produced by sectors A and B.

Production Sectors          Consumers
Markets   |    A       B        W    |       CONS
------------------------------------------------------
PX   |   80      20     -100    |
PY   |   20      80     -100    |
PW   |                   200    |       -200
PL   |  -40     -60             |        100
PK   |  -60     -40             |        100
------------------------------------------------------

\$offtext

*       Declare GAMS parameters which we will use in model
*       specification:

SCALAR  TA      Ad-valorem tax rate for sector A inputs /0/;

\$ONTEXT

\$MODEL: M1_3S

\$SECTORS:
A       ! Activity level for sector A (80:20 for X:Y)
B       ! Activity level for sector B (20:80 for X:Y)
W       ! Activity level for sector W (Hicksian welfare index)

\$COMMODITIES:
PX      ! Price index for commodity X
PY      ! Price index for commodity Y
PL      ! Price index for primary factor L
PK      ! Price index for primary factor K
PW      ! Price index for welfare (expenditure function)

\$CONSUMERS:
CONS    ! Income level for consumer CONS

*       On the first line of the production declaration, the t:
*       field specifies the transformation elasticity between outputs.
*        can be zero but not infinity.  (If the transformation
*       elasticity is infinite, then two activities are warranted --
*       one for each output.)

\$PROD:A  t:2  s:1
O:PX    Q:80
O:PY    Q:20
I:PL    Q:40.0  A:CONS T:TA
I:PK    Q:60.0  A:CONS T:TA

\$PROD:B t:1.5 s:1
O:PX    Q:20
O:PY    Q:80
I:PL    Q:60
I:PK    Q:40

\$PROD:W s:1
O:PW    Q:200
I:PX    Q:100
I:PY    Q:100

\$DEMAND:CONS
D:PW    Q:200
E:PL    Q:100
E:PK    Q:100

\$OFFTEXT
\$SYSINCLUDE mpsgeset M1_3S

*       Fix a numeraire to avoid the work involved in scaling
*       the solution:

PL.FX = 1;

*       Benchmark replication:

M1_3S.ITERLIM = 0;
\$INCLUDE M1_3S.GEN
SOLVE M1_3S USING MCP;
M1_3S.ITERLIM = 2000;

*       Counterfactual: 10% tax on X sector inputs:

TA = 0.10;
\$INCLUDE M1_3S.GEN
SOLVE M1_3S USING MCP;

*       Counterfactual: 100% tax on X sector inputs:

TA = 1.00;
\$INCLUDE M1_3S.GEN
SOLVE M1_3S USING MCP;

EQUATIONS
PRF_A   Zero profit for sector X
PRF_B   Zero profit for sector Y
PRF_W   Zero profit for sector W (Hicksian welfare index)

MKT_X   Supply-demand balance for commodity X
MKT_Y   Supply-demand balance for commodity Y
MKT_L   Supply-demand balance for primary factor L
MKT_K   Supply-demand balance for primary factor L
MKT_W   Supply-demand balance for aggregate demand

I_CONS  Income definition for CONS;

*       Write the profit constraints as inequalities -- the tax
*       can cause sector A to shut down completely:

PRF_A.. 100 * PL**0.4 * PK**0.6 * (1+TA) =G=
100 * (0.8 * PX**(1+2.0) + 0.2 * PY**(1+2.0))**(1/(1+2.0));

PRF_B.. 100 * PL**0.6 * PK**0.4 =G=
100 * (0.2 * PX**(1+1.5) + 0.8 * PY**(1+1.5))**(1/(1+1.5));

PRF_W.. 200 * PX**0.5 * PY**0.5 =E= 200 * PW;

MKT_X.. 80 * A * (PX/(0.8*PX**(1+2.0)+0.2*PY**(1+2.0))**(1/(1+2.0)))**2
+  20 * B * (PX/(0.2*PX**(1+1.5)+0.8*PY**(1+1.5))**(1/(1+1.5)))**1.5
=E= 100 * W * PX**0.5 * PY**0.5 / PX;

MKT_Y.. 20 * A * (PY/(0.8*PX**(1+2.0)+0.2*PY**(1+2.0))**(1/(1+2.0)))**2.0
+  80 * B * (PY/(0.2*PX**(1+1.5)+0.8*PY**(1+1.5))**(1/(1+1.5)))**1.5
=E= 100 * W * PX**0.5 * PY**0.5 / PY;

MKT_W.. 200 * W =E= CONS / PW;

MKT_L.. 100  =E= 40 * A * PL**0.4 * PK**0.6 / PL +
60 * B * PL**0.6 * PK**0.4 / PL;

MKT_K.. 100 =E= 60 * A * PL**0.4 * PK**0.6 / PK +
40 * B * PL**0.6 * PK**0.4 / PK;

I_CONS.. CONS =E= 100*PL + 100*PK + TA*100*A*PL**0.4*PK**0.6;

MODEL ALGEBRAIC /PRF_A.A, PRF_B.B, PRF_W.W, MKT_X.PX, MKT_Y.PY, MKT_L.PL,
MKT_K.PK, MKT_W.PW, I_CONS.CONS /;

*       Check the benchmark:

A.L=1; B.L=1; W.L=1; PX.L=1; PY.L=1; PK.L=1; PW.L=1; CONS.L=200;

TA = 0;
ALGEBRAIC.ITERLIM = 0;
SOLVE ALGEBRAIC USING MCP;
ALGEBRAIC.ITERLIM = 2000;

*       Solve the same counterfactuals:

TA = 0.10;
SOLVE ALGEBRAIC USING MCP;

TA = 1.00;
SOLVE ALGEBRAIC USING MCP;

\$ontext

Exercise for M1_3S:

Revise the model structure to represent an infinite elasticity of
transformation in sector A.  You will need to rewrite the model with
two sectors A1 and A2.  These will have identical cost structure, one
producing good X and the other producing good Y.

\$offtext
```

#### \$TITLE Model M1_4S: Close 2x2 economy with labor-leisure choice

```
\$ontext

November, 1995 (revised)

In this model, the consuer is endowed with 200 units of time.  In
the benchmark equilibrium, 100 units of time are provided to the
market and 100 units are "purchased" by the consumer.  This formulation
provides an elastic labor supply.

Production Sectors          Consumers
Markets   |    X       Y        W    |       CONS
------------------------------------------------------
PX   |  100             -100    |
PY   |          100     -100    |
PW   |                   300    |       -300
PL   |  -40     -60     -100    |        200
PK   |  -60     -40             |        100
------------------------------------------------------

\$offtext

*       GAMS parameters which we will use in model specification:

SCALAR  TX      Ad-valorem tax rate for X sector inputs /0/,
ESUBL Elasticity of substitution for leisure vs consumption /0.5/;

\$ONTEXT

\$MODEL: M1_4S

\$SECTORS:
X       ! Activity level for sector X
Y       ! Activity level for sector Y
W       ! Activity level for sector W (Hicksian welfare index)

\$COMMODITIES:
PX      ! Price index for commodity X
PY      ! Price index for commodity Y
PL      ! Price index for primary factor L
PK      ! Price index for primary factor K
PW      ! Price index for welfare (expenditure function)

\$CONSUMERS:
CONS    ! Income level for consumer CONS

\$PROD:X s:1
O:PX  Q:100
I:PL   Q:40  A:CONS T:TX
I:PK   Q:60  A:CONS T:TX

\$PROD:Y s:1
O:PY  Q:100
I:PL  Q: 60
I:PK  Q: 40

\$PROD:W s:ESUBL  a:1
O:PW  Q:300
I:PX  Q:100  a:
I:PY  Q:100  a:
I:PL  Q:100

\$DEMAND:CONS
D:PW  Q:300
E:PL  Q:200
E:PK  Q:100
\$OFFTEXT
\$SYSINCLUDE mpsgeset M1_4S

*       Replicate the benchmark:

M1_4S.ITERLIM = 0;
\$INCLUDE M1_4S.GEN
SOLVE M1_4S USING MCP;
M1_4S.ITERLIM = 2000;

*       Solve a counterfactual: 100% tax on X:

TX = 1;
\$INCLUDE M1_4S.GEN
SOLVE M1_4S USING MCP;

\$ontext

Exercises for M1_4S:

(i) Derive an analytic expression for the elasticity of labor supply as a
function of ESUBL and the benchmark value shares.  Determine values of
ESUBL consistent with labor supply elasticities equal to -0.10, 0, 0.10
and 0.20.

(ii) Plot Exess burden versus the price elasticity of labor supply over
the range -0.10 to 0.20.

\$offtext

```

#### \$TITLE Model M1_4AS: Closed 2x2 economy with labor-leisure (alt. formulation)

```
\$ontext

November, 1995 (revised)

Activity T transforms leisure into labor supply:

Production Sectors               Consumers
Markets   |    A       B        W       T  |       CONS
---------------------------------------------------------
PX   |   80      20     -100          |
PY   |   20      80     -100          |
PW   |                   300          |       -300
PLS  |  -40     -60              100  |
PL   |                  -100    -100  |        200
PK   |  -60     -40                   |        100
---------------------------------------------------------

\$offtext

*       GAMS parameters which we will use in model specification:

SCALAR  TX      Ad-valorem tax rate for X sector inputs /0/;

\$ONTEXT
\$MODEL:M1_4AS

\$SECTORS:
X       ! Activity level for sector X
Y       ! Activity level for sector Y
T       ! Labor supply
W       ! Activity level for sector W (Hicksian welfare index)

\$COMMODITIES:
PX      ! Price index for commodity X
PY      ! Price index for commodity Y
PL      ! Price index for leisure
PLS     ! Price index for labor supply (factor L input)
PK      ! Price index for primary factor K
PW      ! Price index for welfare (expenditure function)

\$CONSUMERS:
CONS    ! Income level for consumer CONS

\$PROD:X s:1
O:PX  Q:100
I:PLS Q:40 A:CONS T:TX
I:PK  Q:60 A:CONS T:TX

\$PROD:Y s:1
O:PY  Q:100
I:PLS Q:60
I:PK  Q:40

\$PROD:T
O:PLS Q:100
I:PL  Q:100

\$PROD:W s:0.5  cons:1
O:PW   Q:300
I:PX   Q:100  cons:
I:PY   Q:100  cons:
I:PL   Q:100

\$DEMAND:CONS
D:PW   Q:300
E:PL   Q:200
E:PK   Q:100

\$OFFTEXT
\$SYSINCLUDE mpsgeset M1_4AS

*       Replicate the benchmark:

M1_4AS.ITERLIM = 0;
\$INCLUDE M1_4AS.GEN
SOLVE M1_4AS USING MCP;
M1_4AS.ITERLIM = 2000;

*       Solve a counter-factual:

TX=1;
\$INCLUDE M1_4AS.GEN
SOLVE M1_4AS USING MCP;
```

#### \$TITLE Model M1_5S: Closed 2x2 Economy with Specific Factors

```
\$ontext

November, 1995 (revised)

Sector-specific inputs can represent decreasing returns to scale.
Rents accrue to a ficticious factor called "capital".

Production Sectors          Consumers
Markets   |    X       Y        W    |       CONS
------------------------------------------------------
PX   |  100             -100    |
PY   |          100     -100    |
PW   |                   200    |       -200
PL   |  -50     -50             |        100
PKX  |  -50                     |         50
PKY  |          -50             |         50
------------------------------------------------------

\$offtext

*       Declare GAMS parameters which we will use in model:

SCALAR  TX      Ad-valorem tax rate for X sector inputs /0/;

\$ONTEXT

\$MODEL:M1_5S

\$SECTORS:
X       ! Activity level for sector X
Y       ! Activity level for sector Y
W       ! Activity level for sector W (Hicksian welfare index)

\$COMMODITIES:
PW      ! Price index for welfare (expenditure function)
PX      ! Price index for commodity X
PY      ! Price index for commodity Y
PL      ! Price index for primary factor L
PKX     ! Price index for sector-specific input for sector X
PKY     ! Price index for sector-specific input for sector Y

\$CONSUMERS:
CONS    ! Income level for consumer CONS

\$PROD:X s:1
O:PX   Q:100
I:PL   Q: 50  A:CONS T:TX
I:PKX  Q: 50  A:CONS T:TX

\$PROD:Y s:1
O:PY   Q:100
I:PL   Q: 50
I:PKY  Q: 50

\$PROD:W s:1
O:PW   Q:200
I:PX   Q:100
I:PY   Q:100

*       Note: If we wanted to think of the specific factor earnings
*       as the rents of firms with decreasing returns, we could
*       introduce separate agents with endowments equal to the
*       specific factors returns to the specific factors would then
*       be the "profits of the firms see exercise 1.6 for multiple
*       consumers.

\$DEMAND:CONS
D:PW  Q:200
E:PL  Q:100
E:PKX Q:50
E:PKY Q:50

\$OFFTEXT
\$SYSINCLUDE mpsgeset M1_5S

*       Benchmark replication:

M1_5S.ITERLIM = 0;
\$INCLUDE M1_5S.GEN
SOLVE M1_5S USING MCP;
M1_5S.ITERLIM = 2000;

*       Solve a counterfactual:

TX = 1;
\$INCLUDE M1_5S.GEN
SOLVE M1_5S USING MCP;

\$ontext

Exercises for M1_5S:

(1) Evaluate the price elasticity of supply for good X at the benchmark
point and then design an experiment to measure this elasticity numerically.

(2) Convert sector X from Cobb-Douglas to CES and set the elasticity of
substitution between PL and PKX so that the benchmark price elasticity of
supply equals an assumed value:

SCALAR      ES_X  Elasticity of supply for good X
ESUB  Elasticity of substitution for good X;

ESUB = ;

\$offtext
```

#### \$TITLE Model M1_6S: Closed 2x2 Economy with Two Consumers

```
\$ontext

November, 1995 (revised)

Two consumers in a closed economy.

Production Sectors               Consumers
Markets   |    X       Y      WA      WB  |     A      B
----------------------------------------------------------
PX   |  100             -25     -75  |
PY   |          100     -75     -25  |
PWA  |                  100          |  -100
PWB  |                          100  |          -100
PL   |  -40     -60                  |    90      10
PK   |  -60     -40                  |    10      90
----------------------------------------------------------

\$offtext

*       Declare GAMS parameters which we will use in model:

SCALAR  TX      Ad-valorem tax rate for X sector inputs /0/;

\$ONTEXT

\$MODEL:M1_6S

\$SECTORS:
X       ! Activity level for sector X
Y       ! Activity level for sector Y
WA      ! Welfare index for consumer A
WB      ! Welfare index for consumer B

\$COMMODITIES:
PX      ! Price index for commodity X
PY      ! Price index for commodity Y
PL      ! Price index for primary factor L
PK      ! Price index for primary factor K
PWA     ! Price index for consumer A welfare (expenditure function)
PWB     ! Price index for consumer B welfare (expenditure function)

\$CONSUMERS:
CONSA   ! Income level for consumer A
CONSB   ! Income level for consumer B

*       More than one tax may be levied on a single transaction with
*       revenues acruing to different agents.  As specified here, the
*       ad-valorem tax rate on inputs to sector X equals 2*TX.  Half
*       of the tax revenue acrues to A and half to B.

\$PROD:X s:1
O:PX    Q:100
I:PL    Q: 40 A:CONSA T:TX A:CONSB T:TX
I:PK    Q: 60 A:CONSA T:TX A:CONSB T:TX

\$PROD:Y s:1
O:PY    Q:100
I:PL    Q: 60
I:PK    Q: 40

\$PROD:WA s:1
O:PWA   Q:100
I:PX    Q:25
I:PY    Q:75

\$PROD:WB s:1
O:PWB   Q:100
I:PX    Q:75
I:PY    Q:25

\$DEMAND:CONSA
D:PWA   Q:100
E:PL    Q: 90
E:PK    Q: 10

\$DEMAND:CONSB
D:PWB   Q:100
E:PL    Q: 10
E:PK    Q: 90

\$OFFTEXT
\$SYSINCLUDE mpsgeset M1_6S

M1_6S.ITERLIM = 0;
\$INCLUDE M1_6S.GEN
SOLVE M1_6S USING MCP;
M1_6S.ITERLIM = 2000;

*       Solve a counterfactual:

TX = 0.5;
\$INCLUDE M1_6S.GEN
SOLVE M1_6S USING MCP;

\$ontext

Exercises for M1_6S:

(1) Interpret the solution --- is either agent in favor of the tax.
(Hint: look at the welfare indices, preferences and endowments.)

(2) Use the model to ascertain the utility possibility frontier for
this economy, with TX as the sole redistributive instrument.  Compare
this frontier with the Pareto-optimal frontier based on lump-sum
redistribution.  This assignment requires several calculations and use of
the GAMS LOOP statement.  The following code generates 4 equilbria:

SET     SC  Scenarios /SC1*SC4/;

PARAMETER       TXVALUE(SC)     Values of TX by scenario /
SC1 -0.5, SC2 -0.1, SC3 0.1, SC4 0.5 /,

WELFARE(SC,H)   Welfare indices by scenario;

LOOP(SC,

*       Install a tax rate for the current scenario:

TX = TXVALUE(SC);

\$INCLUDE M1_6S.GEN
SOLVE M1_6S USING MCP;

*       Extract the solution value:

WELFARE(SC,"A") = WA.L;
WELFARE(SC,"B") = WB.L;

);

DISPLAY WELFARE;

\$offtext
```

#### \$TITLE Model M1_7S: Closed 2x2 Economy with an Unprofitable Activity

```
\$ontext

November, 1995 (revised)

Production Sectors          Consumers
Markets   |    X       Y        W    |       CONS
------------------------------------------------------
PX   |  100             -100    |
PY   |          100     -100    |
PW   |                   200    |       -200
PL   |  -40     -60             |        100
PK   |  -60     -40             |        100
------------------------------------------------------

Activity Z is unprofitable at initial equilibrium prices.  It is
therefore not operated, and we cannot infer its technical properties
from the benchmark social accounting data.

In situations like this, we must use other information such as
engineering cost estimates to specify the unobserved technology.
Here, we will assume that Z is very similar to sector X but roughly
10% less efficient.  (Can you guess how this will affect the excess
burden of a tax on sector X?)

\$offtext

*       Declare GAMS parameters which we will use in model:

SCALAR  TX      Ad-valorem tax rate for X sector inputs /0/;

\$ONTEXT

\$MODEL:M1_7S

\$SECTORS:
X       ! Activity level for sector X
Y       ! Activity level for sector Y
W       ! Activity level for sector W (Hicksian welfare index)
Z       ! Alternative activity for producing X.

\$COMMODITIES:
PX      ! Price index for commodity X
PY      ! Price index for commodity Y
PL      ! Price index for primary factor L
PK      ! Price index for primary factor K
PW      ! Price index for welfare (expenditure function)

\$CONSUMERS:
CONS    ! Income level for consumer CONS

\$PROD:X s:1
O:PX   Q:100
I:PL   Q: 40  A:CONS T:TX
I:PK   Q: 60  A:CONS T:TX

\$PROD:Y s:1
O:PY  Q:100
I:PL   Q:60
I:PK   Q:40

*       Note that at the benchmark (when all prices equal unity), the
*       cost of Z inputs equals 1.1 and the value of outputs equals 1.0.
*       An economic equilibrium prevails provided that this sector is
*       idle:

\$PROD:Z s:1
O:PX    Q: 1.00
I:PL    Q: 0.44
I:PK    Q: 0.66

\$PROD:W s:1
O:PW    Q:200
I:PX    Q:100
I:PY    Q:100

\$DEMAND:CONS
D:PW    Q:200
E:PL    Q:100
E:PK    Q:100

\$OFFTEXT
\$SYSINCLUDE mpsgeset M1_7S

*       Check the benchmark calibration --- after setting the activity
*       level for Z equal to 0:

Z.L = 0;

M1_7S.ITERLIM = 0;
\$INCLUDE M1_7S.GEN
SOLVE M1_7S USINCP MCP;
M1_7S.ITERLIM = 2000;

*       Lets levy a high tax on sector X and see what happens:

TX = 1.00;
\$INCLUDE M1_7S.GEN
SOLVE M1_7S USINCP MCP;

\$ontext

Exercise for M1_7S:

(1) Plot the Laffer curve for TX in this model. Compare your
results with the curve from a model in which sector Z does
not exist.

An activity may be omitted from the model by fixing its value to 0,
that is by specifying:

Z.FX=0;

If you subsequently want to compute an equilibrium in which Z is not
fixed, you may enter:

Z.LO = 0;
Z.UP = +INF;

(2) Compare results with a third model in which sectoral capital
stocks are differentiated (replace PK by PKX and PKY). Do the same
comparison plotting welfare cost versus TX.

\$offtext
```

#### \$TITLE Model M1_8S: Closed 2x2 Economy -- Stone Geary (LES) Preferences

```
\$ontext

November, 1995 (revised)

This model poses a simple calibration problem.

The benchmark data is identical to problem M1_1:

Production Sectors          Consumers
Markets   |    X       Y        W    |       CONS
------------------------------------------------------
PX   |  100             -100    |
PY   |          100     -100    |
PW   |                   200    |       -200
PL   |  -40     -60             |        100
PK   |  -60     -40             |        100
------------------------------------------------------

We want to produce a benchmark in which the income elasticity of
demand for X equals 0.75.

Begin with a utility function of the form:

U(X,Y) = a ln(X - X*) + (1-a) ln(Y)

where X* is a "minimum consumption level"

Demand function for X is given by:

a (I - PX X*)
X = X*  +  -------------
PX

in which I is income and PX is the price of X.  The income share of
good X is then:

PX X      (a I + (1-a) PX X*)
----   =  --------------------  ,
I                I

and the income elasticity of demand is give by:

I    d X            a I
---   ---   =   -----------------  .
X    d I       a I + (1-a) PX X*

Knowing the share from the data and the chosen income elasticity, we
can solve for X*/I (with PX=1).  This level of X* is then specified
as a negative endowment for the consumer, and (X - X*) is the value
used in specifying the utility function.

\$offtext

*       First, declare GAMS parameters which we will use in model
*       specification.

SCALAR ENDOW  Economy factor endowment index /1/;

\$ONTEXT

\$MODEL:M1_8S

\$SECTORS:
X       ! Activity level for sector X
Y       ! Activity level for sector Y
W       ! Activity level for sector W (Hicksian welfare index)

\$COMMODITIES:
PX      ! Price index for commodity X
PY      ! Price index for commodity Y
PL      ! Price index for primary factor L
PK      ! Price index for primary factor K
PW      ! Price index for welfare (expenditure function)

\$CONSUMERS:
CONS    ! Income level for consumer CONS

\$PROD:X s:1
O:PX    Q:100
I:PL    Q: 40
I:PK    Q: 60

\$PROD:Y s:1
O:PY    Q:100
I:PL    Q: 60
I:PK    Q: 40

\$PROD:W s:1
O:PW    Q:160
I:PX    Q: 60
I:PY    Q:100

\$DEMAND:CONS
D:PW    Q:160
E:PL    Q:(100*ENDOW)
E:PK    Q:(100*ENDOW)
E:PX    Q:-40

\$OFFTEXT
\$SYSINCLUDE mpsgeset M1_8S

*       Benchmark replication:

M1_8S.ITERLIM = 0;
\$INCLUDE M1_8S.GEN
SOLVE M1_8S USING MCP;
M1_8S.ITERLIM = 2000;

*       Counterfactual: double the factor endowment.

ENDOW = 2;
\$INCLUDE M1_8S.GEN
SOLVE M1_8S USING MCP;

\$ontext

Exercises for M1_8S:

(1) Modify the program to read the income elasticity of demand for good X,
compute the subsistence demand and automatically calibrate the model.

(2) Generate a sequence of equilibria and measure the income elasticity of
demand for good X over the range of income from 1 to 10 times the
benchmark level.

(3) Replace the Cobb-Douglas utility function by a general CES utility
function with elasticity of substitution SIGMA.  Determine the subsistence
demand which is consistent with a given income elasticity of demand for X.
Generate plots of the income elasticity of demand for good X to compare
with results from question (2), taking SIGMA = 0.5 and SIGMA = 2.0.

\$offtext
```

#### \$TITLE Model M4_1S: Small open economy model. Two goods, two factors.

```
\$ontext

November, 1995 (revised)

This model illustrates the representation of international trade
flows in an open economy model.  In this model, the foreign country
is not explicitly modelled.  Trade possibilities are modelled by four
activities which transform domestic goods into "foreign Exhange" and
vice versa.

This model is based on the Heckscher-Ohlin assumption that domestic,
imported and exported goods are perfect substitutes.

Two possible trade activities, exports of good 2 and imports of good
1, are idle.  We presume that the export price for good 2 less than
one and the import price for good 1 is greater than one.

Production Sectors                      Consumer

Markets   |     X1      X2      E1      M2      W       CONS
------------------------------------------------------------------
P1        |     150             -50             -100
P2        |             50              50      -100
PL        |     -100    -20                             120
PK        |     -50     -30                             80
PW        |                                     200     -200
PFX       |                     50      -50
------------------------------------------------------------------

\$offtext

SCALAR          PE2     Export price of good 2 / 0.99/
PM1     Import price of good 1 / 1.01/
PE1     Export price of good 1 / 1   /
PM2     Import price of good 2 / 1   /
TM2     Import tariff for good 2 / 0/;

\$ONTEXT

\$MODEL:M4_1S

\$SECTORS:
X1      ! Production index for good 1
X2      ! Production index good 2
E1      ! Export level of good 1
E2      ! Export level of good 2
M1      ! Import level of good 1
M2      ! Import level of good 2
W       ! Welfare index

\$COMMODITIES:
P1      ! Price index for good 1
P2      ! Price index for good 1
PFX     ! Read exchange rate index
PW      ! Welfare price index
PL      ! Wage index
PK      ! Capital rental index

\$CONSUMERS:
CONS    ! Income level for representative agent

*       Cobb-Douglas production in both sectors:

\$PROD:X1  s:1
O:P1    Q:150
I:PL    Q:100
I:PK    Q:50

\$PROD:X2  s:1
O:P2    Q:50
I:PL    Q:20
I:PK    Q:30

*       We scale the export price for good 1 and the import price
*       for good 2 to both be unity:

\$PROD:E1
O:PFX   Q:PE1
I:P1    Q:1

\$PROD:M2
O:P2    Q:1
I:PFX   Q:PM2    A:CONS T:TM2

*       The following trade activities are not operated in the benchmark
*       period:

\$PROD:E2
O:PFX   Q:PE2
I:P2    Q:1

\$PROD:M1
O:P1    Q:1
I:PFX   Q:PM1

*       Cobb-Douglas preferences:

\$PROD:W   s:1
O:PW    Q:200
I:P1    Q:100
I:P2    Q:100

\$DEMAND:CONS
D:PW    Q:200
E:PL    Q:120
E:PK    Q:80

\$OFFTEXT
\$SYSINCLUDE mpsgeset M4_1S

*       We replicate the benchmark by assuming default values of
*       unity for production activities and prices, but we must
*       explicitly specify benchmark values for the trade activities
*       because they are not unity:

E2.L = 0;
M1.L = 0;
E1.L = 50;
M2.L = 50;

M4_1S.ITERLIM = 0;
\$INCLUDE M4_1S.GEN
SOLVE M4_1S USING MCP;
M4_1S.ITERLIM = 2000;

* Counterfactual experiments are to levy a 10% and then a 20% import
* tariff on C2.  10% tariff is prohibitive.

TM2 = 0.05;
\$INCLUDE M4_1S.GEN
SOLVE M4_1S USING MCP;

TM2 = 0.10;
\$INCLUDE M4_1S.GEN
SOLVE M4_1S USING MCP;

\$ontext

Exercises for M4_1S:

(i) Compare the welfare cost of tariffs in this model with the results
from a Ricardo-Viner-Jones (specific factors) model.  To do so, replace
the mobile capital stock by sector-specific capital stocks (drop PK

(ii) Multiply all of the international prices (PE1,PE2,PM1,PM2) by a
positive constant and verify that the benchmark equilibrium is undisturbed --
all that changes is that PFX changes proportionately.
\$offtext
```

#### \$TITLE Model M4_2S: Small open economy model with a benchmark trade imbalance.

```
\$ontext

November, 1995 (revised)

This model illustrates the representation of international trade
flows in an open economy model.  In this model, the current account
is in deficit in benchmark data, where the value of imports exceeds
the value of exports by 20.  This is typically observed in actual
datasets, where capital flows are reflected as differences
between the value of international trade in goods and services.

Here, we balance the model by endowing consumers with 20 units of
foreign exchange.  This endowment can be thought of as an asset owned
by consumers.  The trade deficit is financed by selling off this
asset.

As in the previous model, the export of good 2 and the import of
good 1 are both idle activities in the benchmark.

Production Sectors                      Consumer

Markets   |     X1      X2      E1      M2      W       CONS
------------------------------------------------------------------
P1        |     150             -40             -110
P2        |             50              60      -110
PL        |     -100    -20                             120
PK        |     -50     -30                             80
PW        |                                     220     -220
PFX       |                     40      -60             20
------------------------------------------------------------------
\$offtext

SCALAR          PE2     Export price of good 2 / 0.99/
PM1     Import price of good 1 / 1.01/
PE1     Export price of good 1 / 1   /
PM2     Import price of good 2 / 1   /
BOPDEF  Balance of payments net deficit;

\$ONTEXT

\$MODEL:M4_2S

\$SECTORS:
X1      ! Production index for good 1
X2      ! Production index good 2
E1      ! Export level of good 1
E2      ! Export level of good 2
M1      ! Import level of good 1
M2      ! Import level of good 2
W       ! Welfare index

\$COMMODITIES:
P1      ! Price index for good 1
P2      ! Price index for good 1
PFX     ! Read exchange rate index
PW      ! Welfare price index
PL      ! Wage index
PK      ! Capital rental index

\$CONSUMERS:
CONS    ! Income level for representative agent

*       Cobb-Douglas production in both sectors:

\$PROD:X1  s:1
O:P1    Q:150
I:PL    Q:100
I:PK    Q:50

\$PROD:X2  s:1
O:P2    Q:50
I:PL    Q:20
I:PK    Q:30

*       We scale the export price for good 1 and the import price
*       for good 2 to both be unity:

\$PROD:E1
O:PFX   Q:PE1
I:P1    Q:1

\$PROD:M2
O:P2    Q:1
I:PFX   Q:PM2

*       The following trade activities are not operated in the benchmark
*       period:

\$PROD:E2
O:PFX   Q:PE2
I:P2    Q:1

\$PROD:M1
O:P1    Q:1
I:PFX   Q:PM1

*       Cobb-Douglas preferences:

\$PROD:W   s:1
O:PW    Q:220
I:P1    Q:110
I:P2    Q:110

\$DEMAND:CONS
D:PW    Q:220
E:PL    Q:120
E:PK    Q:80
E:PFX   Q:BOPDEF

\$OFFTEXT
\$SYSINCLUDE mpsgeset M4_2S

*       We replicate the benchmark by assuming default values of
*       unity for production activities and prices, but we must
*       explicitly specify benchmark values for the trade activities
*       because they are not unity:

E2.L = 0;
M1.L = 0;
E1.L = 40;
M2.L = 60;
BOPDEF = 20;

M4_2S.ITERLIM = 0;
\$INCLUDE M4_2S.GEN
SOLVE M4_2S USING MCP;
M4_2S.ITERLIM = 2000;

*       Compute a counterfactual experiment in which capital flows are
*       set to zero and there is a conseqent balance between the value
*       of imports and exports:

BOPDEF = 0;
\$INCLUDE M4_2S.GEN
SOLVE M4_2S USING MCP;

\$ontext

Exercises for M4_2S:

(1) Compute the autarchy equilibrium welfare level.

(2) Determine the value of BOPDEF below which welfare falls below the
autarchy level.
\$offtext
```

#### \$TITLE Model M4_3S: Small open economy model with a benchmark tariff.

```
\$ontext

November, 1995 (revised)

In this example, units are chosen such that all DOMESTIC prices equal
one initially.  Implied world prices are then P1/P2 = 1.2

We add a row to account for tariff revenue.  It has an entry in the
M2 column (tariff payments are deducted from the profit), and in the
CONS column (tariff revenue is paid in lump-sum to the consumer):

Production Sectors                      Consumer

Markets   |     X1      X2      E1      M2      W       CONS
------------------------------------------------------------------
P1        |     150             -50             -100
P2        |             40              60      -100
PL        |     -100    -20                             120
PK        |     -50     -20                             70
PW        |                                     200     -200
PFX       |                     50      -50

Tariff Revenue:
T         |                             -10             10
------------------------------------------------------------------

\$offtext

SCALAR          PE2     Export price of good 2,
PM1     Import price of good 1,
PE1     Export price of good 1,
PM2     Import price of good 2,
TM2     Import tariff for good 2 / 0.2/;

PE1 = 1;
PM2 = 1 / (1.2);
PE2 = PM2 * 0.99;
PM1 = 1.01;

\$ONTEXT

\$MODEL:M4_3S

\$SECTORS:
X1      ! Production index for good 1
X2      ! Production index good 2
E1      ! Export level of good 1
E2      ! Export level of good 2
M1      ! Import level of good 1
M2      ! Import level of good 2
W       ! Welfare index

\$COMMODITIES:
P1      ! Price index for good 1
P2      ! Price index for good 1
PFX     ! Read exchange rate index
PW      ! Welfare price index
PL      ! Wage index
PK      ! Capital rental index

\$CONSUMERS:
CONS    ! Income level for representative agent

*       Cobb-Douglas production in both sectors:

\$PROD:X1  s:1
O:P1    Q:150
I:PL    Q:100
I:PK    Q:50

\$PROD:X2  s:1
O:P2    Q:40
I:PL    Q:20
I:PK    Q:20

*       We scale the export price for good 1 and the import price
*       for good 2 to both be unity:

\$PROD:E1
O:PFX   Q:PE1
I:P1    Q:1

\$PROD:M2
O:P2    Q:1
I:PFX   Q:PM2   A:CONS  T:TM2

*       The following trade activities are not operated in the benchmark
*       period:

\$PROD:E2
O:PFX   Q:PE2
I:P2    Q:1

\$PROD:M1
O:P1    Q:1
I:PFX   Q:PM1

*       Cobb-Douglas preferences:

\$PROD:W   s:1
O:PW    Q:200
I:P1    Q:100
I:P2    Q:100

\$DEMAND:CONS
D:PW    Q:200
E:PL    Q:120
E:PK    Q:70

\$OFFTEXT
\$SYSINCLUDE mpsgeset M4_3S

*       Benchmark replication

E1.L = 50;
M2.L = 60;
E2.L = 0;
M1.L = 0;

M4_3S.ITERLIM = 0;
\$INCLUDE M4_3S.GEN
SOLVE M4_3S USING MCP;
M4_3S.ITERLIM = 2000;

*       Counterfactual experiment is free trade
*       In free trade, the country specializes in the production of good 1.

TM2 = 0;
\$INCLUDE M4_3S.GEN
SOLVE M4_3S USING MCP;
```

#### \$TITLE Model M4_4S: Small open economy model with a benchmark tariff.

```
\$ontext

November, 1995 (revised)

This model is equivalent to M4_3S except that units are chosen such
that all WORLD prices equal one initially.  The benchmark domestic price
ratio is then P1/P2 = 1/1.2.

Note that this changes the units of measurement in good 2.  There are now
83.3333 units of good 2 consumed instead of 100, but this is simply a change
in units of measure and has no welfare consequences.

The benchmark social accounting matrix is unchanged:

Production Sectors                      Consumer

Markets   |     X1      X2      E1      M2      W       CONS
------------------------------------------------------------------
P1        |     150             -50             -100
P2        |             40              60      -100
PL        |     -100    -20                             120
PK        |     -50     -20                             70
PW        |                                     200     -200
PFX       |                     50      -50
T         |                             -10             10
------------------------------------------------------------------
\$offtext

SCALAR          PE2     Export price of good 2  /0.99/,
PM1     Import price of good 1  /1.01/,
PE1     Export price of good 1  /1/,
PM2     Import price of good 2  /1/,
TM2     Import tariff for good 2 / 0.2/;

\$ONTEXT

\$MODEL:M4_4S

\$SECTORS:
X1      ! Production index for good 1
X2      ! Production index good 2
E1      ! Export level of good 1
E2      ! Export level of good 2
M1      ! Import level of good 1
M2      ! Import level of good 2
W       ! Welfare index

\$COMMODITIES:
P1      ! Price index for good 1
P2      ! Price index for good 1
PFX     ! Read exchange rate index
PW      ! Welfare price index
PL      ! Wage index
PK      ! Capital rental index

\$CONSUMERS:
CONS    ! Income level for representative agent

*       Cobb-Douglas production in both sectors:

\$PROD:X1  s:1
O:P1    Q:150
I:PL    Q:100
I:PK    Q:50

\$PROD:X2  s:1
O:P2    Q:33.33333
I:PL    Q:20
I:PK    Q:20

*       We scale the export price for good 1 and the import price
*       for good 2 to both be unity:

\$PROD:E1
O:PFX   Q:PE1
I:P1    Q:1

\$PROD:M2
O:P2    Q:1
I:PFX   Q:PM2   A:CONS  T:TM2

*       The following trade activities are not operated in the benchmark
*       period:

\$PROD:E2
O:PFX   Q:PE2
I:P2    Q:1

\$PROD:M1
O:P1    Q:1
I:PFX   Q:PM1

*       Cobb-Douglas preferences calibrated to a reference point
*       in which the price ratio is not unity:

\$PROD:W   s:1
O:PW    Q:200
I:P1    Q:100
I:P2    Q:83.33333  P:1.2

\$DEMAND:CONS
D:PW    Q:200
E:PL    Q:120
E:PK    Q:70

\$OFFTEXT
\$SYSINCLUDE mpsgeset M4_4S

*       Benchmark replication

E1.L = 50;
M2.L = 50;
E2.L = 0;
M1.L = 0;

*       Need to explicitly specify the benchmark price for good 2
*       which is not unity:

P2.L = 1.2;

M4_4S.ITERLIM = 0;
\$INCLUDE M4_4S.GEN
SOLVE M4_4S USING MCP;
M4_4S.ITERLIM = 2000;

*       Counterfactual experiment is free trade
*       In free trade, the country specializes in the production of good 1.

TM2 = 0;
\$INCLUDE M4_4S.GEN
SOLVE M4_4S USING MCP;
```

#### \$TITLE Model M4_5S: Small open economy model with an Armington formulation.

```
\$ontext

November, 1995 (revised)

There are two production sectors, 1 and 2.  Produced goods may
be either sold domestically or exported.  Imported and foreign
varieties are imperfect substitutes in final demand.

This benchmark equilibrium reduces to the data for model M1_1S
if we net out trade.  Here, we have imports and exports of both
goods.  Good 1 is a net export, and good 2 is a net import.

Production Sectors                      Consumer
Markets   |     X1      X2      E       M        W       CONS
------------------------------------------------------------------
P1        |     150             -100    50      -100
P2        |             50      -25     75      -100
PL        |     -100    -20                              120
PK        |     -50     -30                               80
PW        |                                      200    -200
PFX       |                     125     -125
------------------------------------------------------------------
\$offtext

SCALAR          PE1     Export price of good 1   / 1 /,
PE2     Export price of good 2   / 1 /,
PM1     Import price of good 1   / 1 /,
PM2     Import price of good 2   / 1 /,
TM2     Import tariff for good 2 / 0 /,
ESUBDM  Armington elasticity of substitution / 4 /;

\$ONTEXT

\$MODEL:M4_5S

\$SECTORS:
X1      ! Production index for good 1
X2      ! Production index good 2
E1      ! Export index for good 1
E2      ! Export index for good 2
M1      ! Import index for good 1
M2      ! Import index for good 2
W       ! Welfare index

\$COMMODITIES:
P1      ! Price index for good 1
P2      ! Price index for good 1
PM_1    ! Price index for imported good 1
PM_2    ! Price index for imported good 2
PFX     ! Read exchange rate index
PW      ! Welfare price index
PL      ! Wage index
PK      ! Capital rental index

\$CONSUMERS:
CONS    ! Income level for representative agent

*       Cobb-Douglas production in both sectors:

\$PROD:X1  s:1
O:P1    Q:150
I:PL    Q:100
I:PK    Q:50

\$PROD:X2  s:1
O:P2    Q:50
I:PL    Q:20
I:PK    Q:30

*       We scale the export price for good 1 and the import price
*       for good 2 to both be unity:

\$PROD:E1
O:PFX   Q:(PE1*100)
I:P1    Q:100

\$PROD:E2
O:PFX   Q:(PE2*25)
I:P2    Q:25

\$PROD:M1
O:PM_1  Q:50
I:PFX   Q:(PM1*50)

\$PROD:M2
O:PM_2   Q:75
I:PFX   Q:(PM2*75)      A:CONS T:TM2

*       Cobb-Douglas preferences:

\$PROD:W   s:1           G1:ESUBDM       G2:ESUBDM
O:PW    Q:200
I:P1    Q:50    G1:
I:PM_1  Q:50    G1:
I:P2    Q:25    G2:
I:PM_2   Q:75   G2:

\$DEMAND:CONS
D:PW    Q:200
E:PL    Q:120
E:PK    Q:80

\$OFFTEXT
\$SYSINCLUDE mpsgeset M4_5S

*       We replicate the benchmark by assuming default values of
*       unity for production activities and prices.  Unlike model
*       M4_1, here we represent trade through indices equaling unity
*       in the base year; so all activity levels equal the default value.

M4_5S.ITERLIM = 0;
\$INCLUDE M4_5S.GEN
SOLVE M4_5S USING MCP;
M4_5S.ITERLIM = 2000;

* Counterfactual experiments are to levy a 10% and then a 20% import
* tariff on C2.  10% tariff is prohibitive.

TM2 = 0.05;
\$INCLUDE M4_5S.GEN
SOLVE M4_5S USING MCP;

TM2 = 0.10;
\$INCLUDE M4_5S.GEN
SOLVE M4_5S USING MCP;

\$ontext

Exercises for M4_5S:

(i) Compare the welfare cost of tariffs in this model with the results
from the Heckscher-Ohlin model.  Do this comparison for increasing values
of the Armington elasticity, ESUBDM = 4, 8, 12.  (Numerical problems will
arise when this value is too large.)

(ii) Construct an alternative model in which activities M1 and M2 and
commodities PM_1 and PM_2 are omitted.  Use the following specification for
final demand:

\$PROD:W   s:1           G1:ESUBDM       G2:ESUBDM
O:PW    Q:200
I:P1    Q:50                            G1:
I:PFX   Q:(PM1*50)      P:(1/PM1)       G1:
I:P2    Q:25                            G2:
I:PFX   Q:(PM2*75)      P:(1/PM2)       G2:     A:CONS T:TM2

Verify numerically that this model is equivalent to the original
formulation.
\$offtext
```

#### \$TITLE Model M4_6S: Large open economy model: elastic export demand

```
\$ontext

November, 1995 (revised)

This model illustrates the representation of international trade
flows in an open economy model.  In this model, the demand for exports
is determined endogenously with diminishing marginal foreign earnings
as a function of the level of exports.

The foreign elasticity of demand for exports can be calibrate between
minus one and minus infinity in this formulation by the initial
choice of value shares for commodity PR in the export activity for
good 1.

Production Sectors                      Consumer

Markets   |     X1      X2      E1      M2      W       CONSH   CONSF
----------------------------------------------------------------------
P1        |     150             -50             -100
P2        |             50              50      -100
PL        |     -100    -20                             120
PK        |     -50     -30                             80
PW        |                                     200     -200
PFX       |                     100     -50                     -50
PR        |                     -50                             50
------------------------------------------------------------------

\$offtext

SCALAR  TM2     Import tariff for good 2 /0/;

\$ONTEXT

\$MODEL:M4_6S

\$SECTORS:
X1      ! Production index for good 1
X2      ! Production index good 2
E1      ! Export index of good 1
E2      ! Export index of good 2
M1      ! Import level of good 1
M2      ! Import level of good 2
W       ! Welfare index

\$COMMODITIES:
P1      ! Price index for good 1
P2      ! Price index for good 1
PFX     ! Read exchange rate index
PW      ! Welfare price index
PL      ! Wage index
PK      ! Capital rental index
PR      ! Rent which generates the export demand function

\$CONSUMERS:
CONSH   ! Income level for representative home agent
CONSF   ! Income level for representative foreign agent

*       Cobb-Douglas production in both sectors:

\$PROD:X1  s:1
O:P1    Q:150
I:PL    Q:100
I:PK    Q:50

\$PROD:X2  s:1
O:P2    Q:50
I:PL    Q:20
I:PK    Q:30

\$PROD:E1  s:1
O:PFX   Q:100
I:P1    Q:50
I:PR    Q:50

\$PROD:M2
O:P2    Q:50
I:PFX   Q:50    A:CONSH T:TM2

*       The following trade activities are not operated in the benchmark
*       period and we calibrate them so that they are strictly non-profitable:

\$PROD:E2
O:PFX   Q:0.90
I:P2    Q:1

\$PROD:M1
O:P1    Q:1
I:PFX   Q:1.10

*       Cobb-Douglas preferences:

\$PROD:W   s:1
O:PW    Q:200
I:P1    Q:100
I:P2    Q:100

\$DEMAND:CONSH
D:PW    Q:200
E:PL    Q:120
E:PK    Q:80

\$DEMAND:CONSF
D:PFX   Q:50
E:PR    Q:50

\$OFFTEXT
\$SYSINCLUDE mpsgeset M4_6S

E2.L = 0;
M1.L = 0;

M4_6S.ITERLIM = 0;
\$INCLUDE M4_6S.GEN
SOLVE M4_6S USING MCP;
M4_6S.ITERLIM = 2000;

*       Apply a tariff which improves the terms of trade and home
*       welfare:

TM2 = 0.05;
\$INCLUDE M4_6S.GEN
SOLVE M4_6S USING MCP;

\$ontext

Exercises for M4_6S:

(i) Compute the relationship between welfare and tariff rate for different
benchmark export demand functions, where the value share of PR in E1 takes
on values 50, 100 and 200.

(ii) Replace the tariff on good 2 imports with a tax on good 1 exports,
and show that you can obtain identical equilibrium values (i.e., demonstrate
Lerner symmetry).

\$offtext
```

#### \$TITLE Model M4_7S: Small open economy model with benchmark VER import quota.

```
\$ontext

November, 1995 (revised)

In this example, units are chosen such that all DOMESTIC prices equal
one initially.  Implied world prices are then P1/P2 = 1.2

This model is identical to model M4_3 except that in this benchmark
the quota rents are paid to the foreign agent.  In order to balance
to the same values, we include a benchmark balance of payments deficit
endowment for the home consumer.

We add a row to account for quota revenue.  It has an entry in the
M2 column (quota rents are deducted from the profit), and in the
CONSF column (quota rents is paid in lump-sum to the foreign agent):

Production Sectors                      Consumer

Markets   |     X1      X2      E1      M2      W       CONSH   CONF
------------------------------------------------------------------
P1        |     150             -50             -100
P2        |             40              60      -100
PL        |     -100    -20                             120
PK        |     -50     -20                             70
PW        |                                     200     -200
PFX       |                     50      -50             10      -10
QR2       |                             -10                     10
------------------------------------------------------------------

\$offtext

SCALAR          MQ2     Import quota level                      /50/
BOPDEF  Benchmark balance of payments deficit   /10/
VER_QUOTA       Voluntary export restraint quota /50/
AUC_QUOTA       Auction quota / 0/;

\$ONTEXT

\$MODEL:M4_7S

\$SECTORS:
X1      ! Production index for good 1
X2      ! Production index good 2
E1      ! Export level of good 1
E2      ! Export level of good 2
M1      ! Import level of good 1
M2      ! Import level of good 2
W       ! Welfare index

\$COMMODITIES:
P1      ! Price index for good 1
P2      ! Price index for good 1
PFX     ! Read exchange rate index
PW      ! Welfare price index
PL      ! Wage index
PK      ! Capital rental index
QR2     ! Quota rent on good 2 imports

\$CONSUMERS:
CONSH   ! Income level for representative home agent
CONSF   ! Income level for representative foreign agent

*       Cobb-Douglas production in both sectors:

\$PROD:X1  s:1
O:P1    Q:150
I:PL    Q:100
I:PK    Q:50

\$PROD:X2  s:1
O:P2    Q:40
I:PL    Q:20
I:PK    Q:20

*       We scale the export price for good 1 and the import price
*       for good 2 to both be unity:

\$PROD:E1
O:PFX   Q:50
I:P1    Q:50

\$PROD:M2
O:P2    Q:60
I:PFX   Q:50
I:QR2   Q:50

*       The following trade activities are not operated in the benchmark
*       period, assuming that they are non-profitable by about 10%:

\$PROD:E2
O:PFX   Q:0.9
I:P2    Q:1

\$PROD:M1
O:P1    Q:1
I:PFX   Q:1.1

*       Cobb-Douglas preferences:

\$PROD:W   s:1
O:PW    Q:200
I:P1    Q:100
I:P2    Q:100

\$DEMAND:CONSH
D:PW    Q:200
E:PFX   Q:BOPDEF
E:PL    Q:120
E:PK    Q:70
E:QR2   Q:AUC_QUOTA

\$DEMAND:CONSF
E:QR2   Q:VER_QUOTA
D:PFX   Q:10

\$OFFTEXT
\$SYSINCLUDE mpsgeset M4_7S

*       Benchmark replication

M1.L = 0;
E2.L = 0;
QR2.L = 0.2;

M4_7S.ITERLIM = 0;
\$INCLUDE M4_7S.GEN
SOLVE M4_7S USING MCP;
M4_7S.ITERLIM = 2000;

*       Counterfactual experiment is to convert the voluntary export
*       restraint into an auction quota:

VER_QUOTA = 0;
AUC_QUOTA = 10;

\$INCLUDE M4_7S.GEN
SOLVE M4_7S USING MCP;

\$ontext

Exercises for M4_7S:

(i) Assuming that the VER remains in effect, investigate the welfare
effects of an import tariff.  Can a tariff be welfare improving?

(ii) Reformulate this model using the Armington assumption, basing gross
trade flows on model M4_5s.  Calibrate to the same value of quota rents.
Which model implies a larger welfare costs of VERs for the home country?

\$offtext
```