$TITLE A SEE/WTSM Model of World Trade -- MCP Version for Free Trade Area (FTA)

$ontext

> In the attached version of the model, I have enforced the condition
> that the US dollar is the numeraire currency, and computed all
> surpluses in dollar terms. 

Yes, there is a degree of indeterminancy in the model which permits us
to fix one of the regional price indices.  Note that when this price
is fixed, the equation is omitted, but you can see in the solution
listing that even though the equation is omitted, it is still
satisified in the model solution.

---- VAR E  Exchange rate in region j ($-fc)

           LOWER          LEVEL          UPPER         MARGINAL
...
USA         1.0000         1.0000         1.0000   1.921308E-11  < **
...

**  Note that the zero marginal indicates that the omitted equation is 
in balance .

> Under an FTA, the original coding misses the economic gains to
> regional producers and consumers arising from duty-free intrabloc
> trade under the FTA.

I don't think that I had this wrong.  Here is the basic logic of the
consumer surplus calculation:

	CS = (p0-p*) * (q0+q*)/2

in which p0 is the reference price level, pm0 in the code, and p* is
the equilibrium price level.  I believe that the relevant equilibrium
price is p*=PM.L(i,r)/E.L(r) which is defined in terms of local
currency.  Similarly, q0 is the reference demand quantity, md0 in the
code, and q* is the equilibrium quantity demand, i.e.

	q* = M.l(i,r) + MFTA.l(i,r)$fta(r) 

Note that this quantity accounts for all three types of imports.

The producer surplus calculation is analogous:

	PS = (p*-1) * (q0+q*)/2

In this calculation, we take the reference price level equal to unity,
and p* is defined as:

	p*=PX.L(i,r)/E.L(r).

I've modified the reporting code accordingly.

-------------------------------------------------------------------
In going through the model a second time, I came across an important logical
problem with the FTA formulation

The homogeneous goods formulation we have written down leads to
significant levels of "reimports" in the computed equilibrium.  
Note that in the model we had been using, there would be significant
economic effects of free trade areas defined over a single region --
nothing in the model formulation prevents a country from "exporting to
itself", and if the selected country has high tariffs there is a
significant economic impact.

We can see that this occurs in the present FTA calculation in which
EUO, in which there is a substantial reduction in EUO tariff revenues,
consumer and producer surplus, even though EUO trade with the other
FTA states is negligible in the benchmark:

----    481 PARAMETER surpluspct  Social surplus as % of benchmark consumption


		 Tariff    Consumer    Producer   Cons+Prod	  Total
	ALB       -11.0         1.9         3.2         5.1        -5.9
	BIH       -10.6         2.5         4.1         6.5        -4.1
	BGR        -8.7         2.9         5.3         8.3        -0.4
	HRV        -9.6         2.0         3.8         5.8        -3.8
	MKD        -8.3         3.3         4.6         7.8        -0.5
	MDA       -10.0         4.2         6.1        10.2         0.2
	ROM       -10.1         4.0         6.2        10.1
	YUG        -9.1         1.8         3.5         5.3        -3.7
	TUR                    -0.1        -0.1        -0.2        -0.2
	UKR                     0.1        -0.1
	EUO        -3.1         1.1         2.1         3.3         0.2
	---------------------------------------------------------------
	EUN                                            -0.1        -0.1
	BLR                    -0.2        -0.1        -0.3        -0.3
	RUS                    -0.4         0.1        -0.3        -0.3
	CHE                     0.1                     0.1         0.1
	USA                     0.1                     0.1         0.1
	JPN                     0.3                     0.3         0.3
	CHN                    -0.2        -0.1        -0.3        -0.3
	DCO                    -0.1        -0.1        -0.2        -0.2
	EMP                    -0.1        -0.1        -0.2        -0.2
	WAO                    -0.2        -0.1        -0.3        -0.3
	AFO                                -0.1        -0.1        -0.1
	ASC                    -0.3        -0.1        -0.4        -0.4
	AMO                                -0.1        -0.1        -0.1
	ROW                     0.1                     0.1         0.1
	FTA        -3.2         1.2         2.2         3.4         0.1


A simple constraint can be applied to prevent "own-region
cross-hauling" through the FTA.  I do this with the following
constraint applying to imports from FTA markets:

