cirimge.gms : Increasing returns in intermediate inputs

Description

This program first solves a system of nonlinear equations which
jointly determines fixed costs, marginal costs, markup rates for
NA firms. It then employs MPS/GE to solve for counter-factual
equilibria.


Large Model of Types : MPSGE mcp


Category : GAMS Model library


Main file : cirimge.gms

$title Increasing Returns in intermediate Inputs (CIRIMGE,SEQ=141)

$onText
This program first solves a system of nonlinear equations which
jointly determines fixed costs, marginal costs, markup rates for
NA firms. It then employs MPS/GE to solve for counter-factual
equilibria.


Florencio Lopez-de-Silanes, James R. Markusen and Thomas
F. Rutherford  (1993)   "Complementarity and Increasing
Returns in Intermediate Inputs: A Theoretical and Applied
General-Equilibrium Analysis", Journal of Development Economics.


Lopez de Silanes, F, Markusen, J R, and Rutherford, T F,
Complementarity and Increasing Returns in Intermediate Inputs: A
Theoretical and Applied General-Equilibrium Analysis. Journal of
Development Economics 45 (1994), 133-151.

NB  Watch out for red herrings!  -- This dataset includes
    some superfluous data tables.

Keywords: mixed complementarity problem, general equilibrium model, strategic trade policy,
          intermediate inputs
$offText

Set
   R      'regions'                / CAN, USA, MEX, ROW /
   ROW(R) 'rest of world region'   / ROW /
   N(R)   'North-American regions' / CAN, USA, MEX /
   G      'goods'                  / CARS, PARTS, ENGINES /;

Alias (R,RR), (N,NN);

Table MACRO(R,*) 'macro economic parameters'
              GNP  ELS
   CAN     543.63  0.2
   USA    5166.09  0.2
   MEX     211.97  0.2
   ROW   17495.40  0.2;

* ELS Elasticity of labor supply from Y
Parameter ZSHR(R) 'parts share of auto production cost'
                  / CAN 0.4, USA 0.4, MEX 0.6, ROW 0.3 /;

Table PRICES(R,*) 'national market price indices'
         CARS  PARTS  ENGINES
   CAN   1.15   1.05     1.05
   USA   1.0    1.00     1.00
   MEX   1.4    1.20     1.00
   ROW   1.0    1.05     1.05;

Table COST(R,*) 'national markets marginal costs'
         CARS  PARTS  ENGINES
   CAN   0.95   0.95     1.20
   USA   1.00   1.00     1.10
   MEX   0.80   0.70     1.20
   ROW   0.90   0.90     1.10;

* NOTE: THESE MARGINAL COST VALUES FOR CARS ARE USED ONLY FOR ROW.

Scalar MRGNIDLE 'loss margin assumed on idle trade links' / 0.10 /;

Table TARIFF(R,R,*) 'bilateral trade protection (rate)'
            CAN.CARS     USA.CARS     MEX.CARS     ROW.CARS
   CAN                                    0.20        0.125
   USA                                    0.20        0.125
   MEX         0.095        0.038                     0.125
   ROW         0.095        0.038         0.20

   +       CAN.PARTS    USA.PARTS    MEX.PARTS    ROW.PARTS
   CAN                                    0.13        0.065
   USA                                    0.13        0.065
   MEX         0.092        0.040                     0.065
   ROW         0.092        0.034         0.13

   +     CAN.ENGINES  USA.ENGINES  MEX.ENGINES  ROW.ENGINES
   CAN                                    0.10        0.075
   USA                                    0.10        0.075
   MEX         0.092        0.031                     0.075
   ROW         0.092        0.031         0.10             ;

Table BARRIER(R,R,*) 'effective protection rates'
            CAN.CARS     USA.CARS     MEX.CARS     ROW.CARS
   CAN                                    .335         .125
   USA                                    .335         .125
   MEX         0.095        0.038                      .125
   ROW         0.095        0.038         .335

   +       CAN.PARTS    USA.PARTS    MEX.PARTS    ROW.PARTS
   CAN                                    0.17        0.065
   USA                                    0.17        0.065
   MEX         0.092        0.040                     0.065
   ROW         0.092        0.034         0.16

   +     CAN.ENGINES  USA.ENGINES  MEX.ENGINES  ROW.ENGINES
   CAN                                    0.10        0.075
   USA                                    0.10        0.075
   MEX         0.092        0.031                     0.075
   ROW         0.092        0.031         0.10             ;

