$title Simplified representation of the IFPRI model in MPSGE.

$ontext

This file provides an MPSGE implementation of the core model file for
the IFPRI/TMD Standard CGE Model.  The GAMS/MCP (algebraic) model is
documented in:

Löfgren, Hans, Rebecca L. Harris, and Sherman Robinson, with the
assistance of Marcelle Thomas and Moataz El-Said. 2001. A Standard
Computable General Equilibrium (CGE) Model in GAMS. Discussion Paper
No. 75, Trade and Macroeconomics Division, IFPRI.

----------------------------------------------------------

I coded up this version of the model in order to illustrate
how this model can be represented using the MPSGE syntax 
with a fraction of the symbols appearing in the algebraic model.

Cheers,

Thomas F. Rutherford

University of Colorado
May 31, 2001

In order to run this file, you must make a few edits in the IFPRI 
files:

1) The following statement MUST BE INSERTED immediately prior to the
SOLVE statement in MOD100.GMS:

		$IF "%1"=="MPSGE" $EXIT

2) You need to replace variable MPS() by MPSV() in MOD100.GMS and
VARINIT.INC.  The affected lines appear in the listing file as:

2130    MPSV(INS)      marginal propensity to save for dom non-gov inst ins
2198    MPSV.L(INSDNG)   = MPS0(INSDNG);
2442             * (1 - MPSV(INSDNGP)) * (1 - TINS(INSDNGP))* YI(INSDNGP);
2445    EH(H) =E= (1 - SUM(INSDNG, shii(INSDNG,H))) * (1 - MPSV(H))
2498    MPSV(INSDNG)  =E= mpsbar(INSDNG)*(1 + MPSADJ*mps01(INSDNG))
2502     SUM(INSDNG, MPSV(INSDNG) * (1 - TINS(INSDNG)) * YI(INSDNG))
2573   MPSDEF.MPSV


Here is a zip file with all the edited
files, including the MPSGE model file, ifpri.gms.


The present version of the MPSGE file has a few short-cuts:

	No LES specifiction 
	Simplified benchmark income accounting.
	No reporting


$offtext

*	Read the data and run the calibration:

$BATINCLUDE MOD100 MPSGE

*	Put all the non-household, non-government institutions
*	into a single representative consumer:

SET INST(AC); 
INST(INSDNG) = YES$(NOT H(INSDNG));
INST(INSDNG)$(NOT INSD(INSDNG)) = NO;

*	Calibration income balances to loosely capture the 
*	benchmark:

PARAMETER	DEFICIT(*)	Base year deficit (residual calculation);

DEFICIT("GOVT") = SUM(C,SAM(C,'GOV') + SAM(C,'S-I'))
		- SUM(F, tf(f)*SUM(A, SAM(F,A)))
		- SUM(A, tva(A) * QVA0(A))
		- SUM(A, ta(A) * SUM(C, SAM(A,C)+SUM(H,QHA0(A,C,H))))
		- SUM(C, te(C) * SAM(C,'ROW'))
		- SUM(C, tm(C) * SAM('ROW',C))
		- SUM(C, tq(C) * QQ0(C));

DEFICIT("INST") = SUM(INST, SUM(H,SAM(H,INST)))
	- SUM(F, SUM(A, SAM(F,A)) - SAM("ROW",F) - SUM(H,SAM(H,F)));

DEFICIT(H) = SUM(C, QH0(C,H) + SUM(A, QHA0(A,C,H))) 
	- SUM(F, SAM(H,F)) - SUM(INST,SAM(H,INST));

SCALAR IA  Flag for presence of a non-household institutional agent;

IA = SUM((H,INST),SAM(H,INST));

$ONTEXT

$MODEL:IFPRI

$SECTORS:
	LQ(C)$QQ0(C)		! Armington supply
	LE(C)$SAM(C,"ROW")	! Export
	LX(C)$(QE0(C)+QD0(C))	! Supply (domestic and export)

	L(A)			! Production
	LVA(A)			! Value-added
	LG			! Government demand
	LI			! Fixed investment

$COMMODITIES:
	P_Q(C)$QQ0(C)		! Armington price
	P_G			! Government demand
	P_I			! Investment
	P_VA(A)			! Value-added
	W_F(F)			! Factor price 
	P_F(F)			! Factor price (net return)
	P_XAC(A,C)$SAM(A,C)	! Output by industry and good
	P_D(C)$QD0(C)		! Domestic output price
	P_E(C)$QE0(C)		! Export price
	P_INST$IA		! Institutional transfer market
	PFX			! Foreign exchange

$CONSUMERS:
	RINST$IA	! Non-household private income
	RA(H)		! Household
	RF(F)		! Factor earnings
	GOVT		! Government

$PROD:LQ(C)$QQ0(C)  s:TRADELAS(C,"SIGMAQ") m:0 d:0
	O:P_Q(C)	Q:QQ0(C)	A:GOVT  T:TQ(c)
	I:P_Q(C)	Q:(SUM(CTD,SAM(C,CTD)))	d:
	I:P_D(C)	Q:QD0(C)		d:
	I:P_Q(C)	Q:(SUM(CTM,SAM(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EMAND:RINST$IA
	E:P_F(F)	Q:((1-tf(f))*SUM(A, SAM(F,A))-SAM("ROW",F)-SUM(H,SAM(H,F)))
	E:PFX		Q:DEFICIT("INST")
	D:P_INST	Q:(SUM((H,INST),SAM(H,INST)))

$DEMAND:RA(H)  s:1
	E:P_F(F)	Q:SAM(H,F)
	E:P_INST	Q:(SUM(INST,SAM(H,INST)))
	E:PFX		Q:DEFICIT(H)
	D:P_Q(C)	Q:QH0(C,H)
	D:P_XAC(A,C)	Q:QHA0(A,C,H)
	
$OFFTEXT
$SYSINCLUDE MPSGESET IFPRI

W_F.L(F) = SUM(A, SAM(F,A)) / SUM(A, QF0(F,A));

IFPRI.ITERLIM = 0;
$INCLUDE IFPRI.GEN
SOLVE IFPRI USING MCP;
IFPRI.ITERLIM = 8000;

*	Policy simulation : 50% cut in tariffs with flexible
*	government savings:

tm(c) = 0.5 * tm0(c);

$INCLUDE IFPRI.GEN
SOLVE IFPRI USING MCP;