mshr_fta(i,r)$fta(r)..
	sum(fta(rr)$(not sameas(rr,r)), XFTA(i,rr)) =G= MFTA(i,r);

This requires that no region import from the FTA an amount greater
than exports of all other FTA member states.  The shadow value on this
constraint is the non-negative price LAMDA(i,r).  This price then
enters into the equilibrium (arbitrage) condition for imports from the
FTA:

mftaeq(i,r)$fta(r)..

	PFTA(i) + LAMDA(i,r) =G= PM(i,r);

Likewise, the price of exports from an fta member states includes
premia for any of the partners into which it is able to sell:

xftaeq(i,r)$fta(r)..            

	PX(i,r) =G= PFTA(i) + sum(fta(rr)$(not sameas(r,rr)), LAMDA(i,rr));


After having applied this (loose) constraint on trade flows, we find
(as expected) that the FTA has a negligible influence on the EUO
economy, nor does the trade agreement affect any other regions in the
model:


		 Tariff    Consumer    Producer   Cons+Prod       Total
	ALB       -11.0         3.8         3.7         7.5        -3.5
	BIH       -10.6         4.3         4.7         9.0        -1.6
	BGR        -8.7         5.3         6.2        11.5         2.8
	HRV        -9.6         3.7         4.7         8.3        -1.3
	MKD        -8.3         5.5         5.4        11.0         2.6
	MDA       -10.0         8.1         7.5        15.5         5.6
	ROM       -10.1         6.3         7.0        13.2         3.1
	YUG        -9.1         3.7         4.3         8.0        -1.1
	EUO        -0.1                                            -0.1
	FTA        -0.3         0.1         0.2         0.3

This change in the model formulation assures that the Ricardian logic
carries through: benefits captured as a result of a regional trade
agreement are captured by the smaller country.

We can also explore the impact of changing the set of countries
included in the FTA.  For example, if Ukraine is added, the economic
impact becomes:

		 Tariff    Consumer    Producer   Cons+Prod       Total
	ALB       -11.0         3.8         3.7         7.5        -3.5
	BIH       -10.6         4.3         4.7         8.9        -1.7
	BGR        -8.7         5.3         6.2        11.5         2.8
	HRV        -9.6         3.7         4.7         8.3        -1.3
	MKD        -8.3         5.5         5.4        11.0         2.6
	MDA       -10.0         8.1         7.5        15.5         5.6
	ROM       -10.1         6.3         7.0        13.2         3.1
	YUG        -9.1         3.7         4.3         8.0        -1.1
	UKR        -8.4         7.0         6.8        13.8         5.3
	EUO        -0.1                                            -0.1
	FTA        -0.4         0.1         0.2         0.4

There are substantial benefits for Ukraine, and there is virtually no
impact on the other member states.

$offtext

sets      i Commodities  /
                an      Live animals & animal products
                ve      Vegetable products
                fa      Fats & oils
                fs      Manufactured foodstuffs
                mn      Mineral products
                ch      Chemical
                rp      Rubber & plastics
                hl      Hides & leather products
                cw      Cork & wood articles
                pp      Pulp & paper products
                ta      Textiles & apparel
                fw      Footwear & other made-up articles
                sp      Stone & mineral products
                ps      Precious stones & jewellery
                mt      Base metals & metal products
                ma      Machinery
                te      Transport equipment
                pe      Professional equipment
                aa      Arms & ammunition
                mm      Miscellaneous manufactures
                wa      Works of art
                ot      Goods nes /,

          r     Country and regions /

                ALB     Albania,
                BIH     Bosnia-Herzegovina,
                BGR     Bulgaria,
                HRV     Croatia,
                MKD     TFYR Macedonia,
                MDA     Republic of Moldova,
                ROM     Romania,
                YUG     Serbia-Montenegro,
                TUR     Turkey,
                UKR     Ukraine,
                EUO     EU-15,

                EUN     EU-10,
                BLR     Belarus,
                RUS     Russian Federation,
                CHE     Switzerland,
                USA     United States,
                JPN     Japan,
                CHN     China,
                DCO     Other developed,
                EMP     Euro-Med partners,
                WAO     Other West Asia,
                AFO     Other Africa,
                ASC     Central Asia,
                ASO     Other Asia,
                AMO     Other America,
                ROW     Rest of World/

	kfta(r)  States creating the FTA /ALB, BIH, BGR, HRV, MKD, MDA, ROM, YUG, EUO/,
	kfta2(r) States creating the FTA /ALB, BIH, BGR, HRV, MKD, MDA, ROM, YUG, UKR, EUO/,

	fta(r)        States in FTA in the model;