abort$(smax((R,G), abs(TARIFF(R,R,G)))  > eps) " TARIFF ON DOMESTIC SALES NOT PERMITTED.";
abort$(smax((R,G), abs(BARRIER(R,R,G))) > eps) " BARRIER ON DOMESTIC SALES NOT PERMITTED.";

Table SCALE(R,*) 'elasticities of scale'
         CARS  PARTS  ENGINES
   CAN   1.15    1.2      1.2
   USA   1.1     1.1      1.1
   MEX   1.7     1.5      1.2
   ROW   1.1     1.1      1.1;

Table NFIRM(R,*) 'number of firms operating in each market'
         CARS  PARTS  ENGINES
   CAN      5    650        5
   USA      8   2291       11
   MEX      5    500        7
   ROW     12  13000       20;

Table TRADE(R,R,G) 'benchmark trade patterns'
            CAN.CARS     USA.CARS     MEX.CARS     ROW.CARS
   CAN         3.347       20.485                     0.154
   USA         8.515      140.345        0.298        4.562
   MEX                      2.287        4.430        0.290
   ROW         3.650       36.589        0.047      400.199

   +       CAN.PARTS    USA.PARTS    MEX.PARTS    ROW.PARTS
   CAN         2.713        6.392        0.090        0.190
   USA         9.984       78.348        3.213        4.202
   MEX         0.054        0.372        3.300        0.039
   ROW         1.641       11.584        0.534      166.188

   +     CAN.ENGINES  USA.ENGINES  MEX.ENGINES  ROW.ENGINES
   CAN         0.510        1.278
   USA         1.682        8.589        0.094        0.170
   MEX         0.242        0.572        0.865        0.556
   ROW         0.616        2.297                    16.217;

* DECLARE BENCHMARK PARAMETERS:
Parameter
   ELSX(R)     'elasticity of scale in x sector'
   ELSZ(R)     'elasticity of scale in z sector'
   PX0(R)      'consumer price for x'
   CY0(R)      'consumption'
   CX0(R)
   X0(R)       'output'
   Y0(R)
   Z0(R)
   XI0(R)      'x inputs (labor and parts)'
   LX0(R)      'labor inputs and supplies'
   LY0(R)
   LZ0(R)
   LT0(R)
   L(R)
   KY0(R)      'macro capital'
   KY(R)
   N0(R)       'numbers of x sector firms'
   XT0(R,R)    'base year trade'
   ZT0(R,R)
   CZ0(R)      'end-use consumption of z'
   SN0(R)      'NA firms market share'
   NX0(R)      'number of x sector firms'
   MC0(R)      'calibrated marginal cost'
   MN0(R)      'calibrated markup rate for NA firms'
   FC0(R)      'calibrated fixed cost'
   MR0(R)      'calibrated row markup rates'
   MZ0(R)      'base year markup on z'
   OMEGA(R)    'calibrated conjectural variations'
   TCOST(R,R)  'unit transport costs'
   TX(R,R)     'tariff rates'
   TX0(R,R)    'tariff rates'
   TZ(R,R)
   TZ0(R,R)    'base year tariff rate'
   PXMIN(R,RR) 'minimum selling price'
   TCSHR(R,RR) 'transport cost share'
   MARGIN(R,R) 'profit margins on inactive trade links';

* LOAD THE BENCHMARK DATA:
ELSX(R) = SCALE(R,"CARS");
ELSZ(R) = SCALE(R,"PARTS");
PX0(R)  = PRICES(R,"CARS");

* LOAD BENCHMARK VALUES:
TX0(R,RR) = TARIFF(R,RR,"CARS");

* INCLUDE NTB OF TARIFF RESTRICTION ON Z:
TZ0(R,RR) = BARRIER(R,RR,"PARTS");

* FOR THE PRESENT MODEL WE NET OUT ANY CROSS-HAULING:
XT0(R,RR) = max(TRADE(R,RR,"CARS") - TRADE(RR,R,"CARS"), 0);
XT0(R,R)  = TRADE(R,R,"CARS");

* Parts and engines are combined in this version of the model.
ZT0(R,RR) = TRADE(R,RR,"PARTS") + TRADE(R,RR,"ENGINES");
SN0(R)    = sum(N, XT0(N,R))/sum(RR, XT0(RR,R));
X0(R)     = sum(RR, XT0(R,RR));
Y0(R)     = MACRO(R,"GNP");
Z0(R)     = sum(RR, ZT0(R,RR));
N0(R)     = NFIRM(R,"CARS");
MZ0(R)    = SCALE(R,"PARTS") - 1;