alias (r,rr);

parameter
        md0(i,r)        Base year import demand,
        xs0(i,r)        Base year exports,
        t(i,r)          Tariff rate,

        epsilon(i,r)    Import demand elasticity,
        eta(i,r)        Export supply elasticity;

$onecho >gdxxrw.txt
par=eta rng=eta!b2
par=epsilon rng=epsilon!b2
par=t rng=t!b2
par=xs0 rng=xs0!b2
par=md0 rng=md0!b2
$offecho
$if not exist tradedata.gdx $call gdxxrw i=tradedata.xls o=tradedata.gdx @gdxxrw.txt

$gdxin 'tradedata.gdx'
$load md0 xs0 t epsilon eta

*	------ md0, xs0 scaled by 1.0E+6; tariff rates are decimal fractions

parameter
        b(r)            Current account deficit
        pm0(i,r)        Reference price of imports,
        xsd(i)          Excess demand;

b(r) = sum(i, md0(i,r)-xs0(i,r));
xsd(i) = sum(r, md0(i,r) - xs0(i,r));
display xsd;
pm0(i,r) = 1 + t(i,r);
fta(r) = no;

positive
variables
        M(i,r)          Imports (Imports from non-FTA & non-CU)
        X(i,r)          Exports (Exports to non-FTA & non-CU)
        MFTA(i,r)       FTA Imports
        XFTA(i,r)       FTA Exports
        P(i)            World market price ($)
        PFTA(i)         Market price within the FTA zone ($)
        PM(i,r)         Import price ($)
	LAMDA(i,r)	Limit on own-commodity imports in the FTA
	PX(i,r)		Export price ($)
        E(r)            Exchange rate in region j ($-fc);

equations       mdemand, meq, mftaeq, xsupply, xeq, xftaeq,
                ftamarket, market, caccount, mshr_fta;

mdemand(i,r)..                  M(i,r) + MFTA(i,r)$fta(r)
	                                 =e= md0(i,r) * (PM(i,r)/(E(r)*pm0(i,r)))**epsilon(i,r);

xsupply(i,r)..                  xs0(i,r) * (PX(i,r)/E(r))**eta(i,r)
					=E= X(i,r) + XFTA(i,r)$fta(r);

meq(i,r)..                      P(i) * (1+t(i,r))   =G= PM(i,r);

mftaeq(i,r)$fta(r)..            PFTA(i) + LAMDA(i,r) =G= PM(i,r);

xeq(i,r)..                      PX(i,r) =G= P(i);

xftaeq(i,r)$fta(r)..            PX(i,r) =G= PFTA(i) + sum(fta(rr)$(not sameas(r,rr)), LAMDA(i,rr));

mshr_fta(i,r)$fta(r)..		sum(fta(rr)$(not sameas(rr,r)), XFTA(i,rr)) =G= MFTA(i,r);

ftamarket(i)$card(fta)..        sum(fta(r), XFTA(i,r) - MFTA(i,r)) =E= 0;

market(i)..                     sum(r,      X(i,r)    - M(i,r)) =E= 0;

caccount(r)..                   0 =e= sum(i, P(i) * (X(i,r)-M(i,r))
                                 + (PX(i,r)*XFTA(i,r)-PM(i,r)*MFTA(i,r))$fta(r) ) + b(r);

model global /mdemand.PM, meq.M, mftaeq.MFTA,
              xsupply.PX, xeq.X, xftaeq.XFTA,
	      ftamarket.PFTA, market.P, caccount.E,
	      mshr_fta.LAMDA /;

M.l(i,r) = md0(i,r);
X.l(i,r) = xs0(i,r);
P.l(i)   = 1;
PM.L(i,r) = pm0(i,r);
PX.L(i,r) = 1;
E.l(r)   = 1;
E.FX("usa") = 1;

PFTA.l(i) = 1;

global.iterlim = 0;
solve global using mcp;

E.LO(r) = 0.001;
P.LO(i) = 0.0001;
PFTA.LO(i) = 0.0001;
PM.LO(i,r) = 0.0001;
PX.LO(i,r) = 0.0001;