* THE FOLLOWING EQUATIONS PERFORM THE CALIBRATION - SOLVING
* A NONLINEAR SYSTEM OF 9 EQUATIONS IN 9 UNKNOWNS.
* EXOGENOUS VARIABLES:
* ELSX  ELASTICITY OF SCALE,
* PX0   CONSUMER PRICE,
* XT0   BASE YEAR TRADE PATTERN.

Variable
   FC(N) 'fixed costs in x'
   MC(N) 'marginal cost'
   MN(N) 'markup on NA firm sales';

Equation
   ELSCALE(R) 'elasticity of scale'
   PROFIT(R)  'free entry zero profit condition'
   MCDEF(N)   'sets value for MC';

ELSCALE(N).. MC(N)*X0(N)*ELSX(N) =e= MC(N)*X0(N) + FC(N);

PROFIT(N)..  sum(NN, MC(NN)*XT0(N,NN)*MN(NN)) =e= FC(N);

MCDEF(N)..   (1 + MN(N))*MC(N) =e= PX0(N);

Model CALIB / ELSCALE.FC, PROFIT.MN, MCDEF.MC /;

FC.l(N)  = 1;
MN.l(N)  = 1;
MC.l(N)  = 1;
MC.lo(N) = 0.1;
MC.up(N) = 2;

solve CALIB using mcp;

* READ THE SOLUTION, INFER AND CONJECTURES:
MN0(N) = MN.l(N);
MC0(N) = MC.l(N);
FC0(N) = FC.l(N);
NX0(R) = NFIRM(R,"CARS");

OMEGA(N)$SN0(N) = NX0(N)*MN0(N)/(SN0(N)*(1 + MN0(N)));
OMEGA("ROW")    = 1;

* COMPUTE MARKUPS FOR ROW PRODUCER:
MR0(R) = 1/(1 - OMEGA(R)*(1 - SN0(R))/N0("ROW")) - 1;

* DETERMINE IMPLICIT MARGINAL COST IN ROW BASE ON DOMESTIC
* PRICES AND THE MARKUP RATE:
MC0(ROW) = PX0(ROW)/(1 + MR0(ROW));

Parameter MKTPARM(*,R) 'calibrated market structure parameters';
MKTPARM("ELSX",R)  = ELSX(R);
MKTPARM("PX0",R)   = PX0(R);
MKTPARM("MC0",R)   = MC0(R);
MKTPARM("MN0",R)   = MN0(R);
MKTPARM("MR0",R)   = MR0(R);
MKTPARM("OMEGA",R) = OMEGA(R);

display MKTPARM,
   "ELSX         ELASTICITY OF SCALE (EXOGENOUS)",
   "PX0  CONSUMER PRICE (EXOGENOUS)",
   "MC0  MARGINAL COST OF SUPPLY ",
   "MN0  NORTH-AMERICAN MARKUP",
   "MR0  ROW MARKUP",
   "OMEGA      CONJECTURAL VARIATION";

* FOR RUNNING A SET OF RELATED CASES, USE AN INCLUDE STATEMENT
* TO HOLD THE FOLLOWING SECTION IN A SEPARATE FILE:

* $include CASE.GMS

* READ CASE PARAMETERS (IRTS, ELS AND INTERZ):
* ==> TABLE5.GMS
* CASE FILE FOR TABLE 5: NAFTA - ALL PROTECTION REMOVED

MACRO(R,"ELS") = 0.2;

Scalar INTERZ 'intermediate share of parts' / 0.20 /;

ZSHR("ROW") = 0.35;
ZSHR("USA") = 0.50;
ZSHR("CAN") = 0.70;
ZSHR("MEX") = 0.70;

* SPECIFY THE SCENARIOS - BENCHMARK REPLICATION AND
* THEN FOUR ALTERNATIVE NAFTA CASE WITH INCREASING VALUES
* FOR THE MEXICAN ARMINGTON ELASTICITY:

Set SC / BENCH, NAFTA1*NAFTA4 /;

Parameter VTZ(SC,R,RR), VTX(SC,R,RR), ESUBV(SC);

* ASSIGN THE ARMINGTON ELASTICITY HERE:
ESUBV(SC)      = ord(SC) - 1;
ESUBV("BENCH") = 1;

VTZ(SC,R,RR) = TZ0(R,RR);
VTX(SC,R,RR) = TX0(R,RR);
VTZ(SC,N,NN) = 0;
VTX(SC,N,NN) = 0;

VTZ("BENCH",N,NN) = TZ0(N,NN);
VTX("BENCH",N,NN) = TX0(N,NN);
* --------------------------------------------------------------

* ACCOUNT FOR INTERMEDIATE Z INPUTS:
ZT0(R,RR) = (1 - INTERZ)*TRADE(R,RR,"PARTS") + TRADE(R,RR,"ENGINES");
Z0(R)     = sum(RR, ZT0(R,RR));

* USE THIS FLAG FOR COMPARING IRTS WITH CRTS MODEL:
Scalar IRTS 'flag for IRTS in parts production' / 1 /;

* DECLARE PARAMETERS FOR CONSISTENCY CHECK:
Parameter
   YMKT         'y market clearance'
   XMKT(R)      'x market clearance'
   XPRF(R)      'x sector excess profit'
   LMKT(R)      'l market'
   INCM(R)      'income balance'
   VARCOST(R,*) 'cost accounts for auto sector'
   TRX(R)       'tariff revenue on x'
   TRZ(R)       'tariff revenue for z'
   ESUBZ(R)     'Armington elasticity in parts';

* MAKE AN ADJUSTMENT IN SCALE DATA IN ORDER TO
* PROVIDE CONVERGENCE:
ELSZ("MEX") = 1.5;

* MINIMUM SALES PRICE GIVEN MARKUPS AND TARIFFS:
PXMIN(R,RR) = (MC0(R)*(1 + TX0(R,RR)))*(1 + MN0(RR)$N(R) + MR0(RR)$ROW(R));

* DETERMINE TRANSPORT COSTS AS A RESIDUAL, FIRST ONLY
* FOR ACTIVE TRADE SECTORS:
TCOST(R,RR)$XT0(R,RR) = PX0(RR)/((1 + TX0(R,RR))*(1 + MN0(RR)$N(R) + MR0(RR)$ROW(R))) - MC0(R);
TCOST(R,R) = 0;

* CALIBRATE FIXED COSTS IN ROW BASED ON MARKUPS AND TRANSPORT
* COSTS:
FC0("ROW") = sum(RR, MR0(RR)*(1 + TX0("ROW",RR))*(MC0("ROW") + TCOST("ROW",RR))*XT0("ROW",RR));

* CHECK THAT THE TRANSPORT COSTS FOR ACTIVE MARKETS ARE NON-NEGATIVE.
* EXIT WITH AN ERROR MESSAGE IF THIS IS VIOLATED:
abort$(smin((R,RR), TCOST(R,RR)) < -eps) "INCONSISTENCY IN IMPLIED TRANSPORT COSTS:", TCOST;

* NEXT, INFER TRADE COST DIFFERENTIALS ON TRADE LINKS WHICH
* ARE INACTIVE IN THE BENCHMARK:
TCOST(R,RR)$(XT0(R,RR) = 0) = max(0,  PX0(RR)*(1 + MRGNIDLE)/((1 + TX0(R,RR))*
                                 (1 + MN0(RR)$N(R) + MR0(RR)$ROW(R))) - MC0(R));

* NO TRANSPORT COST ON DOMESTIC SUPPLIES:
TCOST(R,R) = 0;

* COMPUTE AND REPORT THE IMPLIED COST MARGINS:
MARGIN(R,RR)$(XT0(R,RR) = 0) = 100*(PX0(RR) - (MC0(R) + TCOST(R,RR))*(1 + TX0(R,RR))*
                                   (1 + MN0(RR)$N(R) + MR0(RR)$ROW(R)))/PX0(RR);

* COMPUTE TRANSPORT COST SHARES:
TCSHR(R,RR)$TCOST(R,RR) = TCOST(R,RR)/(TCOST(R,RR) + MC0(R));

* FINISH UP THE CALIBRATION
* FINAL CONSUMPTION OF Z DETERMINED RESIDUALLY:
Parameter ZU0, ZX0;
ZU0(R) = sum(RR, ZT0(RR,R)*(1 + TZ0(RR,R)));
CZ0(R) = ZU0(R) - ZSHR(R)*(FC0(R) + X0(R)*MC0(R));
ZX0(R) = ZU0(R) - CZ0(R);