*	Normalize prices:

E.FX("usa") = 1;

*	Declare parameters for model output:


parameter       ssummary        Sectoral summary,
                rsummary        Regional results summary (% change),
		surplus		Social surplus impacts (local currency),
		surpluspct	Social surplus as % of consumption;

set	s   /Tariff,Consumer,Producer,Cons+Prod,Total/;

set rs(*)/FTA,nFTA/; rs(r) = yes;

*	Create a temporary batinclude file with reporting code which
*	can subsequently be accessed through a $batinclude "call":

*	This command permits us to "write" a file containing "%1":

$escape =
$onecho >"%gams.scrdir%report.scr"

ssummary("%=1",i,"P")     = P.l(i);
ssummary("%=1",i,"PFTA")  = PFTA.l(i);
ssummary("%=1",i,"Trade") = 100*(sum(r, M.l(i,r)+MFTA.L(i,r))/sum(r, md0(i,r))-1);

rsummary("%=1",r,"E")     = E.L(r);
rsummary("%=1",r,"M")     = 100 * (sum(i, M.L(i,r)+MFTA.L(i,r)$fta(r))/sum(i,md0(i,r))-1);
rsummary("%=1",r,"X")     = 100 * (sum(i, X.L(i,r)+XFTA.L(i,r)$fta(r))/sum(i,xs0(i,r))-1);

surplus("%=1",r,"Tariff") = round(sum(i, P.L(i)/E.l(r)*t(i,r)*M.L(i,r)  
				   - (pm0(i,r)-1)*md0(i,r)), 3);

surplus("%=1",r,"Consumer") = round(sum(i, (pm0(i,r)-PM.L(i,r)/E.L(r)) * 
			(md0(i,r)+M.l(i,r) + MFTA.l(i,r)$fta(r))/2),3);

surplus("%=1",r,"Producer") = round(sum(i, (PX.L(i,r)/E.L(r)-1) *
			(xs0(i,r)+X.l(i,r) + XFTA.l(i,r)$fta(r))/2),3);

surplus("%=1","FTA",s)       = sum(fta, surplus("%=1",fta,s));
surplus("%=1","nFTA",s)    = sum(r$(not fta(r)), surplus("%=1",r,s));
surplus("%=1",rs,"Cons+Prod") = surplus("%=1",rs,"Consumer") + surplus("%=1",rs,"Producer");
surplus("%=1",rs,"Total") = surplus("%=1",rs,"Tariff") + surplus("%=1",rs,"Cons+Prod");
surpluspct("%=1",r,s) = 100 * surplus("%=1",r,s)
				/sum(i,md0(i,r)*pm0(i,r));
surpluspct("%=1","nFTA",s) = 100 * surplus("%=1","nFTA",s)
		/sum((i,r)$(not fta(r)), md0(i,r)*pm0(i,r));
surpluspct("%=1","FTA",s)$sum((i,r)$fta(r), md0(i,r)*pm0(i,r))
		= 100 * surplus("%=1","FTA",s)/sum((i,r)$fta(r), md0(i,r)*pm0(i,r));
surpluspct("%=1",rs,s) = round(surpluspct("%=1",rs,s),1);
option surplus:3,surpluspct:1;

$offecho

*	Generate a report of benchmark values:

$batinclude "%gams.scrdir%report.scr" BMK


*	The following PATH options improve algorithmic efficiency.  
*	Michael Ferris could probably explain why this is true.  I 
*	found these by simply reading the PATH documentation and trying a
*	few of the suggested specifications:

$onecho >path.opt
crash_method none;
crash_perturb no;
$offecho

*	Instruct PATH to read its options file:

global.optfile=1;
global.iterlim = 50000;

*	Solve scenarios and generate reports:

fta(kfta) = yes;

LAMDA.FX(i,r) = 0;
solve global using mcp;
$batinclude "%gams.scrdir%\report.scr" FTA_xhaul

LAMDA.up(i,r) = inf;
solve global using mcp;
$batinclude "%gams.scrdir%report.scr" FTA

fta(kfta2) = yes;
solve global using mcp;
$batinclude "%gams.scrdir%\report.scr" UKR

option ssummary:3:1:1, rsummary:3:1:1, surplus:3:1:1;
display ssummary, rsummary, surplus, surpluspct;