Parameter ZS;
ZS("MAX",R)   = ZU0(R)/(FC0(R) + X0(R)*MC0(R));
ZS("VALUE",R) = ZSHR(R)
abort$(smin(R, CZ0(R)) < 0) " CZ0 IS NEGATIVE:", ZS;

* IMPUTED VALUE OF DOMESTIC Z INPUTS TO AUTO PRODUCTION:
LX0(R) = FC0(R) + X0(R)*MC0(R) - ZX0(R);
XI0(R) = FC0(R) + X0(R)*MC0(R);

VARCOST(R,"FC")   = FC0(R);
VARCOST(R,"MC*X") = X0(R)*MC0(R);
VARCOST(R,"ZT*T") = ZX0(R);
VARCOST(R,"LX0")  = LX0(R);
VARCOST(R,"ZSHR") = 100*VARCOST(R,"ZT*T")/(FC0(R) + X0(R)*MC0(R));

abort$(smin(R, LX0(R)) < 0) ' IMPLIED LABOR INPUTS TO X ARE NEGATIVE.', LX0, VARCOST;

LT0(R) = sum(RR, XT0(R,RR)*TCOST(R,RR));
LZ0(R) = Z0(R);
KY0(R) = Y0(R)*MACRO(R,"ELS")*Y0(R)/(XI0(R) + MACRO(R,"ELS")*Y0(R));
LY0(R) = Y0(R) - KY0(R);
L(R)   = LT0(R) + LX0(R) + LY0(R) + LZ0(R);
CX0(R) = sum(RR, XT0(RR,R));
CY0(R) = L(R) + KY0(R) + sum(RR, ZT0(RR,R)*TZ0(RR,R))
                       + sum(RR, TX0(RR,R)*XT0(RR,R)*(MC0(RR) + TCOST(RR,R)))
                       - PX0(R)*CX0(R) - CZ0(R);

YMKT    = sum(R, Y0(R) - CY0(R));
XMKT(R) = CX0(R) - sum(RR, XT0(RR,R));
XPRF(R) = XI0(R) - LX0(R) - ZX0(R);
LMKT(R) = L(R) - LX0(R) - LY0(R) - LZ0(R) - LT0(R);
INCM(R) = PX0(R)*CX0(R) + CY0(R) + CZ0(R) - L(R) - KY0(R)
        - sum(RR, ZT0(RR,R)*TZ0(RR,R))
        - sum(RR, XT0(RR,R)*(MC0(RR) + TCOST(RR,R))*TX0(RR,R));
TRX(R)  = sum(RR, XT0(RR,R)*(MC0(RR) + TCOST(RR,R))*TX0(RR,R));
TRZ(R)  = sum(RR, ZT0(RR,R)*TZ0(RR,R));

TZ(R,RR) = TZ0(R,RR);
TX(R,RR) = TX0(R,RR);

$onText
$MODEL:CARS

$SECTORS:
   W(R) X(R) Y(R) Z(R) C(R) CZ(R) NX(R) XT(R,RR)

$COMMODITIES:
   PY PW(R) PL(R) PK(R) PS(R) PX(R) PZ(R) PZU(R) PC(R) PF(R)

$AUXILIARY:
   MKN(R)$N(R) MR(R) SN(R)
   TXZ(R)$IRTS
   SZ(R)$IRTS
   RZ(R)$IRTS
   XZ(R)$IRTS

$CONSUMERS:
   RA(R)
   ENT(R)

$REPORT:
   V:EZ(R,RR) I:PZ(R)   PROD:CZ(RR)
   V:ZX(R)    I:PZU(R)  PROD:C(R)

$PROD:W(R) s:1 a:2
   O:PW(R)    Q:(PX0(R)*CX0(R) + CY0(R) + CZ0(R))
   I:PY       Q:CY0(R)
   I:PZU(R)   Q:CZ0(R)  a:
   I:PX(R)    Q:(PX0(R)*CX0(R)) a:

$PROD:X(R)
   O:PS(R)    Q:(MC0(R)*X0(R))
   I:PC(R)    Q:(MC0(R)*X0(R))

$PROD:C(R)
   O:PC(R)    Q:XI0(R)
   I:PL(R)    Q:LX0(R)
   I:PZU(R)   Q:ZX0(R)

$PROD:CZ(R)  s:ESUBZ(R)
   O:PZU(R)   Q:ZU0(R)
   I:PZ(RR)   Q:ZT0(RR,R)  P:(1 + TZ0(RR,R)) A:RA(R) T:TZ(RR,R)

$PROD:Y(R) s:1
   O:PY       Q:Y0(R)
   I:PL(R)    Q:LY0(R)
   I:PK(R)    Q:KY0(R)

$PROD:Z(R)
   O:PZ(R)$IRTS            Q:Z0(R)  A:RA(R) N:TXZ(R) M:1 N:SZ(R) M:-1
   O:PZ(R)$(not IRTS)      Q:Z0(R)
   I:PL(R)                 Q:Z0(R)

$PROD:NX(R)
   O:PF(R)    Q:FC0(R)
   I:PC(R)    Q:FC0(R)

$PROD:XT(R,RR)
   O:PX(RR)   Q:PX0(RR)
   I:PS(R)    Q:MC0(R)  A:RA(RR)  T:TX(R,RR)
+             A:ENT(R)  N:MKN(RR)$(N(R)*N(RR)) M:(1 + TX(R,RR))$(N(R)*N(RR))
+             A:ENT(R)  N:MR(RR)$(not N(R))    M:(1 + TX(R,RR))$(not N(R))
   I:PL(R)    Q:TCOST(R,RR)   A:RA(RR) T:TX(R,RR)
+             A:ENT(R)  N:MKN(RR)$(N(R)*N(RR)) M:(1 + TX(R,RR))$(N(R)*N(RR))
+             A:ENT(R)  N:MR(RR)$(not N(R))    M:(1 + TX(R,RR))$(not N(R))

$DEMAND:RA(R)
   E:PL(R)       Q:L(R)
   E:PK(R)       Q:KY0(R)
   E:PZ(R)$IRTS  Q:Z0(R) R:XZ(R)
   D:PW(R)       Q:(CY0(R) + PX0(R)*CX0(R) + CZ0(R))

$DEMAND:ENT(R)
   D:PF(R)       Q:FC0(R)

* AUXILIARY CONSTRAINTS FOLLOW:
$CONSTRAINT:XZ(R)$IRTS
   XZ(R)  =e= Z(R)**ELSZ(R) - Z(R);

$CONSTRAINT:RZ(R)$IRTS
   RZ(R)  =e= Z(R) -  Z(R)**ELSZ(R);

$CONSTRAINT:TXZ(R)$IRTS
   TXZ(R) =e= RZ(R)/Z(R);

$CONSTRAINT:SZ(R)$IRTS
   SZ(R)  =e= XZ(R)/Z(R);

$CONSTRAINT:MKN(R)$N(R)
   MKN(R) =e= OMEGA(R)*SN(R)/(NX0(R)*NX(R) - OMEGA(R)*SN(R));

$CONSTRAINT: MR(R)
   MR(R)  =e= OMEGA(R)*(1 - SN(R))/(NX0("ROW")*NX("ROW") - OMEGA(R)*(1 - SN(R)));

$CONSTRAINT:SN(R)
   SN(R)  =e= sum(N, XT(N,R))/sum(RR, XT(RR,R));
$offText

* READ THE MODEL HEADER.
$sysInclude mpsgeset CARS

* INSTALL INITIAL LEVEL VALUES:
XT.L(R,RR) = XT0(R,RR);
MKN.L(N)   = MN0(N);
MR.L(R)    = MR0(R);
SN.L(R)    = SN0(R);
TXZ.L(R)   = 0;
SZ.L(R)    = 0;
RZ.L(R)    = 0;
XZ.L(R)    = 0;

* NORMALIZE PRICES USING ROW INCOME:
RA.fx("ROW") = CY0("ROW") + PX0("ROW")*CX0("ROW") + CZ0("ROW");

* DISPLAY RESULTS OF BENCHMARK:
display TCSHR, MARGIN, YMKT, XMKT, XPRF, LMKT, INCM, TRX, TRZ;

Parameter
   SUMMARY(SC,*)     'summary report of convergence and welfare'
   PCTREPORT(SC,*,R) 'summary report - percentage form'
   LVLREPORT(SC,*,R) 'summary report - level form'
   VXT(SC,R,R)       'auto trade  - bilateral flows'
   VZT(SC,R,R)       'parts trade - bilateral flows'
   EX0(R)            'benchmark auto export'
   MX0(R)            'benchmark auto import'
   EZ0(R)            'benchmark parts exports'
   MZ0(R)            'benchmark parts imports';

option LVLREPORT:2:1:1, PCTREPORT:2:1:1, VXT:3:1:1, VZT:3:1:1;

EX0(R) = sum(RR$(ord(RR) <> ord(R)), XT0(R,RR));
MX0(R) = sum(RR$(ord(RR) <> ord(R)), XT0(RR,R));
EZ0(R) = sum(RR$(ord(RR) <> ord(R)), ZT0(R,RR));
MZ0(R) = sum(RR$(ord(RR) <> ord(R)), ZT0(RR,R));

* COMPUTE:
loop(SC,
*  SET TAX RATES FOR THIS SCENARIO:
   TX(R,RR) = VTX(SC,R,RR);
   TZ(R,RR) = VTZ(SC,R,RR);

*  SET MEXICO'S Z SECTOR ESUB:
   ESUBZ("MEX") = ESUBV(SC);

$  include CARS.GEN

   solve CARS using mcp;

*  EXTRACT REPORT VALUES:
   SUMMARY(SC,"STATUS") = CARS.modelStat;
   SUMMARY(SC,"ITERS")  = CARS.iterUsd;
   SUMMARY(SC,"CPU")    = CARS.resUsd;
   SUMMARY(SC,"CONTOL") = CARS.objVal;
   SUMMARY(SC,R)        = 100*(W.l(R) - 1);

   PCTREPORT(SC,"W",R)  = 100*(W.l(R)  - 1);
   PCTREPORT(SC,"NX",R) = 100*(NX.l(R) - 1);
   PCTREPORT(SC,"X",R)  = 100*(X.l(R)  - 1);
   PCTREPORT(SC,"X/N",R)$NX.L(R) = 100*(X.l(R)/NX.l(R) - 1);
   PCTREPORT(SC,"Z",R)  = 100*(Z.l(R) - 1);
   PCTREPORT(SC,"EX",R)$EX0(R) = 100* sum(RR$(ord(RR) <> ord(R)), XT.l(R,RR)  - XT0(R,RR))/EX0(R);
   PCTREPORT(SC,"MX",R)$MX0(R) = 100* sum(RR$(ord(RR) <> ord(R)), XT.l(RR,R)  - XT0(RR,R))/MX0(R);
   PCTREPORT(SC,"EZ",R)$EZ0(R) = 100*(sum(RR$(ord(RR) <> ord(R)), EZ.l(R,RR)) - EZ0(R))/EZ0(R);
   PCTREPORT(SC,"MZ",R)$EZ0(R) = 100*(sum(RR$(ord(RR) <> ord(R)), EZ.l(RR,R)) - MZ0(R))/MZ0(R);
   PCTREPORT(SC,"ZX",R)$ZX0(R) = 100*(ZX.l(R) - ZX0(R))/ZX0(R);
   PCTREPORT(SC,"ZF",R)$CZ0(R) = 100*(CZ.l(R)*ZU0(R) - ZX.l(R) - CZ0(R))/CZ0(R);

   PCTREPORT(SC,"PX",R)$PY.l     = 100*(PX.l(R)/PY.l - 1);
   PCTREPORT(SC,"CX",R)$PY.l     = 100*(PC.l(R)/PY.l - 1);
   PCTREPORT(SC,"PZ",R)$PY.l     = 100*(PZ.l(R)/PY.l - 1);
   PCTREPORT(SC,"PZU",R)$PY.l    = 100*(PZU.l(R)/PY.l - 1);
   PCTREPORT(SC,"PL",R)$PY.l     = 100*(PL.l(R)/PY.l - 1);
   PCTREPORT(SC,"SHRN",R)        = 100*SN.l(R);
   PCTREPORT(SC,"MKN",R)         = 100*MKN.l(R);
   PCTREPORT(SC,"MKR",R)         = 100*MR.l(R);
   PCTREPORT(SC,"ZX/X",R)$C.l(R) = 100*ZX.l(R)*PZU.l(R)/(C.l(R)*XI0(R)*PC.l(R));
   PCTREPORT(SC,"ZF/Z",R)$C.l(R) = 100*(CZ.l(R)*ZU0(R) - ZX.l(R))/(CZ.l(R)*ZU0(R));
   PCTREPORT(SC,"X/GDP",R)       = 100*C.l(R)*XI0(R)*PC.l(R)/(PL.l(R)*L(R) + PK.l(R)*KY0(R));

   LVLREPORT(SC,"NX",R)  = NX0(R)*NX.l(R);
   LVLREPORT(SC,"X",R)   = X0(R)*X.l(R);
   LVLREPORT(SC,"X/N",R)$NX.l(R) = X0(R)*X.l(R)/(NX0(R)*NX.l(R));
   LVLREPORT(SC,"Z",R)   = Z0(R)*Z.l(R);
   LVLREPORT(SC,"EX",R)  = sum(RR$(ord(RR) <> ord(R)), XT.l(R,RR));
   LVLREPORT(SC,"MX",R)  = sum(RR$(ord(RR) <> ord(R)), XT.l(RR,R) - XT0(RR,R));
   LVLREPORT(SC,"EZ",R)  = sum(RR$(ord(RR) <> ord(R)), EZ.l(R,RR));
   LVLREPORT(SC,"MZ",R)  = sum(RR$(ord(RR) <> ord(R)), EZ.l(RR,R));
   LVLREPORT(SC,"VEZ",R) = sum(RR, PZ.l(R)*EZ.l(R,RR) - PZ.l(RR)*EZ.l(RR,R))/PY.l;
   LVLREPORT(SC,"ZX",R)$ZX0(R) = ZX.l(R);
   LVLREPORT(SC,"ZF",R)$CZ0(R) = CZ.l(R)*ZU0(R) - ZX.l(R);

   VXT(SC,R,RR) = XT.l(R,RR);
   VZT(SC,R,RR) = EZ.l(R,RR);
);

Set REPROW / W, NX, X, 'X/N', Z, EX, MX, EZ, VEZ, PX, CX, PZ, PZU, PL
             SHRN, MKN, MKR, 'ZX/X', 'ZF/Z' 'X/GDP', ZX, ZF           /;

* SUPPRESS
SUMMARY(SC,R)          = round(SUMMARY(SC,R),3);
PCTREPORT(SC,REPROW,R) = round(PCTREPORT(SC,REPROW,R), 2);
LVLREPORT(SC,REPROW,R) = round(LVLREPORT(SC,REPROW,R), 2);

display SUMMARY, PCTREPORT,
   "KEY FOR PCTREPORT",
   "=================",
   "W    WELFARE INDEX (% EV)",
   "NX   NUMBER OF AUTO FIRMS (% CHANGE)",
   "X    AUTO SECTOR OUTPUT (% CHANGE)",
   "X/N  OUTPUT PER FIRM (% CHANGE)",
   "Z    PARTS SECTOR OUTPUT (% CHANGE)",
   "EX   AUTO EXPORTS (% CHANGE)",
   "MX   AUTO IMPORTS (% CHANGE)",
   "EZ   PARTS EXPORTS (% CHANGE)",
   "MZ   PARTS IMPORTS (% CHANGE)",
   "ZX   PARTS INPUTS TO AUTOS (% CHANGE)",
   "ZF   PARTS INPUTS TO FINAL DEMAND (% CHANGE)",
   "PX   CONSUMER PRICE OF AUTOS (% CHANGE)",
   "CX   MARGINAL COST OF AUTOS (% CHANGE)",
   "PZ   PRODUCER PRICE OF Z (% CHANGE)",
   "PZU  CONSUMER PRICE OF Z AGGREGATE (% CHANGE)",
   "PL   PRICE OF L (% CHANGE)",
   "SHRN       NORTH-AMERICAN SHARE OF AUTO MARKET (%)"
   "MKN        MARKUP RATE FOR NORTH-AMERICAN FIRMS (%)"
   "MKR        MARKUP RATE FOR ROW FIRMS (%)"
   "ZX/X       PARTS VALUE SHARE OF AUTO COST (%)"
   "ZF/Z       FINAL DEMAND SHARE OF PARTS DEMAND (%)"
   "X/GDP      AUTO SECTOR SHARE OF GDP (%)";

display LVLREPORT,
   "KEY FOR LVLREPORT",
   "=================",
   "N    NUMBER OF FIRMS ",
   "X    AUTO SECTOR OUTPUT ",
   "X/N  OUTPUT PER FIRM ",
   "Z    PARTS SECTOR OUTPUT",
   "EX   AUTO EXPORTS",
   "MX   AUTO IMPORTS",
   "EZ   PARTS EXPORTS",
   "MZ   PARTS IMPORTS",
   "ZX   PARTS INPUTS TO AUTOS",
   "ZF   PARTS INPUTS TO FINAL DEMAND",
   "VEZ  NET VALUE OF PARTS EXPORTS";

display VXT, VZT;