please see errors in my coding---can anyone help?

hi All,

I am a beginner and could not eliminate the simple errors in gam coding my coding is as under (after running it i get many errors)
please can anyone help me?

$Title Generic Small Open Economy Model – “SOEM”

$STitle Version 1 with:

  • 2 goods, 2 activities, 2 households;

  • no market power in the world markets;

  • no firms amongst institutions.


    \

  • SETS ===========================================================

SETS

AC the global set including all items

  • Since there are no Firms in this exercise, they are excluded from the sets

/

AGR-A agricultural activity

NAGR-A non-agricultural activity

AGR-C agricultural commodity

NAGR-C non-agricultural commodity

LAB labour

CAP capital

U-HHD urban household

R-HHD rural household

GOV government

ROW rest of world

S-I savings-investment

YTAX income tax

STAX sales tax

TAR import tariff

TOTAL total account in SAM

/


\

  • Generating the specific sets and subsets

ACNT(AC) all elements in AC except total

A(AC) activities /AGR-A, NAGR-A/

C(AC) commodities /AGR-C, NAGR-C/

CE(C) exported commodities /AGR-C/

CNE(C) non-exported commodities /NAGR-C/

CM(C) imported commodities /NAGR-C/

CNM(C) non-imported commodities /AGR-C/

F(AC) factors /LAB, CAP/

I(AC) institutions /U-HHD, R-HHD, GOV, ROW/

H(I) households /U-HHD, R-HHD/

;


\

  • To exclude TOTAL from ACNT:

ACNT(AC) = YES;

ACNT(‘TOTAL’) = NO;

  • Alias sets to be used when we want to distinguish between two versions, e.g.

  • when summing y(F,F) over columns, we can write SUM(F y(F,FAL))

ALIAS ( AC , ACAL);

ALIAS (C, CAL);

ALIAS (F,FAL);

ALIAS (I,IAL);

ALIAS (ACNT,ACNTAL);


\

  • PARAMETERS ======================================================



    PARAMETERS



    ad(A) shift in the production fn for activity a

alpha(F,A) elasticity of factor f in the production fn for activity a

aq(C) shift parameter in CES aggregation for commodity c

ax(C) shift parameter in CES transformation for commodity c

beta(C,H) share of households total spending on commodity c

consumer price index

cwts(C) weight of commodity c in the CPI

deltaq(C) share parameter in CES aggregation for commodity c

deltax(C) share parameter in CES transformation for commodity c

ir(C,A) IO coeff: qnty of c as intermediate input per unit of activity a

INV(C) base-year qnty of investment demand for commodity c

PWE(C) export (world) price for c (foreign currency)

PWM(C) import (world) price for c (foreign currency)

QFS(F) total supply of factor f

QG(C) government demand for commodity c (in quantity)

rhoq(C) exponent parameter in the CES aggregation for commodity c

rhox(C) exponent parameter in the CES transformation for commodity c

shry(H,F) share of household i in income of factor f

te(C) export subsidy or tax rate for commodity c

theta(A,C) yield coeff: yield of output c per unit of activity a

tm(C) import tariff rate for commodity c

tq(C) sales tax rate for commodity c

TR(I,IAL) transfer from institution ial to institution i

ty(H) income tax rate for household h

;


\

  • VARIABLES =======================================================



    VARIABLES



    *FREE VARIABLES

BOP balance of payment (foreign savings) in foreign currency)

GBS government budget surplus (or deficit)

QE(C) quantity of exports for commodity c (can be import if <0)

QFU(F) excess sup. of factor f (e.g. unemployment. <0 if excess demand)

QM(C) quantity of imports of commodity c (can be export if <0)

WALR dummy variable (zero at equilibrium)



*POSITIVE VARIABLES

EXR exchange rate (dom. currency per unit of for. currency)

FPD(F,A) wage distortion factor for factor f in activity a

IADJ investment adjustment factor

MPS(H marginal (and average) propensity to save for household h

PA(A) price of activity a

PD(C) domestic price of domestic output c

PE(C) export price for c (domestic currency)

PF(F) average price of factor f

PM(C) import price for c (domestic currency)

PQ(C) composite commodity price for c

PVA(A) value-added price for activity a



PX(C) producer price for commodity c

QA(A) level of activity a

QD(C) quantity sold domestically of domestic output c

QF(F,A) quantity demanded of factor f from activity a

QH(C,H) quantity consumed of commodity c by household h

QINT(C,A) quantity of commodity c as intermediate input to activity a

QINV(C) quantity of investment demand for commodity c

QQ(C) quantity of goods supplied domestically (composite supply)

QX(C) quantity of domestic output of commodity c

YF(H,F) transfer of income to institutions i from factor f

YH(H) income of household h

;


\

  • EQUATIONS =======================================================


    \
  • EQUATION NAME ###############



    EQUATIONS


    \
  • PRICE BLOCK +++++++++++++++++++++++++++



    PMDEF(C) import price for commodity c (domestic currency)

PEDEF(C) export price for commodity c (domestic currency)

ABSORB(C) absorption for commodity c

OUTVAL(C) output value for commodity c

PADEF(A) price for activity a

PVADEF(A) value-added price for activity a

PNORM CPI and the price normalization rule


\

  • PRODUCTION AND COMMODITY BLOCK ++++++++



    PRODFN (A) Cobb-Douglas production function for activity a

FACDEM (F, A) demand for factor f by activity a

INTDEM(C , A) intermediate demand for commodity c by activity a



OUTPUTFN(C) output of commodity c

CESQ(C) CES aggregation of QD and QM into QQ

CESX(C) CES transformation of QD and QE into QX

ESUBMD(C) import-domestic demand ratio for commodity c

ESUBED(C) export-domestic supply ratio for commodity c

NMQD(C) composite version for non-imported commodity c

NEXD(C) transformation for non-exported commodity c


\

  • INSTITUTION BLOCK +++++++++++++++++++++



    FACTTRNS(H,F) transfer of income from factor f to household h

HHDINC(H) income of household h

HHDCON(C,H) consumption demand by household h for commodity c

INVDEM(C) investment demand for commodity c

GBC government budget surplus


\

  • SYSTEM CONSTRAINT BLOCK +++++++++++++++



    FACTMEQ(F) market equilibrium condition for factor f

GOODMEQ(C) market equilibrium condition for composite commodity c

BOPEQ current account balance for ROW

WALREQ savings-investment balance with WALR dummy to be zero

;


\

  • EQUATION DESCRIPTION ###############


    \
  • PRICE BLOCK +++++++++++++++++++++++++++



    PMDEF(C)$CM(C)… PM(C) =E= (1 + tm(C))EXRPWM(C);



    PEDEF(C)$CE(C)… PE(C) =E= (1-te(C))EXRPWE(C);



    ABSORB(C)… PQ(C)*QQ(C)=E= (PD(C)*QD(C) + (PM(C)QM(C))$CM(C))(1 + tq(C));



    OUTVAL(C)… PX(C)*QX(C) =E= PD(C)*QD(C) + (PE(C)*QE(C))$CE(C);



    PADEF(A)… PA(A) =E= SUM(C, PX(C)*theta(A,C));



    PVADEF(A)… PVA(A) =E= PA(A)-SUM(C, PQ(C)*ir(C,A));



    PNORM… SUM(C, PQ(C)*cwts(C)) =E= CPI;


    \
  • PRODUCTION AND COMMODITY BLOCK++++++++



    PRODFN(A)… QA(A) =E= ad(A)*PROD(F, QF(F,A)alpha(F,A));



    FACDEM(F,A)… PF(F)*FPD(F,A) =E= alpha(F,A)*PVA(A)*QA(A)/QF(F,A);



    INTDEM(C,A)… QINT(C,A) =E= ir(C,A)*QA(A);



    OUTPUTFN(C)… QX(C) =E= SUM(A, theta(A,C)QA(A));



    CESQ(C)$CM(C)… QQ(C) =E= aq(C)
    (deltaq(C)*QM(C)
    (-rhoq(C))
  • (1-deltaq(C))QD(C)(-rhoq(C)))(-1/rhoq(C));



    CESX(C)$CE(C)… QX(C) =E= ax(C)
    (deltax(C)*QE(C)**(rhox(C))

  • (1-deltax(C))*QD(C)(rhox(C)) )(1/rhox(C));



    ESUBMD(C)$CM(C)… QM(C)/QD(C) =E=

( (deltaq(C)/(1-deltaq(C))) * (PD(C)/PM(C)) )**(1/(1+rhoq(C)));



ESUBED(C)$CE(C)… QE(C)/QD(C) =E= ( PE(C)/PD(C)*(1-deltax(C))

/deltax(C) )**(1/(rhox(C)-1) );



NMQD(C)$CNM(C)… QQ(C) =E= QD(C);

NEXD(C)$CNE(C)… QX(C) =E= QD(C);


\

  • INSTITUTION BLOCK +++++++++++++++++++++



    FACTTRNS(H,F)… YF(H,F) =E= shry(H,F)*SUM(A, PF(F)*FPD(F,A)*QF(F,A));

HHDINC(H)… YH(H) =E= SUM(F, YF(H,F)) + CPITR(H,‘GOV’) + EXRTR(H,‘ROW’);



HHDCON(C,H)… QH(C,H) =E= beta(C,H)(1-MPS(H))(1-ty(H))*YH(H)/PQ(C);

INVDEM(C)… QINV(C) =E= inv(C)*IADJ;

GBC… GBS =E=

( SUM(H, ty(H)*YH(H))

  • SUM(C, tq(C)*(PD(C)*QD(C) + (PM(C)*QM(C))$CM(C)))

  • SUM(C$CM(C), tm(C)EXRPWM(C)*QM(C))

  • SUM(C$CE(C), te(C)EXRPWE(C)*QE(C))

  • EXR*TR(‘GOV’,‘ROW’)

) -( SUM(C, PQ(C)*QG(C))

  • SUM(I, CPI*TR(I,‘GOV’)$H(I))

);


\

  • SYSTEM CONSTRAINT BLOCK +++++++++++++++



    FACTMEQ(F)… SUM(A, QF(F,A)) + QFU(F) =E= QFS(F);



    GOODMEQ(C)… QQ(C) =E= SUM(A, QINT(C,A)) + SUM(H, QH(C,H))+ QG(C) + QINV(C);



    BOPEQ… BOP =E= SUM(C$CM(C), PWM(C)*QM(C))

-( SUM(C$CE(C), PWE(C)*QE(C))

  • SUM(I, TR(I,‘ROW’)$H(I))

  • TR(‘GOV’,‘ROW’)

);



WALREQ… WALR =E=

( SUM(H, MPS(H)*(1-ty(H))*YH(H))

    • YFRM
  • GBS + EXR*BOP )
  • ( SUM(C, PQ(C)*QINV(C)) );


    \
  • MODEL ===========================================================



    MODELS SOEMV1 “Small Open Economy Model Ver1” /ALL/ ;


    \

  • use hold fix to speed up the solution

  • This attribute tells GAMS whether to generate and send to the solver the

  • variables that are being held fixed by the .fx



    SOEMV1.HOLDFIXED = 1;



    *#############################################################################


    \

  • SOCIAL ACCOUNTING MATRIX =======================================



    TABLE SAM(AC,ACAL) social accounting matrix



    AGR-A NAGR-A AGR-C NAGR-C LAB CAP U-HHD R-HHD

AGR-A 0 0 279 0 0 0 0 0

NAGR-A 0 0 0 394 0 0 0 0

AGR-C 84 55 0 0 0 0 30 49

NAGR-C 50 99 0 0 0 0 165 92

LAB 72 105 0 0 0 0 0 0

CAP 73 135 0 0 0 0 0 0

U-HHD 0 0 0 0 95 125 0 0

R-HHD 0 0 0 0 82 83 0 0

GOV 0 0 0 0 0 0 0 0

ROW 0 0 0 105 0 0 0 0

YTAX 0 0 0 0 0 0 20 5

STAX 0 0 10 20 0 0 0 0

TAR 0 0 0 39 0 0 0 0

S-I 0 0 0 0 0 0 70 40




\

  •        GOV                      ROW                    YTAX      STAX                     TAR                       S-I
    

AGR-A 0 0 0 0 0 0

NAGR-A 0 0 0 0 0 0

AGR-C 13 30 0 0 0 28

NAGR-C 67 0 0 0 0 85

LAB 0 0 0 0 0 0

CAP 0 0 0 0 0 0

U-HHD 25 40 0 0 0 0

R-HHD 5 16 0 0 0 0

GOV 0 15 25 30 39 0

ROW 0 0 0 0 0 0

YTAX 0 0 0 0 0 0

STAX 0 0 0 0 0 0

TAR 0 0 0 0 0 0

S-I 1 4 0 0 0 0

;

  • GENERATING THE TOTAL COLUMN AND ROW FOR SAM

  • note the use of ALIAS SET ACNTAL



    SAM(‘TOTAL’,ACNTAL) = SUM(ACNT, SAM(ACNT,ACNTAL));



    SAM(ACNT,‘TOTAL’) = SUM(ACNTAL, SAM(ACNT,ACNTAL));


    \

  • CHECKING THE CONSISTENCY: tdiff should be zero



    PARAMETER tdiff(AC) “(column total - row total) for account AC”;



    tdiff(ACNT) = SAM(‘TOTAL’,ACNT)-SAM(ACNT,‘TOTAL’);



    DISPLAY SAM, tdiff;




    \

  • ASSIGNMENTS FOR PARAMETERS AND VARIABLES ======================


    \

  • The following parameters are used to define the initial values of variables



    PARAMETERS

EXR0, BOP0, GBS0, FPD0(F,A), IADJ0, MPS0(H), PA0(A), PD0(C), PE0(C), PF0(F),

PM0(C), PQ0(C), PVA0(A), PX0(C), QA0(A), QD0(C), QE0(C), QF0(F,A),

QFU0(F), QH0(C,H), QINT0(C,A), QINV0(C), QM0(C), QQ0(C), QX0(C), YF0(H,F),

YH0(H)

;



########## CALIBRATING THE MODEL BY FIXING INITIAL VALUES ########


\

  • QUANTITIES AND PRICES OF FACTORS ++++++++++++++++++++++++



    PARAMETERS


    \

  • the initial quantity of labour employed by activity (no. of workers)

  • for this, use:

labour(A) /AGR-A 100, NAGR-A 50/


\

  • the initial factor prices (only for calibration)

PFI(F,A)


\

  • costgap to check consistency in calibration:

  • costgap = (factor cost) - (SAM value), should = 0

costgap(F,A)

;


\

  • defining factor employment and supply

  • no factor unemployment allowed initially

QF0(‘LAB’,A) = labour(A);

QF0(‘CAP’,A) = SAM(‘CAP’,A);

QFU0(F)=0;

QFS(F) = SUM(A, QF0(F,A));


\

  • computing activity-specific factor prices

  • note that with this definition PFA for capital is set to 1

PFI(F,A) = SAM(F,A)/QF0(F,A);


\

  • computing average factor prices

PF0(F) = SUM(A, SAM(F,A))/SUM(A, QF0(F,A));

  • computing factor price distortions

FPD0(F,A) = PFI(F,A) / PF0(F);


\

  • checking the consistency of the calibration

costgap(F,A) = PF0(F)*FPD0(F,A)*QF0(F,A) - SAM(F,A);



DISPLAY PFI, PF0, QF0, QFS, QFU0, FPD0, costgap;


\

  • COMMODITY PRICES +++++++++++++++++++++++++++


    \
  • normalised initial commodity prices:

EXR0 = 1;

PA0(A) = 1;

PD0(C) = 1;

PE0(C) = 1;

PM0(C) = 1;

PX0(C) = 1;

  • sales tax rate for each good,

  • to be consistent with PQ=(1 + tq)*PD, it should be defined as

  • tq = (total sales tax)/(total sales value excluding sales tax)

tq(C) = SAM(‘STAX’,C)/(SAM(‘TAR’,C) + SAM(‘ROW’,C)

  • SUM(A, SAM(A,C))- SAM(C,‘ROW’) );



    DISPLAY tq;


    \
  • after tax sales price

PQ0(C) = (1 + tq(C))*PD0(C);


\

  • CPI normalisation

cwts(C) = SUM(H, SAM(C,H)) / SUM((CAL,H), SAM(CAL,H));

CPI = SUM(C, cwts(C)*PQ0(C));



DISPLAY cwts, CPI;


\

  • COMMODITY QUANTITIES:

  • Note that we should deflate the nominal values using the correct price

QA0(A) = SAM(‘TOTAL’,A)/PA0(A);

QD0(C) = (SUM(A, SAM(A,C)) - SAM(C,‘ROW’))/PD0(C);

QE0(C) = SAM(C,‘ROW’)/PE0(C);

QM0(C) = (SAM(‘ROW’,C) + SAM(‘TAR’,C))/PM0(C);

QQ0(C) = (SAM(‘TOTAL’,C) - SAM(C,‘ROW’))/PQ0(C);

QX0(C) = SUM(A, SAM(A,C))/PX0(C);



DISPLAY QA0, QD0, QE0, QM0, QQ0, QX0;


\

  • the value added price of each activity as

  • (value of activity a)/(quantity of activity a):

PVA0(A) = SUM(F, SAM(F,A)) / QA0(A);



DISPLAY PVA0;


\

  • IO coeff: unit intermediate input requirement by activity a by commodity c

ir(C,A) = (SAM(C,A)/PQ0(C)) / QA0(A);



DISPLAY ir;


\

  • yield coeff: amount of commodity c per unit of activity a

theta(A,C) = (SAM(A,C)/PX0(C)) / QA0(A);



DISPLAY theta;


\

  • export tax or subsidy rates

te(C) = 0;


\

  • world export prices (in foreign currency)

PWE(C) = PE0(C)/((1 + te(C))*EXR0);


\

  • import tariff rate for each good,

  • to be consistent with PM=(1 + tm)PWMEXR, it should be defined as

  • tm = (total tariff paid)/(total ex tariff import value)

tm(C)$CM(C) = SAM(‘TAR’,C)/SAM(‘ROW’,C);


\

  • world import prices

PWM(C)$CM(C) = PM0(C)/((1 + tm(C))*EXR0);



DISPLAY PWE, PWM, tm;


\

  • PRODUCTION, AGGREGATION AND TRANSFORMATION


    \
  • use by activity a of commodity c as intermediate input

QINT0(C,A) = SAM(C,A)/PQ0(C);



DISPLAY QINT0;


\

  • share & shift coefficients in the activity prod. fn.

alpha(F,A) = SAM(F,A) / SUM(FAL, SAM(FAL,A));

ad(A) = QA0(A) / PROD(F, QF0(F,A)**alpha(F,A));



DISPLAY alpha, ad;


\

  • elasticities of substitution for aGgregation & tranformation

PARAMETERS

sigmaq(C) elasticities of substitution for CES aggregation

sigmax(C) elasticities of substitution for CES tranformation

;

sigmaq(C) = 0.7;

sigmax(C) = 2.0;

  • the implied exponent coefficients in the CES functions:

rhoq(C) = 1/sigmaq(C)-1;

rhox(C) = 1/sigmax(C)+1;

DISPLAY rhoq, rhox;


\

  • share ceoff in the CES transformation equation

deltax(C)$CE(C) = 1/( 1 + ( (PD0(C)/PE0(C)) * ((QE0(C)/QD0(C))**(rhox(C)-1))));


\

  • shift ceoff in the CES transformation equation

ax(C)$CE(C) = QX0(C)/( deltax(C)*QE0(C)**(rhox(C))

  • (1-deltax(C))*QD0(C)(rhox(C)) )(1/rhox(C));



    DISPLAY deltax, ax;


    \
  • share ceoff in the CES aggregation equation

deltaq(C)$CM(C) = 1/(1 + (PD0(C)/PM0(C))*(QD0(C)/QM0(C))**(1+rhoq(C)));


\

  • shift ceoff in the CES aggregation equation

aq(C)$CM(C) = QQ0(C)/( deltaq(C)*QM0(C)**(-rhoq(C))

  • (1-deltaq(C))*QD0(C)(-rhoq(C)) )(-1/rhoq(C));



    DISPLAY deltaq, aq;


    \
  • INSTITUTION BLOCK +++++++++++++++++++++


    \
  • investment adjustment is initially =1 (no adjustment

IADJ0 = 1;


\

  • INV = the relevant SAM rows in the S-I column (properly deflated)

INV(C) = SAM(C,‘S-I’)/PQ0(C);


\

  • QINV = INV initially as IADJ0 = 1

QINV0(C) = SAM(C,‘S-I’)/PQ0(C);


\

  • household income shares from factor incomes:

shry(H,F) = SAM(H,F) / SAM(‘TOTAL’,F);


\

  • household factor income

YF0(H,F) = SAM(H,F);


\

  • household total income

YH0(H) = SAM(‘TOTAL’,H);


\

  • household income tax rate

ty(H) = SAM(‘YTAX’,H) / SAM(‘TOTAL’,H);


\

  • household propensity to save (from disposable income)

MPS0(H) = SAM(‘S-I’,H) / (SAM(‘TOTAL’,H)-SAM(‘YTAX’,H));


\

  • householhd consumption share of commodities

beta(C,H) = SAM(C,H)/SUM(CAL, SAM(CAL,H));


\

  • householhd consumption of commodities

QH0(C,H) = SAM(C,H)/PQ0(C);


\

  • government consumption of commodities

QG(C) = SAM(C,‘GOV’)/PQ0(C);


\

  • government budget surplus (revenue less expenditure, transfers, etc)

GBS0 = SAM(‘GOV’,‘TOTAL’) - (SAM(‘TOTAL’,‘GOV’) - SAM(‘S-I’,‘GOV’));


\

  • transfers to households from government

TR(H,‘GOV’) = SAM(H,‘GOV’);


\

  • transfers to institutions from abroad

TR(I,‘ROW’) = SAM(I,‘ROW’)/EXR0;




\

  • balance of payments with ROW

BOP0 = SAM(‘S-I’,‘ROW’)/EXR0;



DISPLAY INV, shry, beta, QG, TR, ty;

########## INITIALIZATION #############



BOP.L = BOP0;

EXR.L = EXR0;

FPD.L(F,A) = FPD0(F,A);

GBS.L = GBS0;

IADJ.L = IADJ0;

MPS.L(H) = MPS0(H);

PA.L(A) = PA0(A);

PD.L(C) = PD0(C);

PE.L(C) = PE0(C);

PF.L(F) = PF0(F);

PM.L(C) = PM0(C);

PQ.L(C) = PQ0(C);

PVA.L(A) = PVA0(A);

PX.L(C) = PX0(C);

QA.L(A) = QA0(A);

QD.L(C) = QD0(C);

QE.L(C) = QE0(C);

QF.L(F,A) = QF0(F,A);

QFU.L(F) = QFU0(F);

QH.L(C,H) = QH0(C,H);

QINT.L(C,A) = QINT0(C,A);

QINV.L(C) = QINV0(C);

QM.L(C) = QM0(C);

QQ.L(C) = QQ0(C);

QX.L(C) = QX0(C);

YF.L(H,F) = YF0(H,F);

YH.L(H) = YH0(H);



DISPLAY

BOP.L, EXR.L, FPD.L, GBS.L, IADJ.L, MPS.L,

PA.L, PD.L, PE.L, PF.L, PM.L, PQ.L, PVA.L, PX.L,

QA.L, QD.L, QE.L, QF.L, QFU.L, QH.L, QINT.L, QINV.L, QM.L, QQ.L, QX.L,

YF.L, YH.L

;



######### SELECTING CLOSURES ############


\

  • WE WRITE THE PROGRAMME TO GIVE A CHOICE TO THE TYPE OF CLOSURES

  • FOR EXAMPLE, WE CAN HAVE TWO POSSIBLITIES FOR LABOUR MARKET CLEARING:

  • (i) FIXED WAGE RATE AND THE LABOUR EXCESS SUPPLY ADJUSTS TO CLEAR THE MARKET

  • (i) FLEXIBLE WAGE RATE WHICH ADJUSTS TO EQUATE DEMAND & SUPPLY


    \

  • SAVINGS-INVESTMENT BEHAVIOUR +++++++++++++++++++++++++

  • Define a dummy SICLOS = 1 or 2 so that

  • if SICLOS = 1, savings is investment-driven

  • if SICLOS = 2, investment is savings-driven



    SCALAR SICLOS “savings-investment closure” /1/;



    IF(SICLOS EQ 1,

  • Investment-driven savings,

  • MPS(‘U-HHD’) is flexible, permitting savings value to adjust

IADJ.FX = IADJ0;

MPS.FX(‘R-HHD’) = MPS0(‘R-HHD’);

MPS.LO(‘U-HHD’) = -INF;

MPS.UP(‘U-HHD’) = +INF;

MPS.L(‘U-HHD’) = MPS0(‘U-HHD’);

);



IF(SICLOS EQ 2,

  • Savings-driven investment

  • IADJ is flexible, permitting investment to adjust

MPS.FX(H) = MPS0(H);

IADJ.LO = -INF;

IADJ.UP = +INF;

IADJ.L = IADJ0;

);




\

  • CAPITAL MARKETS +++++++++++++++++++++++++

  • Define a dummy CAPCLOS = 1 or 2 so that

  • if CAPCLOS = 1, capital is mobile and fully employed

  • if CAPCLOS = 2, capital is activity-specific and fully employed



    SCALAR CAPCLOS “closure for capital market” /2/;

IF(CAPCLOS EQ 1,

  • Capital is fully and mobile and fully employed, QFU(‘CAP’)=0

  • FPD(‘CAP’,A) is fixed,

  • PF(‘CAP’) adjusts to clear the market

FPD.FX(‘CAP’,A) = FPD0(‘CAP’,A);

PF.LO(‘CAP’) = -INF;

PF.UP(‘CAP’) = +INF;

PF.L(‘CAP’) = PF0(‘CAP’);

QF.LO(‘CAP’,A) = -INF;

QF.UP(‘CAP’,A) = +INF;

QF.L(‘CAP’,A) = QF0(‘CAP’,A);

QFU.L(‘CAP’)=QFU0(‘CAP’);

);



IF(CAPCLOS EQ 2,

  • Capital is activity-specific and fully employed, , QFU(‘CAP’)=0

  • PF(‘CAP’) is fixed,

  • FPD(‘CAP’,A) adjusts to clear the market

FPD.LO(‘CAP’,A) = -INF;

FPD.UP(‘CAP’,A) = +INF;

FPD.L(‘CAP’,A) = FPD0(‘CAP’,A);

PF.FX(‘CAP’) = PF0(‘CAP’);

QF.FX(‘CAP’,A) = QF0(‘CAP’,A);

QFU.L(‘CAP’)=QFU0(‘CAP’);

);




\

  • LABOUR MARKETS +++++++++++++++++++++++++

  • Define a dummy LABCLOS = 1 or 2 so that

*if LABCLOS = 1, labour is mobile and fully employed

*if LABCLOS = 2, labour is mobile and unemployed (fixed wages)



SCALAR LABCLOS “closure for labour market” /2/;



IF(LABCLOS EQ 1,

  • Labor is fully employed and mobile

  • there is no unemployed labour and QFU(‘LAB’)=0

  • FPD(‘LAB’,A) is fixed,

  • PF(‘LAB’) adjusts to clear the market

FPD.FX(‘LAB’,A) = FPD0(‘LAB’,A);

PF.LO(‘LAB’) = -INF;

PF.UP(‘LAB’) = +INF;

PF.L(‘LAB’) = PF0(‘LAB’);

QF.LO(‘LAB’,A) = -INF;

QF.UP(‘LAB’,A) = +INF;

QF.L(‘LAB’,A) = QF0(‘LAB’,A);

QFU.L(‘LAB’)=QFU0(‘LAB’);

);



IF(LABCLOS EQ 2,

  • labour is mobile

  • FPD(‘LAB’,A)*PF(‘LAB’) is fixed.

  • there is unemployed labour, QFU(‘LAB’) adjusts to clear the market

FPD.FX(‘LAB’,A) = FPD0(‘LAB’,A);

PF.FX(‘LAB’) = PF0(‘LAB’);

QF.LO(‘LAB’,A) = -INF;

QF.UP(‘LAB’,A) = +INF;

QF.L(‘LAB’,A) = QF0(‘LAB’,A);

QFU.LO(‘LAB’) = -INF;

QFU.UP(‘LAB’) = +INF;

QFU.L(‘LAB’)=QFU0(‘LAB’);

);




\

  • EXCHANGE RATE POLICY +++++++++++++++++++++++++

  • Define a dummy ROWCLOS = 1 or 2 so that

  • if ROWCLOS = 1, exchange rate is flexible ensures BOP=0

  • if ROWCLOS = 2, BOP is flexible and EXR is fixed.



    SCALAR ROWCLOS “exchange rate regime closure” /1/;



    IF(ROWCLOS EQ 1,

  • BOP is fixed.

  • A flexible exchange rate clears the current account

BOP.FX = BOP0;

EXR.LO = -INF;

EXR.UP = +INF;

EXR.L = EXR0;

0 );



IF(ROWCLOS EQ 2,

  • The exchange rate is fixed.

  • A flexible BOP is allowed

EXR.FX = EXR0;

BOP.LO = -INF;

BOP.UP = +INF;

BOP.L = BOP0;

);





DISPLAY SICLOS, CAPCLOS, LABCLOS, ROWCLOS;



######################################################


\

  • YOU CAN SOLVE THE MODEL FOR THE BASE CASE HERE BY ISSUING THE COMMAND

  • SOLVE SOEMV1 USING MCP;


    \

  • BUT THIS WOULD BE THE SAME AS THE CALIBRATED VALUES DISPLAYED ABOVE.


    \

  • BUT IT IS NICER TO SET A LOOP SOLUTION IN WHICH:

  • THE 1ST ITEM GENERATES THE BASE SOLUTION,

  • THE 2ND ITEM GENERATES THE SOLUTION FOR A GIVEN SHOCK,

  • THE 3RD ITEM GENERATES THE SOLUTION FOR ANOTHER GIVEN SHOCK, ETC.





    ######### SETTING UP FOR SIMULATING FOR BASE & SHOCKED CASES #########



    #### SETS AND PARAMETERS FOR REPORTING THE RESULTS #####



    SETS

  • CASES FOR WHICH A SOLUTION IS TO BE OBTAINED IN THE LOOP

SIM simulations

/

BASE “base simulation = calibrated values”

PWEINCR “SHOCK 1 = 25% increase in agricultural export price PWE(‘AGR-C’)”

/


\

  • SET OF VARIABLE SOLUTION VALUES TO BE DISPLAYED

ACGDP “All GDP items”

/

GDPFC GDP at factor prices

GDPGAP gap bt alternative calculations for GDP at market prices

GDPMP1 GDP at market prices (from spending side)

GDPMP2 GDP at market prices (from income side)

GOVCON government consumption

INVEST investment

EXP exports of goods and services

IMP imports of goods and services

NITAX net indirect taxes

PRVCON private consumption

/



ACGDP1(ACGDP) “components of GDP at market prices”

/

EXP exports of goods and services

GOVCON government consumption

IMP imports of goods and services

INVEST investment

PRVCON private consumption

/

;



PARAMETERS


\

  • VARIABLE VALUES TO BE USED IN SOLUTION FOR BASE & SHOCKED CASES

PWEAGRSIM(SIM) agricultural export price (just for an experiment)


\

  • VARIABLE VALUES TO BE REPORTED FOR BASE & SHOCKED CASES

PWEREP(C,SIM) export price for commodity c (value used)

BOPREP(SIM) foreign savings (foreign currency)

EXRREP(SIM) exchange rate (dom. cur. per unit of for. cur.)

FPDREP(F,A,SIM) wage distortion factor for factor f in activity a

GBSREP(SIM) government budget surplus

GDPREP(*,SIM) nominal GDP data: National Income Accounts

IADJREP(SIM) investment adjustment factor

MPSREP(H,SIM) marginal (and avg) propensity to save for household h

PAREP(A,SIM) price of activity a

PDREP(C,SIM) domestic price of domestic output c

PEREP(C,SIM) export price for c (domestic currency)

PFREP(F,SIM) average price of factor f

PFAREP(F,A,SIM) price of factor f for activity a

PMREP(C,SIM) import price for c (domestic currency)

PQREP(C,SIM) composite commodity price for c

PVAREP(A,SIM) value-added price for activity a

PXREP(C,SIM) producer price for commodity c

QAREP(A,SIM) level of activity a

QDREP(C,SIM) quantity sold domestically of domestic output c

QEREP(C,SIM) quantity of exports for commodity c

QFREP(F,A,SIM) demand for factor f from activity a

QFUREP(F,SIM) excess supply of factor f for sim

QHREP(C,H,SIM) consumption of commodity c by household h

QINTREP(C,A,SIM) qnty of commodity c as intermed. input for activity a

QINVREP(C,SIM) quantity of investment by commodity of origin c

QMREP(C,SIM) quantity of imports for commodity c

QQREP(C,SIM) quantity of composite goods supplied domestically

QXREP(C,SIM) quantity of domestic output of commodity c

YFREP(H,F,SIM) income of household h from factor f

YHREP(H,SIM) income of household h

WALRREP(SIM) dummy variable (zero at equilibrium)

;


\

  • SETTING THE BENCH & SHOCKED CASES ++++++++++++++++



    PWEAGRSIM(‘BASE’) = PWE(‘AGR-C’);

PWEAGRSIM(‘PWEINCR’) = 1.25*PWE(‘AGR-C’);



DISPLAY PWEAGRSIM;


\

  • SOLVING FOR THE BENCH & SHOCKED CASES ++++++++++++++++

  • THE LOOP BELOW RUNS OVER THE SET SIM ={BASE, PWEINCR}, AND

  • FOR EACH SOLUTION STORES THE VALUES OF THE VARIABLES AS REQUIRED



    LOOP(SIM,


    \

  • CHOOSING THE VALUE OF THE VARIABLE THAT IS SHOCKED

PWE(‘AGR-C’) = PWEAGRSIM(SIM);


\

  • SOLVING THE MODEL

SOLVE SOEMV1 USING MCP;


\

  • STORING THE SOLUTION

PWEREP (CE,SIM) = PWE(CE);

BOPREP (SIM) = BOP.L;

EXRREP (SIM) = EXR.L;

FPDREP (F, A ,SIM) = FPD.L(F,A);

GBSREP (SIM) = GBS.L;

IADJREP (SIM) = IADJ.L;

MPSREP (H, SIM) = MPS.L(H);

PAREP (A, SIM) = PA.L(A);

PDREP (C, SIM) = PD.L(C);

PEREP (CE, SIM) = PE.L(CE);

PFREP (F, SIM) = PF.L(F);

PFAREP (F,A, SIM) = PF.L(F)*FPD.L(F,A);

PMREP (CM, SIM) = PM.L(CM);

PQREP (C, SIM) = PQ.L(C);

PVAREP (A, SIM) = PVA.L(A);

PXREP (C, SIM) = PX.L(C);

QAREP (A, SIM) = QA.L(A);

QDREP (C, SIM) = QD.L(C);

QEREP (CE, SIM) = QE.L(CE);

QFREP (F,A, SIM) = QF.L(F,A);

QFUREP (F, SIM) = QFU.L(F);

QHREP (C, H, SIM) = QH.L(C,H);

QINTREP (C, A, SIM) = QINT.L(C,A);

QINVREP (C, SIM) = QINV.L(C);

QMREP (CM, SIM) = QM.L(CM);

QQREP (C, SIM) = QQ.L(C);

QXREP (C, SIM) = QX.L(C);

YFREP (H, F , SIM) = YF.L(H,F);

YHREP (H, SIM) = YH.L(H);

WALRREP (SIM) = WALR.L;


\

  • CREATING AND PROCESSING THE GDP data

  • This is the equivalent of the National Income Table

GDPREP (‘PRVCON’, SIM) = SUM((C,H), PQ.L(C)*QH.L(C,H)) ;

GDPREP (‘GOVCON’, SIM) = SUM(C, PQ.L(C)*QG(C));

GDPREP (‘INVEST’, SIM) = SUM(C, PQ.L(C)*QINV.L(C));

GDPREP (‘EXP’, SIM) = SUM(C, EXR.L*PWE(C)*QE.L(C));

GDPREP (‘IMP’, SIM) = - SUM(C, EXR.L*PWM(C)*QM.L(C));

GDPREP (‘GDPFC’, SIM) = SUM((F,A), PF.L(F)*FPD.L(F,A)*QF.L(F,A));

GDPREP (‘NITAX’, SIM)

= SUM(C, tq(C)*(PD.L(C)*QD.L(C) + (PM.L(C)*QM.L(C))$CM(C)))

  • SUM(C$CM(C), tm(C)EXR.LPWM(C)*QM.L(C))

  • SUM(C$CE(C), te(C)EXR.LPWE(C)*QE.L(C));

)

;



*Processing GDP data

GDPREP(‘GDPMP1’,SIM) = SUM(ACGDP1, GDPREP(ACGDP1,SIM));

GDPREP(‘GDPMP2’,SIM) = GDPREP(‘GDPFC’,SIM) + GDPREP(‘NITAX’,SIM);

GDPREP(‘GDPGAP’,SIM) = GDPREP(‘GDPMP1’,SIM)-GDPREP(‘GDPMP2’,SIM);


\

  • SETTING THE DISPLAY FORMATIN OPTIONS

OPTION QFREP : 3 : 1: 1, QHREP:3:1:1, QINTREP:3:1:1, PFAREP:3:1:1,

PFAREP : 3 : 1 : 1, FPDREP : 3 : 1 : 1, YFREP : 3 : 1 : 1

;


\

  • DISPLAYING THE RESULTS

DISPLAY

PWEREP, BOPREP, EXRREP, FPDREP, GBSREP, IADJREP, MPSREP, PAREP, PDREP,

PEREP, PFREP, PFAREP, PMREP, PQREP, PVAREP, PXREP, QAREP, QDREP, QEREP,

QFREP, QFUREP, QHREP, QINTREP, QINVREP, QMREP, QQREP, QXREP, YFREP,

YHREP, WALRREP, GDPREP

;

thanks:)

waiting

sara


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

most of the problems in your code is due to misaligned SAM table. first correct it. headers of the columns should be inline with the numbers in the column. After that, following errors remains.

line 99: MPS(H => MPS(H) (missing paranthesis)
line 88: add CPI as variable (CPI is not added as a variable)
line 382: CPI => CPI.FX (CPI is a variable)
line 384: CPI => CPI.L (CPI is a variable)
line 676: delete 0 (unnecessary zero)

hasan


On Sat, Apr 7, 2012 at 13:50, sara sohail wrote:

$Title Generic Small Open Economy Model – “SOEM”

$STitle Version 1 with:

  • 2 goods, 2 activities, 2 households;

  • no market power in the world markets;

  • no firms amongst institutions.


    \

  • SETS ===========================================================

SETS

AC the global set including all items

  • Since there are no Firms in this exercise, they are excluded from the sets

/

AGR-A agricultural activity

NAGR-A non-agricultural activity

AGR-C agricultural commodity

NAGR-C non-agricultural commodity

LAB labour

CAP capital

U-HHD urban household

R-HHD rural household

GOV government

ROW rest of world

S-I savings-investment

YTAX income tax

STAX sales tax

TAR import tariff

TOTAL total account in SAM

/


\

  • Generating the specific sets and subsets

ACNT(AC) all elements in AC except total

A(AC) activities /AGR-A, NAGR-A/

C(AC) commodities /AGR-C, NAGR-C/

CE(C) exported commodities /AGR-C/

CNE(C) non-exported commodities /NAGR-C/

CM(C) imported commodities /NAGR-C/

CNM(C) non-imported commodities /AGR-C/

F(AC) factors /LAB, CAP/

I(AC) institutions /U-HHD, R-HHD, GOV, ROW/

H(I) households /U-HHD, R-HHD/

;


\

  • To exclude TOTAL from ACNT:

ACNT(AC) = YES;

ACNT(‘TOTAL’) = NO;

  • Alias sets to be used when we want to distinguish between two versions, e.g.

  • when summing y(F,F) over columns, we can write SUM(F y(F,FAL))

ALIAS ( AC , ACAL);

ALIAS (C, CAL);

ALIAS (F,FAL);

ALIAS (I,IAL);

ALIAS (ACNT,ACNTAL);


\

  • PARAMETERS ======================================================



    PARAMETERS



    ad(A) shift in the production fn for activity a

alpha(F,A) elasticity of factor f in the production fn for activity a

aq(C) shift parameter in CES aggregation for commodity c

ax(C) shift parameter in CES transformation for commodity c

beta(C,H) share of households total spending on commodity c

consumer price index

cwts(C) weight of commodity c in the CPI

deltaq(C) share parameter in CES aggregation for commodity c

deltax(C) share parameter in CES transformation for commodity c

ir(C,A) IO coeff: qnty of c as intermediate input per unit of activity a

INV(C) base-year qnty of investment demand for commodity c

PWE(C) export (world) price for c (foreign currency)

PWM(C) import (world) price for c (foreign currency)

QFS(F) total supply of factor f

QG(C) government demand for commodity c (in quantity)

rhoq(C) exponent parameter in the CES aggregation for commodity c

rhox(C) exponent parameter in the CES transformation for commodity c

shry(H,F) share of household i in income of factor f

te(C) export subsidy or tax rate for commodity c

theta(A,C) yield coeff: yield of output c per unit of activity a

tm(C) import tariff rate for commodity c

tq(C) sales tax rate for commodity c

TR(I,IAL) transfer from institution ial to institution i

ty(H) income tax rate for household h

;


\

  • VARIABLES =======================================================



    VARIABLES



    *FREE VARIABLES

BOP balance of payment (foreign savings) in foreign currency)

GBS government budget surplus (or deficit)

QE(C) quantity of exports for commodity c (can be import if <0)

QFU(F) excess sup. of factor f (e.g. unemployment. <0 if excess demand)

QM(C) quantity of imports of commodity c (can be export if <0)

WALR dummy variable (zero at equilibrium)



*POSITIVE VARIABLES

EXR exchange rate (dom. currency per unit of for. currency)

FPD(F,A) wage distortion factor for factor f in activity a

IADJ investment adjustment factor

MPS(H marginal (and average) propensity to save for household h

PA(A) price of activity a

PD(C) domestic price of domestic output c

PE(C) export price for c (domestic currency)

PF(F) average price of factor f

PM(C) import price for c (domestic currency)

PQ(C) composite commodity price for c

PVA(A) value-added price for activity a



PX(C) producer price for commodity c

QA(A) level of activity a

QD(C) quantity sold domestically of domestic output c

QF(F,A) quantity demanded of factor f from activity a

QH(C,H) quantity consumed of commodity c by household h

QINT(C,A) quantity of commodity c as intermediate input to activity a

QINV(C) quantity of investment demand for commodity c

QQ(C) quantity of goods supplied domestically (composite supply)

QX(C) quantity of domestic output of commodity c

YF(H,F) transfer of income to institutions i from factor f

YH(H) income of household h

;


\

  • EQUATIONS =======================================================


    \
  • EQUATION NAME ###############



    EQUATIONS


    \
  • PRICE BLOCK +++++++++++++++++++++++++++



    PMDEF(C) import price for commodity c (domestic currency)

PEDEF(C) export price for commodity c (domestic currency)

ABSORB(C) absorption for commodity c

OUTVAL(C) output value for commodity c

PADEF(A) price for activity a

PVADEF(A) value-added price for activity a

PNORM CPI and the price normalization rule


\

  • PRODUCTION AND COMMODITY BLOCK ++++++++



    PRODFN (A) Cobb-Douglas production function for activity a

FACDEM (F, A) demand for factor f by activity a

INTDEM(C , A) intermediate demand for commodity c by activity a



OUTPUTFN(C) output of commodity c

CESQ(C) CES aggregation of QD and QM into QQ

CESX(C) CES transformation of QD and QE into QX

ESUBMD(C) import-domestic demand ratio for commodity c

ESUBED(C) export-domestic supply ratio for commodity c

NMQD(C) composite version for non-imported commodity c

NEXD(C) transformation for non-exported commodity c


\

  • INSTITUTION BLOCK +++++++++++++++++++++



    FACTTRNS(H,F) transfer of income from factor f to household h

HHDINC(H) income of household h

HHDCON(C,H) consumption demand by household h for commodity c

INVDEM(C) investment demand for commodity c

GBC government budget surplus


\

  • SYSTEM CONSTRAINT BLOCK +++++++++++++++



    FACTMEQ(F) market equilibrium condition for factor f

GOODMEQ(C) market equilibrium condition for composite commodity c

BOPEQ current account balance for ROW

WALREQ savings-investment balance with WALR dummy to be zero

;


\

  • EQUATION DESCRIPTION ###############


    \
  • PRICE BLOCK +++++++++++++++++++++++++++



    PMDEF(C)$CM(C)… PM(C) =E= (1 + tm(C))EXRPWM(C);



    PEDEF(C)$CE(C)… PE(C) =E= (1-te(C))EXRPWE(C);



    ABSORB(C)… PQ(C)*QQ(C)=E= (PD(C)*QD(C) + (PM(C)QM(C))$CM(C))(1 + tq(C));



    OUTVAL(C)… PX(C)*QX(C) =E= PD(C)*QD(C) + (PE(C)*QE(C))$CE(C);



    PADEF(A)… PA(A) =E= SUM(C, PX(C)*theta(A,C));



    PVADEF(A)… PVA(A) =E= PA(A)-SUM(C, PQ(C)*ir(C,A));



    PNORM… SUM(C, PQ(C)*cwts(C)) =E= CPI;


    \
  • PRODUCTION AND COMMODITY BLOCK++++++++



    PRODFN(A)… QA(A) =E= ad(A)*PROD(F, QF(F,A)alpha(F,A));



    FACDEM(F,A)… PF(F)*FPD(F,A) =E= alpha(F,A)*PVA(A)*QA(A)/QF(F,A);



    INTDEM(C,A)… QINT(C,A) =E= ir(C,A)*QA(A);



    OUTPUTFN(C)… QX(C) =E= SUM(A, theta(A,C)QA(A));



    CESQ(C)$CM(C)… QQ(C) =E= aq(C)
    (deltaq(C)*QM(C)
    (-rhoq(C))
  • (1-deltaq(C))QD(C)(-rhoq(C)))(-1/rhoq(C));



    CESX(C)$CE(C)… QX(C) =E= ax(C)
    (deltax(C)*QE(C)**(rhox(C))

  • (1-deltax(C))*QD(C)(rhox(C)) )(1/rhox(C));



    ESUBMD(C)$CM(C)… QM(C)/QD(C) =E=

( (deltaq(C)/(1-deltaq(C))) * (PD(C)/PM(C)) )**(1/(1+rhoq(C)));



ESUBED(C)$CE(C)… QE(C)/QD(C) =E= ( PE(C)/PD(C)*(1-deltax(C))

/deltax(C) )**(1/(rhox(C)-1) );



NMQD(C)$CNM(C)… QQ(C) =E= QD(C);

NEXD(C)$CNE(C)… QX(C) =E= QD(C);


\

  • INSTITUTION BLOCK +++++++++++++++++++++



    FACTTRNS(H,F)… YF(H,F) =E= shry(H,F)*SUM(A, PF(F)*FPD(F,A)*QF(F,A));

HHDINC(H)… YH(H) =E= SUM(F, YF(H,F)) + CPITR(H,‘GOV’) + EXRTR(H,‘ROW’);



HHDCON(C,H)… QH(C,H) =E= beta(C,H)(1-MPS(H))(1-ty(H))*YH(H)/PQ(C);

INVDEM(C)… QINV(C) =E= inv(C)*IADJ;

GBC… GBS =E=

( SUM(H, ty(H)*YH(H))

  • SUM(C, tq(C)*(PD(C)*QD(C) + (PM(C)*QM(C))$CM(C)))

  • SUM(C$CM(C), tm(C)EXRPWM(C)*QM(C))

  • SUM(C$CE(C), te(C)EXRPWE(C)*QE(C))

  • EXR*TR(‘GOV’,‘ROW’)

) -( SUM(C, PQ(C)*QG(C))

  • SUM(I, CPI*TR(I,‘GOV’)$H(I))

);


\

  • SYSTEM CONSTRAINT BLOCK +++++++++++++++



    FACTMEQ(F)… SUM(A, QF(F,A)) + QFU(F) =E= QFS(F);



    GOODMEQ(C)… QQ(C) =E= SUM(A, QINT(C,A)) + SUM(H, QH(C,H))+ QG(C) + QINV(C);



    BOPEQ… BOP =E= SUM(C$CM(C), PWM(C)*QM(C))

-( SUM(C$CE(C), PWE(C)*QE(C))

  • SUM(I, TR(I,‘ROW’)$H(I))

  • TR(‘GOV’,‘ROW’)

);



WALREQ… WALR =E=

( SUM(H, MPS(H)*(1-ty(H))*YH(H))

    • YFRM
  • GBS + EXR*BOP )
  • ( SUM(C, PQ(C)*QINV(C)) );


    \
  • MODEL ===========================================================



    MODELS SOEMV1 “Small Open Economy Model Ver1” /ALL/ ;


    \

  • use hold fix to speed up the solution

  • This attribute tells GAMS whether to generate and send to the solver the

  • variables that are being held fixed by the .fx



    SOEMV1.HOLDFIXED = 1;



    *#############################################################################


    \

  • SOCIAL ACCOUNTING MATRIX =======================================



    TABLE SAM(AC,ACAL) social accounting matrix



    AGR-A NAGR-A AGR-C NAGR-C LAB CAP U-HHD R-HHD

AGR-A 0 0 279 0 0 0 0 0

NAGR-A 0 0 0 394 0 0 0 0

AGR-C 84 55 0 0 0 0 30 49

NAGR-C 50 99 0 0 0 0 165 92

LAB 72 105 0 0 0 0 0 0

CAP 73 135 0 0 0 0 0 0

U-HHD 0 0 0 0 95 125 0 0

R-HHD 0 0 0 0 82 83 0 0

GOV 0 0 0 0 0 0 0 0

ROW 0 0 0 105 0 0 0 0

YTAX 0 0 0 0 0 0 20 5

STAX 0 0 10 20 0 0 0 0

TAR 0 0 0 39 0 0 0 0

S-I 0 0 0 0 0 0 70 40




\

  •        GOV                      ROW                    YTAX      STAX                     TAR                       S-I
    

AGR-A 0 0 0 0 0 0

NAGR-A 0 0 0 0 0 0

AGR-C 13 30 0 0 0 28

NAGR-C 67 0 0 0 0 85

LAB 0 0 0 0 0 0

CAP 0 0 0 0 0 0

U-HHD 25 40 0 0 0 0

R-HHD 5 16 0 0 0 0

GOV 0 15 25 30 39 0

ROW 0 0 0 0 0 0

YTAX 0 0 0 0 0 0

STAX 0 0 0 0 0 0

TAR 0 0 0 0 0 0

S-I 1 4 0 0 0 0

;

  • GENERATING THE TOTAL COLUMN AND ROW FOR SAM

  • note the use of ALIAS SET ACNTAL



    SAM(‘TOTAL’,ACNTAL) = SUM(ACNT, SAM(ACNT,ACNTAL));



    SAM(ACNT,‘TOTAL’) = SUM(ACNTAL, SAM(ACNT,ACNTAL));


    \

  • CHECKING THE CONSISTENCY: tdiff should be zero



    PARAMETER tdiff(AC) “(column total - row total) for account AC”;



    tdiff(ACNT) = SAM(‘TOTAL’,ACNT)-SAM(ACNT,‘TOTAL’);



    DISPLAY SAM, tdiff;




    \

  • ASSIGNMENTS FOR PARAMETERS AND VARIABLES ======================


    \

  • The following parameters are used to define the initial values of variables



    PARAMETERS

EXR0, BOP0, GBS0, FPD0(F,A), IADJ0, MPS0(H), PA0(A), PD0(C), PE0(C), PF0(F),

PM0(C), PQ0(C), PVA0(A), PX0(C), QA0(A), QD0(C), QE0(C), QF0(F,A),

QFU0(F), QH0(C,H), QINT0(C,A), QINV0(C), QM0(C), QQ0(C), QX0(C), YF0(H,F),

YH0(H)

;



########## CALIBRATING THE MODEL BY FIXING INITIAL VALUES ########


\

  • QUANTITIES AND PRICES OF FACTORS ++++++++++++++++++++++++



    PARAMETERS


    \

  • the initial quantity of labour employed by activity (no. of workers)

  • for this, use:

labour(A) /AGR-A 100, NAGR-A 50/


\

  • the initial factor prices (only for calibration)

PFI(F,A)


\

  • costgap to check consistency in calibration:

  • costgap = (factor cost) - (SAM value), should = 0

costgap(F,A)

;


\

  • defining factor employment and supply

  • no factor unemployment allowed initially

QF0(‘LAB’,A) = labour(A);

QF0(‘CAP’,A) = SAM(‘CAP’,A);

QFU0(F)=0;

QFS(F) = SUM(A, QF0(F,A));


\

  • computing activity-specific factor prices

  • note that with this definition PFA for capital is set to 1

PFI(F,A) = SAM(F,A)/QF0(F,A);


\

  • computing average factor prices

PF0(F) = SUM(A, SAM(F,A))/SUM(A, QF0(F,A));

  • computing factor price distortions

FPD0(F,A) = PFI(F,A) / PF0(F);


\

  • checking the consistency of the calibration

costgap(F,A) = PF0(F)*FPD0(F,A)*QF0(F,A) - SAM(F,A);



DISPLAY PFI, PF0, QF0, QFS, QFU0, FPD0, costgap;


\

  • COMMODITY PRICES +++++++++++++++++++++++++++


    \
  • normalised initial commodity prices:

EXR0 = 1;

PA0(A) = 1;

PD0(C) = 1;

PE0(C) = 1;

PM0(C) = 1;

PX0(C) = 1;

  • sales tax rate for each good,

  • to be consistent with PQ=(1 + tq)*PD, it should be defined as

  • tq = (total sales tax)/(total sales value excluding sales tax)

tq(C) = SAM(‘STAX’,C)/(SAM(‘TAR’,C) + SAM(‘ROW’,C)

  • SUM(A, SAM(A,C))- SAM(C,‘ROW’) );



    DISPLAY tq;


    \
  • after tax sales price

PQ0(C) = (1 + tq(C))*PD0(C);


\

  • CPI normalisation

cwts(C) = SUM(H, SAM(C,H)) / SUM((CAL,H), SAM(CAL,H));

CPI = SUM(C, cwts(C)*PQ0(C));



DISPLAY cwts, CPI;


\

  • COMMODITY QUANTITIES:

  • Note that we should deflate the nominal values using the correct price

QA0(A) = SAM(‘TOTAL’,A)/PA0(A);

QD0(C) = (SUM(A, SAM(A,C)) - SAM(C,‘ROW’))/PD0(C);

QE0(C) = SAM(C,‘ROW’)/PE0(C);

QM0(C) = (SAM(‘ROW’,C) + SAM(‘TAR’,C))/PM0(C);

QQ0(C) = (SAM(‘TOTAL’,C) - SAM(C,‘ROW’))/PQ0(C);

QX0(C) = SUM(A, SAM(A,C))/PX0(C);



DISPLAY QA0, QD0, QE0, QM0, QQ0, QX0;


\

  • the value added price of each activity as

  • (value of activity a)/(quantity of activity a):

PVA0(A) = SUM(F, SAM(F,A)) / QA0(A);



DISPLAY PVA0;


\

  • IO coeff: unit intermediate input requirement by activity a by commodity c

ir(C,A) = (SAM(C,A)/PQ0(C)) / QA0(A);



DISPLAY ir;


\

  • yield coeff: amount of commodity c per unit of activity a

theta(A,C) = (SAM(A,C)/PX0(C)) / QA0(A);



DISPLAY theta;


\

  • export tax or subsidy rates

te(C) = 0;


\

  • world export prices (in foreign currency)

PWE(C) = PE0(C)/((1 + te(C))*EXR0);


\

  • import tariff rate for each good,

  • to be consistent with PM=(1 + tm)PWMEXR, it should be defined as

  • tm = (total tariff paid)/(total ex tariff import value)

tm(C)$CM(C) = SAM(‘TAR’,C)/SAM(‘ROW’,C);


\

  • world import prices

PWM(C)$CM(C) = PM0(C)/((1 + tm(C))*EXR0);



DISPLAY PWE, PWM, tm;


\

  • PRODUCTION, AGGREGATION AND TRANSFORMATION


    \
  • use by activity a of commodity c as intermediate input

QINT0(C,A) = SAM(C,A)/PQ0(C);



DISPLAY QINT0;


\

  • share & shift coefficients in the activity prod. fn.

alpha(F,A) = SAM(F,A) / SUM(FAL, SAM(FAL,A));

ad(A) = QA0(A) / PROD(F, QF0(F,A)**alpha(F,A));



DISPLAY alpha, ad;


\

  • elasticities of substitution for aGgregation & tranformation

PARAMETERS

sigmaq(C) elasticities of substitution for CES aggregation

sigmax(C) elasticities of substitution for CES tranformation

;

sigmaq(C) = 0.7;

sigmax(C) = 2.0;

  • the implied exponent coefficients in the CES functions:

rhoq(C) = 1/sigmaq(C)-1;

rhox(C) = 1/sigmax(C)+1;

DISPLAY rhoq, rhox;


\

  • share ceoff in the CES transformation equation

deltax(C)$CE(C) = 1/( 1 + ( (PD0(C)/PE0(C)) * ((QE0(C)/QD0(C))**(rhox(C)-1))));


\

  • shift ceoff in the CES transformation equation

ax(C)$CE(C) = QX0(C)/( deltax(C)*QE0(C)**(rhox(C))

  • (1-deltax(C))*QD0(C)(rhox(C)) )(1/rhox(C));



    DISPLAY deltax, ax;


    \
  • share ceoff in the CES aggregation equation

deltaq(C)$CM(C) = 1/(1 + (PD0(C)/PM0(C))*(QD0(C)/QM0(C))**(1+rhoq(C)));


\

  • shift ceoff in the CES aggregation equation

aq(C)$CM(C) = QQ0(C)/( deltaq(C)*QM0(C)**(-rhoq(C))

  • (1-deltaq(C))*QD0(C)(-rhoq(C)) )(-1/rhoq(C));



    DISPLAY deltaq, aq;


    \
  • INSTITUTION BLOCK +++++++++++++++++++++


    \
  • investment adjustment is initially =1 (no adjustment

IADJ0 = 1;


\

  • INV = the relevant SAM rows in the S-I column (properly deflated)

INV(C) = SAM(C,‘S-I’)/PQ0(C);


\

  • QINV = INV initially as IADJ0 = 1

QINV0(C) = SAM(C,‘S-I’)/PQ0(C);


\

  • household income shares from factor incomes:

shry(H,F) = SAM(H,F) / SAM(‘TOTAL’,F);


\

  • household factor income

YF0(H,F) = SAM(H,F);


\

  • household total income

YH0(H) = SAM(‘TOTAL’,H);


\

  • household income tax rate

ty(H) = SAM(‘YTAX’,H) / SAM(‘TOTAL’,H);


\

  • household propensity to save (from disposable income)

MPS0(H) = SAM(‘S-I’,H) / (SAM(‘TOTAL’,H)-SAM(‘YTAX’,H));


\

  • householhd consumption share of commodities

beta(C,H) = SAM(C,H)/SUM(CAL, SAM(CAL,H));


\

  • householhd consumption of commodities

QH0(C,H) = SAM(C,H)/PQ0(C);


\

  • government consumption of commodities

QG(C) = SAM(C,‘GOV’)/PQ0(C);


\

  • government budget surplus (revenue less expenditure, transfers, etc)

GBS0 = SAM(‘GOV’,‘TOTAL’) - (SAM(‘TOTAL’,‘GOV’) - SAM(‘S-I’,‘GOV’));


\

  • transfers to households from government

TR(H,‘GOV’) = SAM(H,‘GOV’);


\

  • transfers to institutions from abroad

TR(I,‘ROW’) = SAM(I,‘ROW’)/EXR0;




\

  • balance of payments with ROW

BOP0 = SAM(‘S-I’,‘ROW’)/EXR0;



DISPLAY INV, shry, beta, QG, TR, ty;

########## INITIALIZATION #############



BOP.L = BOP0;

EXR.L = EXR0;

FPD.L(F,A) = FPD0(F,A);

GBS.L = GBS0;

IADJ.L = IADJ0;

MPS.L(H) = MPS0(H);

PA.L(A) = PA0(A);

PD.L(C) = PD0(C);

PE.L(C) = PE0(C);

PF.L(F) = PF0(F);

PM.L(C) = PM0(C);

PQ.L(C) = PQ0(C);

PVA.L(A) = PVA0(A);

PX.L(C) = PX0(C);

QA.L(A) = QA0(A);

QD.L(C) = QD0(C);

QE.L(C) = QE0(C);

QF.L(F,A) = QF0(F,A);

QFU.L(F) = QFU0(F);

QH.L(C,H) = QH0(C,H);

QINT.L(C,A) = QINT0(C,A);

QINV.L(C) = QINV0(C);

QM.L(C) = QM0(C);

QQ.L(C) = QQ0(C);

QX.L(C) = QX0(C);

YF.L(H,F) = YF0(H,F);

YH.L(H) = YH0(H);



DISPLAY

BOP.L, EXR.L, FPD.L, GBS.L, IADJ.L, MPS.L,

PA.L, PD.L, PE.L, PF.L, PM.L, PQ.L, PVA.L, PX.L,

QA.L, QD.L, QE.L, QF.L, QFU.L, QH.L, QINT.L, QINV.L, QM.L, QQ.L, QX.L,

YF.L, YH.L

;



######### SELECTING CLOSURES ############


\

  • WE WRITE THE PROGRAMME TO GIVE A CHOICE TO THE TYPE OF CLOSURES

  • FOR EXAMPLE, WE CAN HAVE TWO POSSIBLITIES FOR LABOUR MARKET CLEARING:

  • (i) FIXED WAGE RATE AND THE LABOUR EXCESS SUPPLY ADJUSTS TO CLEAR THE MARKET

  • (i) FLEXIBLE WAGE RATE WHICH ADJUSTS TO EQUATE DEMAND & SUPPLY


    \

  • SAVINGS-INVESTMENT BEHAVIOUR +++++++++++++++++++++++++

  • Define a dummy SICLOS = 1 or 2 so that

  • if SICLOS = 1, savings is investment-driven

  • if SICLOS = 2, investment is savings-driven



    SCALAR SICLOS “savings-investment closure” /1/;



    IF(SICLOS EQ 1,

  • Investment-driven savings,

  • MPS(‘U-HHD’) is flexible, permitting savings value to adjust

IADJ.FX = IADJ0;

MPS.FX(‘R-HHD’) = MPS0(‘R-HHD’);

MPS.LO(‘U-HHD’) = -INF;

MPS.UP(‘U-HHD’) = +INF;

MPS.L(‘U-HHD’) = MPS0(‘U-HHD’);

);



IF(SICLOS EQ 2,

  • Savings-driven investment

  • IADJ is flexible, permitting investment to adjust

MPS.FX(H) = MPS0(H);

IADJ.LO = -INF;

IADJ.UP = +INF;

IADJ.L = IADJ0;

);




\

  • CAPITAL MARKETS +++++++++++++++++++++++++

  • Define a dummy CAPCLOS = 1 or 2 so that

  • if CAPCLOS = 1, capital is mobile and fully employed

  • if CAPCLOS = 2, capital is activity-specific and fully employed



    SCALAR CAPCLOS “closure for capital market” /2/;

IF(CAPCLOS EQ 1,

  • Capital is fully and mobile and fully employed, QFU(‘CAP’)=0

  • FPD(‘CAP’,A) is fixed,

  • PF(‘CAP’) adjusts to clear the market

FPD.FX(‘CAP’,A) = FPD0(‘CAP’,A);

PF.LO(‘CAP’) = -INF;

PF.UP(‘CAP’) = +INF;

PF.L(‘CAP’) = PF0(‘CAP’);

QF.LO(‘CAP’,A) = -INF;

QF.UP(‘CAP’,A) = +INF;

QF.L(‘CAP’,A) = QF0(‘CAP’,A);

QFU.L(‘CAP’)=QFU0(‘CAP’);

);



IF(CAPCLOS EQ 2,

  • Capital is activity-specific and fully employed, , QFU(‘CAP’)=0

  • PF(‘CAP’) is fixed,

  • FPD(‘CAP’,A) adjusts to clear the market

FPD.LO(‘CAP’,A) = -INF;

FPD.UP(‘CAP’,A) = +INF;

FPD.L(‘CAP’,A) = FPD0(‘CAP’,A);

PF.FX(‘CAP’) = PF0(‘CAP’);

QF.FX(‘CAP’,A) = QF0(‘CAP’,A);

QFU.L(‘CAP’)=QFU0(‘CAP’);

);




\

  • LABOUR MARKETS +++++++++++++++++++++++++

  • Define a dummy LABCLOS = 1 or 2 so that

*if LABCLOS = 1, labour is mobile and fully employed

*if LABCLOS = 2, labour is mobile and unemployed (fixed wages)



SCALAR LABCLOS “closure for labour market” /2/;



IF(LABCLOS EQ 1,

  • Labor is fully employed and mobile

  • there is no unemployed labour and QFU(‘LAB’)=0

  • FPD(‘LAB’,A) is fixed,

  • PF(‘LAB’) adjusts to clear the market

FPD.FX(‘LAB’,A) = FPD0(‘LAB’,A);

PF.LO(‘LAB’) = -INF;

PF.UP(‘LAB’) = +INF;

PF.L(‘LAB’) = PF0(‘LAB’);

QF.LO(‘LAB’,A) = -INF;

QF.UP(‘LAB’,A) = +INF;

QF.L(‘LAB’,A) = QF0(‘LAB’,A);

QFU.L(‘LAB’)=QFU0(‘LAB’);

);



IF(LABCLOS EQ 2,

  • labour is mobile

  • FPD(‘LAB’,A)*PF(‘LAB’) is fixed.

  • there is unemployed labour, QFU(‘LAB’) adjusts to clear the market

FPD.FX(‘LAB’,A) = FPD0(‘LAB’,A);

PF.FX(‘LAB’) = PF0(‘LAB’);

QF.LO(‘LAB’,A) = -INF;

QF.UP(‘LAB’,A) = +INF;

QF.L(‘LAB’,A) = QF0(‘LAB’,A);

QFU.LO(‘LAB’) = -INF;

QFU.UP(‘LAB’) = +INF;

QFU.L(‘LAB’)=QFU0(‘LAB’);

);




\

  • EXCHANGE RATE POLICY +++++++++++++++++++++++++

  • Define a dummy ROWCLOS = 1 or 2 so that

  • if ROWCLOS = 1, exchange rate is flexible ensures BOP=0

  • if ROWCLOS = 2, BOP is flexible and EXR is fixed.



    SCALAR ROWCLOS “exchange rate regime closure” /1/;



    IF(ROWCLOS EQ 1,

  • BOP is fixed.

  • A flexible exchange rate clears the current account

BOP.FX = BOP0;

EXR.LO = -INF;

EXR.UP = +INF;

EXR.L = EXR0;

0 );



IF(ROWCLOS EQ 2,

  • The exchange rate is fixed.

  • A flexible BOP is allowed

EXR.FX = EXR0;

BOP.LO = -INF;

BOP.UP = +INF;

BOP.L = BOP0;

);





DISPLAY SICLOS, CAPCLOS, LABCLOS, ROWCLOS;



######################################################


\

  • YOU CAN SOLVE THE MODEL FOR THE BASE CASE HERE BY ISSUING THE COMMAND

  • SOLVE SOEMV1 USING MCP;


    \

  • BUT THIS WOULD BE THE SAME AS THE CALIBRATED VALUES DISPLAYED ABOVE.


    \

  • BUT IT IS NICER TO SET A LOOP SOLUTION IN WHICH:

  • THE 1ST ITEM GENERATES THE BASE SOLUTION,

  • THE 2ND ITEM GENERATES THE SOLUTION FOR A GIVEN SHOCK,

  • THE 3RD ITEM GENERATES THE SOLUTION FOR ANOTHER GIVEN SHOCK, ETC.





    ######### SETTING UP FOR SIMULATING FOR BASE & SHOCKED CASES #########



    #### SETS AND PARAMETERS FOR REPORTING THE RESULTS #####



    SETS

  • CASES FOR WHICH A SOLUTION IS TO BE OBTAINED IN THE LOOP

SIM simulations

/

BASE “base simulation = calibrated values”

PWEINCR “SHOCK 1 = 25% increase in agricultural export price PWE(‘AGR-C’)”

/


\

  • SET OF VARIABLE SOLUTION VALUES TO BE DISPLAYED

ACGDP “All GDP items”

/

GDPFC GDP at factor prices

GDPGAP gap bt alternative calculations for GDP at market prices

GDPMP1 GDP at market prices (from spending side)

GDPMP2 GDP at market prices (from income side)

GOVCON government consumption

INVEST investment

EXP exports of goods and services

IMP imports of goods and services

NITAX net indirect taxes

PRVCON private consumption

/



ACGDP1(ACGDP) “components of GDP at market prices”

/

EXP exports of goods and services

GOVCON government consumption

IMP imports of goods and services

INVEST investment

PRVCON private consumption

/

;



PARAMETERS


\

  • VARIABLE VALUES TO BE USED IN SOLUTION FOR BASE & SHOCKED CASES

PWEAGRSIM(SIM) agricultural export price (just for an experiment)


\

  • VARIABLE VALUES TO BE REPORTED FOR BASE & SHOCKED CASES

PWEREP(C,SIM) export price for commodity c (value used)

BOPREP(SIM) foreign savings (foreign currency)

EXRREP(SIM) exchange rate (dom. cur. per unit of for. cur.)

FPDREP(F,A,SIM) wage distortion factor for factor f in activity a

GBSREP(SIM) government budget surplus

GDPREP(*,SIM) nominal GDP data: National Income Accounts

IADJREP(SIM) investment adjustment factor

MPSREP(H,SIM) marginal (and avg) propensity to save for household h

PAREP(A,SIM) price of activity a

PDREP(C,SIM) domestic price of domestic output c

PEREP(C,SIM) export price for c (domestic currency)

PFREP(F,SIM) average price of factor f

PFAREP(F,A,SIM) price of factor f for activity a

PMREP(C,SIM) import price for c (domestic currency)

PQREP(C,SIM) composite commodity price for c

PVAREP(A,SIM) value-added price for activity a

PXREP(C,SIM) producer price for commodity c

QAREP(A,SIM) level of activity a

QDREP(C,SIM) quantity sold domestically of domestic output c

QEREP(C,SIM) quantity of exports for commodity c

QFREP(F,A,SIM) demand for factor f from activity a

QFUREP(F,SIM) excess supply of factor f for sim

QHREP(C,H,SIM) consumption of commodity c by household h

QINTREP(C,A,SIM) qnty of commodity c as intermed. input for activity a

QINVREP(C,SIM) quantity of investment by commodity of origin c

QMREP(C,SIM) quantity of imports for commodity c

QQREP(C,SIM) quantity of composite goods supplied domestically

QXREP(C,SIM) quantity of domestic output of commodity c

YFREP(H,F,SIM) income of household h from factor f

YHREP(H,SIM) income of household h

WALRREP(SIM) dummy variable (zero at equilibrium)

;


\

  • SETTING THE BENCH & SHOCKED CASES ++++++++++++++++



    PWEAGRSIM(‘BASE’) = PWE(‘AGR-C’);

PWEAGRSIM(‘PWEINCR’) = 1.25*PWE(‘AGR-C’);



DISPLAY PWEAGRSIM;


\

  • SOLVING FOR THE BENCH & SHOCKED CASES ++++++++++++++++

  • THE LOOP BELOW RUNS OVER THE SET SIM ={BASE, PWEINCR}, AND

  • FOR EACH SOLUTION STORES THE VALUES OF THE VARIABLES AS REQUIRED



    LOOP(SIM,


    \

  • CHOOSING THE VALUE OF THE VARIABLE THAT IS SHOCKED

PWE(‘AGR-C’) = PWEAGRSIM(SIM);


\

  • SOLVING THE MODEL

SOLVE SOEMV1 USING MCP;


\

  • STORING THE SOLUTION

PWEREP (CE,SIM) = PWE(CE);

BOPREP (SIM) = BOP.L;

EXRREP (SIM) = EXR.L;

FPDREP (F, A ,SIM) = FPD.L(F,A);

GBSREP (SIM) = GBS.L;

IADJREP (SIM) = IADJ.L;

MPSREP (H, SIM) = MPS.L(H);

PAREP (A, SIM) = PA.L(A);

PDREP (C, SIM) = PD.L(C);

PEREP (CE, SIM) = PE.L(CE);

PFREP (F, SIM) = PF.L(F);

PFAREP (F,A, SIM) = PF.L(F)*FPD.L(F,A);

PMREP (CM, SIM) = PM.L(CM);

PQREP (C, SIM) = PQ.L(C);

PVAREP (A, SIM) = PVA.L(A);

PXREP (C, SIM) = PX.L(C);

QAREP (A, SIM) = QA.L(A);

QDREP (C, SIM) = QD.L(C);

QEREP (CE, SIM) = QE.L(CE);

QFREP (F,A, SIM) = QF.L(F,A);

QFUREP (F, SIM) = QFU.L(F);

QHREP (C, H, SIM) = QH.L(C,H);

QINTREP (C, A, SIM) = QINT.L(C,A);

QINVREP (C, SIM) = QINV.L(C);

QMREP (CM, SIM) = QM.L(CM);

QQREP (C, SIM) = QQ.L(C);

QXREP (C, SIM) = QX.L(C);

YFREP (H, F , SIM) = YF.L(H,F);

YHREP (H, SIM) = YH.L(H);

WALRREP (SIM) = WALR.L;


\

  • CREATING AND PROCESSING THE GDP data

  • This is the equivalent of the National Income Table

GDPREP (‘PRVCON’, SIM) = SUM((C,H), PQ.L(C)*QH.L(C,H)) ;

GDPREP (‘GOVCON’, SIM) = SUM(C, PQ.L(C)*QG(C));

GDPREP (‘INVEST’, SIM) = SUM(C, PQ.L(C)*QINV.L(C));

GDPREP (‘EXP’, SIM) = SUM(C, EXR.L*PWE(C)*QE.L(C));

GDPREP (‘IMP’, SIM) = - SUM(C, EXR.L*PWM(C)*QM.L(C));

GDPREP (‘GDPFC’, SIM) = SUM((F,A), PF.L(F)*FPD.L(F,A)*QF.L(F,A));

GDPREP (‘NITAX’, SIM)

= SUM(C, tq(C)*(PD.L(C)*QD.L(C) + (PM.L(C)*QM.L(C))$CM(C)))

  • SUM(C$CM(C), tm(C)EXR.LPWM(C)*QM.L(C))

  • SUM(C$CE(C), te(C)EXR.LPWE(C)*QE.L(C));

)

;



*Processing GDP data

GDPREP(‘GDPMP1’,SIM) = SUM(ACGDP1, GDPREP(ACGDP1,SIM));

GDPREP(‘GDPMP2’,SIM) = GDPREP(‘GDPFC’,SIM) + GDPREP(‘NITAX’,SIM);

GDPREP(‘GDPGAP’,SIM) = GDPREP(‘GDPMP1’,SIM)-GDPREP(‘GDPMP2’,SIM);


\

  • SETTING THE DISPLAY FORMATIN OPTIONS

OPTION QFREP : 3 : 1: 1, QHREP:3:1:1, QINTREP:3:1:1, PFAREP:3:1:1,

PFAREP : 3 : 1 : 1, FPDREP : 3 : 1 : 1, YFREP : 3 : 1 : 1

;


\

  • DISPLAYING THE RESULTS

DISPLAY

PWEREP, BOPREP, EXRREP, FPDREP, GBSREP, IADJREP, MPSREP, PAREP, PDREP,

PEREP, PFREP, PFAREP, PMREP, PQREP, PVAREP, PXREP, QAREP, QDREP, QEREP,

QFREP, QFUREP, QHREP, QINTREP, QINVREP, QMREP, QQREP, QXREP, YFREP,

YHREP, WALRREP, GDPREP

;

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Thank you Hasan!

I ll work on it accordingly. But you know its difficult for me to understand GAMS. Can you plese tell any link except gams.com to learn GAMS coding easily. I have a few but may be you can recommend something better.

Regards,

Sara

On Tue, Apr 10, 2012 at 1:10 AM, Hasan Dudu wrote:

most of the problems in your code is due to misaligned SAM table. first correct it. headers of the columns should be inline with the numbers in the column. After that, following errors remains.

line 99: MPS(H => MPS(H) (missing paranthesis)
line 88: add CPI as variable (CPI is not added as a variable)
line 382: CPI => CPI.FX (CPI is a variable)
line 384: CPI => CPI.L (CPI is a variable)
line 676: delete 0 (unnecessary zero)

hasan


On Sat, Apr 7, 2012 at 13:50, sara sohail wrote:

$Title Generic Small Open Economy Model – “SOEM”

$STitle Version 1 with:

  • 2 goods, 2 activities, 2 households;

  • no market power in the world markets;

  • no firms amongst institutions.


    \

  • SETS ===========================================================

SETS

AC the global set including all items

  • Since there are no Firms in this exercise, they are excluded from the sets

/

AGR-A agricultural activity

NAGR-A non-agricultural activity

AGR-C agricultural commodity

NAGR-C non-agricultural commodity

LAB labour

CAP capital

U-HHD urban household

R-HHD rural household

GOV government

ROW rest of world

S-I savings-investment

YTAX income tax

STAX sales tax

TAR import tariff

TOTAL total account in SAM

/


\

  • Generating the specific sets and subsets

ACNT(AC) all elements in AC except total

A(AC) activities /AGR-A, NAGR-A/

C(AC) commodities /AGR-C, NAGR-C/

CE(C) exported commodities /AGR-C/

CNE(C) non-exported commodities /NAGR-C/

CM(C) imported commodities /NAGR-C/

CNM(C) non-imported commodities /AGR-C/

F(AC) factors /LAB, CAP/

I(AC) institutions /U-HHD, R-HHD, GOV, ROW/

H(I) households /U-HHD, R-HHD/

;


\

  • To exclude TOTAL from ACNT:

ACNT(AC) = YES;

ACNT(‘TOTAL’) = NO;

  • Alias sets to be used when we want to distinguish between two versions, e.g.

  • when summing y(F,F) over columns, we can write SUM(F y(F,FAL))

ALIAS ( AC , ACAL);

ALIAS (C, CAL);

ALIAS (F,FAL);

ALIAS (I,IAL);

ALIAS (ACNT,ACNTAL);


\

  • PARAMETERS ======================================================



    PARAMETERS



    ad(A) shift in the production fn for activity a

alpha(F,A) elasticity of factor f in the production fn for activity a

aq(C) shift parameter in CES aggregation for commodity c

ax(C) shift parameter in CES transformation for commodity c

beta(C,H) share of households total spending on commodity c

consumer price index

cwts(C) weight of commodity c in the CPI

deltaq(C) share parameter in CES aggregation for commodity c

deltax(C) share parameter in CES transformation for commodity c

ir(C,A) IO coeff: qnty of c as intermediate input per unit of activity a

INV(C) base-year qnty of investment demand for commodity c

PWE(C) export (world) price for c (foreign currency)

PWM(C) import (world) price for c (foreign currency)

QFS(F) total supply of factor f

QG(C) government demand for commodity c (in quantity)

rhoq(C) exponent parameter in the CES aggregation for commodity c

rhox(C) exponent parameter in the CES transformation for commodity c

shry(H,F) share of household i in income of factor f

te(C) export subsidy or tax rate for commodity c

theta(A,C) yield coeff: yield of output c per unit of activity a

tm(C) import tariff rate for commodity c

tq(C) sales tax rate for commodity c

TR(I,IAL) transfer from institution ial to institution i

ty(H) income tax rate for household h

;


\

  • VARIABLES =======================================================



    VARIABLES



    *FREE VARIABLES

BOP balance of payment (foreign savings) in foreign currency)

GBS government budget surplus (or deficit)

QE(C) quantity of exports for commodity c (can be import if <0)

QFU(F) excess sup. of factor f (e.g. unemployment. <0 if excess demand)

QM(C) quantity of imports of commodity c (can be export if <0)

WALR dummy variable (zero at equilibrium)



*POSITIVE VARIABLES

EXR exchange rate (dom. currency per unit of for. currency)

FPD(F,A) wage distortion factor for factor f in activity a

IADJ investment adjustment factor

MPS(H marginal (and average) propensity to save for household h

PA(A) price of activity a

PD(C) domestic price of domestic output c

PE(C) export price for c (domestic currency)

PF(F) average price of factor f

PM(C) import price for c (domestic currency)

PQ(C) composite commodity price for c

PVA(A) value-added price for activity a



PX(C) producer price for commodity c

QA(A) level of activity a

QD(C) quantity sold domestically of domestic output c

QF(F,A) quantity demanded of factor f from activity a

QH(C,H) quantity consumed of commodity c by household h

QINT(C,A) quantity of commodity c as intermediate input to activity a

QINV(C) quantity of investment demand for commodity c

QQ(C) quantity of goods supplied domestically (composite supply)

QX(C) quantity of domestic output of commodity c

YF(H,F) transfer of income to institutions i from factor f

YH(H) income of household h

;


\

  • EQUATIONS =======================================================


    \
  • EQUATION NAME ###############



    EQUATIONS


    \
  • PRICE BLOCK +++++++++++++++++++++++++++



    PMDEF(C) import price for commodity c (domestic currency)

PEDEF(C) export price for commodity c (domestic currency)

ABSORB(C) absorption for commodity c

OUTVAL(C) output value for commodity c

PADEF(A) price for activity a

PVADEF(A) value-added price for activity a

PNORM CPI and the price normalization rule


\

  • PRODUCTION AND COMMODITY BLOCK ++++++++



    PRODFN (A) Cobb-Douglas production function for activity a

FACDEM (F, A) demand for factor f by activity a

INTDEM(C , A) intermediate demand for commodity c by activity a



OUTPUTFN(C) output of commodity c

CESQ(C) CES aggregation of QD and QM into QQ

CESX(C) CES transformation of QD and QE into QX

ESUBMD(C) import-domestic demand ratio for commodity c

ESUBED(C) export-domestic supply ratio for commodity c

NMQD(C) composite version for non-imported commodity c

NEXD(C) transformation for non-exported commodity c


\

  • INSTITUTION BLOCK +++++++++++++++++++++



    FACTTRNS(H,F) transfer of income from factor f to household h

HHDINC(H) income of household h

HHDCON(C,H) consumption demand by household h for commodity c

INVDEM(C) investment demand for commodity c

GBC government budget surplus


\

  • SYSTEM CONSTRAINT BLOCK +++++++++++++++



    FACTMEQ(F) market equilibrium condition for factor f

GOODMEQ(C) market equilibrium condition for composite commodity c

BOPEQ current account balance for ROW

WALREQ savings-investment balance with WALR dummy to be zero

;


\

  • EQUATION DESCRIPTION ###############


    \
  • PRICE BLOCK +++++++++++++++++++++++++++



    PMDEF(C)$CM(C)… PM(C) =E= (1 + tm(C))EXRPWM(C);



    PEDEF(C)$CE(C)… PE(C) =E= (1-te(C))EXRPWE(C);



    ABSORB(C)… PQ(C)*QQ(C)=E= (PD(C)*QD(C) + (PM(C)QM(C))$CM(C))(1 + tq(C));



    OUTVAL(C)… PX(C)*QX(C) =E= PD(C)*QD(C) + (PE(C)*QE(C))$CE(C);



    PADEF(A)… PA(A) =E= SUM(C, PX(C)*theta(A,C));



    PVADEF(A)… PVA(A) =E= PA(A)-SUM(C, PQ(C)*ir(C,A));



    PNORM… SUM(C, PQ(C)*cwts(C)) =E= CPI;


    \
  • PRODUCTION AND COMMODITY BLOCK++++++++



    PRODFN(A)… QA(A) =E= ad(A)*PROD(F, QF(F,A)alpha(F,A));



    FACDEM(F,A)… PF(F)*FPD(F,A) =E= alpha(F,A)*PVA(A)*QA(A)/QF(F,A);



    INTDEM(C,A)… QINT(C,A) =E= ir(C,A)*QA(A);



    OUTPUTFN(C)… QX(C) =E= SUM(A, theta(A,C)QA(A));



    CESQ(C)$CM(C)… QQ(C) =E= aq(C)
    (deltaq(C)*QM(C)
    (-rhoq(C))
  • (1-deltaq(C))QD(C)(-rhoq(C)))(-1/rhoq(C));



    CESX(C)$CE(C)… QX(C) =E= ax(C)
    (deltax(C)*QE(C)**(rhox(C))

  • (1-deltax(C))*QD(C)(rhox(C)) )(1/rhox(C));



    ESUBMD(C)$CM(C)… QM(C)/QD(C) =E=

( (deltaq(C)/(1-deltaq(C))) * (PD(C)/PM(C)) )**(1/(1+rhoq(C)));



ESUBED(C)$CE(C)… QE(C)/QD(C) =E= ( PE(C)/PD(C)*(1-deltax(C))

/deltax(C) )**(1/(rhox(C)-1) );



NMQD(C)$CNM(C)… QQ(C) =E= QD(C);

NEXD(C)$CNE(C)… QX(C) =E= QD(C);


\

  • INSTITUTION BLOCK +++++++++++++++++++++



    FACTTRNS(H,F)… YF(H,F) =E= shry(H,F)*SUM(A, PF(F)*FPD(F,A)*QF(F,A));

HHDINC(H)… YH(H) =E= SUM(F, YF(H,F)) + CPITR(H,‘GOV’) + EXRTR(H,‘ROW’);



HHDCON(C,H)… QH(C,H) =E= beta(C,H)(1-MPS(H))(1-ty(H))*YH(H)/PQ(C);

INVDEM(C)… QINV(C) =E= inv(C)*IADJ;

GBC… GBS =E=

( SUM(H, ty(H)*YH(H))

  • SUM(C, tq(C)*(PD(C)*QD(C) + (PM(C)*QM(C))$CM(C)))

  • SUM(C$CM(C), tm(C)EXRPWM(C)*QM(C))

  • SUM(C$CE(C), te(C)EXRPWE(C)*QE(C))

  • EXR*TR(‘GOV’,‘ROW’)

) -( SUM(C, PQ(C)*QG(C))

  • SUM(I, CPI*TR(I,‘GOV’)$H(I))

);


\

  • SYSTEM CONSTRAINT BLOCK +++++++++++++++



    FACTMEQ(F)… SUM(A, QF(F,A)) + QFU(F) =E= QFS(F);



    GOODMEQ(C)… QQ(C) =E= SUM(A, QINT(C,A)) + SUM(H, QH(C,H))+ QG(C) + QINV(C);



    BOPEQ… BOP =E= SUM(C$CM(C), PWM(C)*QM(C))

-( SUM(C$CE(C), PWE(C)*QE(C))

  • SUM(I, TR(I,‘ROW’)$H(I))

  • TR(‘GOV’,‘ROW’)

);



WALREQ… WALR =E=

( SUM(H, MPS(H)*(1-ty(H))*YH(H))

    • YFRM
  • GBS + EXR*BOP )
  • ( SUM(C, PQ(C)*QINV(C)) );


    \
  • MODEL ===========================================================



    MODELS SOEMV1 “Small Open Economy Model Ver1” /ALL/ ;


    \

  • use hold fix to speed up the solution

  • This attribute tells GAMS whether to generate and send to the solver the

  • variables that are being held fixed by the .fx



    SOEMV1.HOLDFIXED = 1;



    *#############################################################################


    \

  • SOCIAL ACCOUNTING MATRIX =======================================



    TABLE SAM(AC,ACAL) social accounting matrix



    AGR-A NAGR-A AGR-C NAGR-C LAB CAP U-HHD R-HHD

AGR-A 0 0 279 0 0 0 0 0

NAGR-A 0 0 0 394 0 0 0 0

AGR-C 84 55 0 0 0 0 30 49

NAGR-C 50 99 0 0 0 0 165 92

LAB 72 105 0 0 0 0 0 0

CAP 73 135 0 0 0 0 0 0

U-HHD 0 0 0 0 95 125 0 0

R-HHD 0 0 0 0 82 83 0 0

GOV 0 0 0 0 0 0 0 0

ROW 0 0 0 105 0 0 0 0

YTAX 0 0 0 0 0 0 20 5

STAX 0 0 10 20 0 0 0 0

TAR 0 0 0 39 0 0 0 0

S-I 0 0 0 0 0 0 70 40




\

  •        GOV                      ROW                    YTAX      STAX                     TAR                       S-I
    

AGR-A 0 0 0 0 0 0

NAGR-A 0 0 0 0 0 0

AGR-C 13 30 0 0 0 28

NAGR-C 67 0 0 0 0 85

LAB 0 0 0 0 0 0

CAP 0 0 0 0 0 0

U-HHD 25 40 0 0 0 0

R-HHD 5 16 0 0 0 0

GOV 0 15 25 30 39 0

ROW 0 0 0 0 0 0

YTAX 0 0 0 0 0 0

STAX 0 0 0 0 0 0

TAR 0 0 0 0 0 0

S-I 1 4 0 0 0 0

;

  • GENERATING THE TOTAL COLUMN AND ROW FOR SAM

  • note the use of ALIAS SET ACNTAL



    SAM(‘TOTAL’,ACNTAL) = SUM(ACNT, SAM(ACNT,ACNTAL));



    SAM(ACNT,‘TOTAL’) = SUM(ACNTAL, SAM(ACNT,ACNTAL));


    \

  • CHECKING THE CONSISTENCY: tdiff should be zero



    PARAMETER tdiff(AC) “(column total - row total) for account AC”;



    tdiff(ACNT) = SAM(‘TOTAL’,ACNT)-SAM(ACNT,‘TOTAL’);



    DISPLAY SAM, tdiff;




    \

  • ASSIGNMENTS FOR PARAMETERS AND VARIABLES ======================


    \

  • The following parameters are used to define the initial values of variables



    PARAMETERS

EXR0, BOP0, GBS0, FPD0(F,A), IADJ0, MPS0(H), PA0(A), PD0(C), PE0(C), PF0(F),

PM0(C), PQ0(C), PVA0(A), PX0(C), QA0(A), QD0(C), QE0(C), QF0(F,A),

QFU0(F), QH0(C,H), QINT0(C,A), QINV0(C), QM0(C), QQ0(C), QX0(C), YF0(H,F),

YH0(H)

;



########## CALIBRATING THE MODEL BY FIXING INITIAL VALUES ########


\

  • QUANTITIES AND PRICES OF FACTORS ++++++++++++++++++++++++



    PARAMETERS


    \

  • the initial quantity of labour employed by activity (no. of workers)

  • for this, use:

labour(A) /AGR-A 100, NAGR-A 50/


\

  • the initial factor prices (only for calibration)

PFI(F,A)


\

  • costgap to check consistency in calibration:

  • costgap = (factor cost) - (SAM value), should = 0

costgap(F,A)

;


\

  • defining factor employment and supply

  • no factor unemployment allowed initially

QF0(‘LAB’,A) = labour(A);

QF0(‘CAP’,A) = SAM(‘CAP’,A);

QFU0(F)=0;

QFS(F) = SUM(A, QF0(F,A));


\

  • computing activity-specific factor prices

  • note that with this definition PFA for capital is set to 1

PFI(F,A) = SAM(F,A)/QF0(F,A);


\

  • computing average factor prices

PF0(F) = SUM(A, SAM(F,A))/SUM(A, QF0(F,A));

  • computing factor price distortions

FPD0(F,A) = PFI(F,A) / PF0(F);


\

  • checking the consistency of the calibration

costgap(F,A) = PF0(F)*FPD0(F,A)*QF0(F,A) - SAM(F,A);



DISPLAY PFI, PF0, QF0, QFS, QFU0, FPD0, costgap;


\

  • COMMODITY PRICES +++++++++++++++++++++++++++


    \
  • normalised initial commodity prices:

EXR0 = 1;

PA0(A) = 1;

PD0(C) = 1;

PE0(C) = 1;

PM0(C) = 1;

PX0(C) = 1;

  • sales tax rate for each good,

  • to be consistent with PQ=(1 + tq)*PD, it should be defined as

  • tq = (total sales tax)/(total sales value excluding sales tax)

tq(C) = SAM(‘STAX’,C)/(SAM(‘TAR’,C) + SAM(‘ROW’,C)

  • SUM(A, SAM(A,C))- SAM(C,‘ROW’) );



    DISPLAY tq;


    \
  • after tax sales price

PQ0(C) = (1 + tq(C))*PD0(C);


\

  • CPI normalisation

cwts(C) = SUM(H, SAM(C,H)) / SUM((CAL,H), SAM(CAL,H));

CPI = SUM(C, cwts(C)*PQ0(C));



DISPLAY cwts, CPI;


\

  • COMMODITY QUANTITIES:

  • Note that we should deflate the nominal values using the correct price

QA0(A) = SAM(‘TOTAL’,A)/PA0(A);

QD0(C) = (SUM(A, SAM(A,C)) - SAM(C,‘ROW’))/PD0(C);

QE0(C) = SAM(C,‘ROW’)/PE0(C);

QM0(C) = (SAM(‘ROW’,C) + SAM(‘TAR’,C))/PM0(C);

QQ0(C) = (SAM(‘TOTAL’,C) - SAM(C,‘ROW’))/PQ0(C);

QX0(C) = SUM(A, SAM(A,C))/PX0(C);



DISPLAY QA0, QD0, QE0, QM0, QQ0, QX0;


\

  • the value added price of each activity as

  • (value of activity a)/(quantity of activity a):

PVA0(A) = SUM(F, SAM(F,A)) / QA0(A);



DISPLAY PVA0;


\

  • IO coeff: unit intermediate input requirement by activity a by commodity c

ir(C,A) = (SAM(C,A)/PQ0(C)) / QA0(A);



DISPLAY ir;


\

  • yield coeff: amount of commodity c per unit of activity a

theta(A,C) = (SAM(A,C)/PX0(C)) / QA0(A);



DISPLAY theta;


\

  • export tax or subsidy rates

te(C) = 0;


\

  • world export prices (in foreign currency)

PWE(C) = PE0(C)/((1 + te(C))*EXR0);


\

  • import tariff rate for each good,

  • to be consistent with PM=(1 + tm)PWMEXR, it should be defined as

  • tm = (total tariff paid)/(total ex tariff import value)

tm(C)$CM(C) = SAM(‘TAR’,C)/SAM(‘ROW’,C);


\

  • world import prices

PWM(C)$CM(C) = PM0(C)/((1 + tm(C))*EXR0);



DISPLAY PWE, PWM, tm;


\

  • PRODUCTION, AGGREGATION AND TRANSFORMATION


    \
  • use by activity a of commodity c as intermediate input

QINT0(C,A) = SAM(C,A)/PQ0(C);



DISPLAY QINT0;


\

  • share & shift coefficients in the activity prod. fn.

alpha(F,A) = SAM(F,A) / SUM(FAL, SAM(FAL,A));

ad(A) = QA0(A) / PROD(F, QF0(F,A)**alpha(F,A));



DISPLAY alpha, ad;


\

  • elasticities of substitution for aGgregation & tranformation

PARAMETERS

sigmaq(C) elasticities of substitution for CES aggregation

sigmax(C) elasticities of substitution for CES tranformation

;

sigmaq(C) = 0.7;

sigmax(C) = 2.0;

  • the implied exponent coefficients in the CES functions:

rhoq(C) = 1/sigmaq(C)-1;

rhox(C) = 1/sigmax(C)+1;

DISPLAY rhoq, rhox;


\

  • share ceoff in the CES transformation equation

deltax(C)$CE(C) = 1/( 1 + ( (PD0(C)/PE0(C)) * ((QE0(C)/QD0(C))**(rhox(C)-1))));


\

  • shift ceoff in the CES transformation equation

ax(C)$CE(C) = QX0(C)/( deltax(C)*QE0(C)**(rhox(C))

  • (1-deltax(C))*QD0(C)(rhox(C)) )(1/rhox(C));



    DISPLAY deltax, ax;


    \
  • share ceoff in the CES aggregation equation

deltaq(C)$CM(C) = 1/(1 + (PD0(C)/PM0(C))*(QD0(C)/QM0(C))**(1+rhoq(C)));


\

  • shift ceoff in the CES aggregation equation

aq(C)$CM(C) = QQ0(C)/( deltaq(C)*QM0(C)**(-rhoq(C))

  • (1-deltaq(C))*QD0(C)(-rhoq(C)) )(-1/rhoq(C));



    DISPLAY deltaq, aq;


    \
  • INSTITUTION BLOCK +++++++++++++++++++++


    \
  • investment adjustment is initially =1 (no adjustment

IADJ0 = 1;


\

  • INV = the relevant SAM rows in the S-I column (properly deflated)

INV(C) = SAM(C,‘S-I’)/PQ0(C);


\

  • QINV = INV initially as IADJ0 = 1

QINV0(C) = SAM(C,‘S-I’)/PQ0(C);


\

  • household income shares from factor incomes:

shry(H,F) = SAM(H,F) / SAM(‘TOTAL’,F);


\

  • household factor income

YF0(H,F) = SAM(H,F);


\

  • household total income

YH0(H) = SAM(‘TOTAL’,H);


\

  • household income tax rate

ty(H) = SAM(‘YTAX’,H) / SAM(‘TOTAL’,H);


\

  • household propensity to save (from disposable income)

MPS0(H) = SAM(‘S-I’,H) / (SAM(‘TOTAL’,H)-SAM(‘YTAX’,H));


\

  • householhd consumption share of commodities

beta(C,H) = SAM(C,H)/SUM(CAL, SAM(CAL,H));


\

  • householhd consumption of commodities

QH0(C,H) = SAM(C,H)/PQ0(C);


\

  • government consumption of commodities

QG(C) = SAM(C,‘GOV’)/PQ0(C);


\

  • government budget surplus (revenue less expenditure, transfers, etc)

GBS0 = SAM(‘GOV’,‘TOTAL’) - (SAM(‘TOTAL’,‘GOV’) - SAM(‘S-I’,‘GOV’));


\

  • transfers to households from government

TR(H,‘GOV’) = SAM(H,‘GOV’);


\

  • transfers to institutions from abroad

TR(I,‘ROW’) = SAM(I,‘ROW’)/EXR0;




\

  • balance of payments with ROW

BOP0 = SAM(‘S-I’,‘ROW’)/EXR0;



DISPLAY INV, shry, beta, QG, TR, ty;

########## INITIALIZATION #############



BOP.L = BOP0;

EXR.L = EXR0;

FPD.L(F,A) = FPD0(F,A);

GBS.L = GBS0;

IADJ.L = IADJ0;

MPS.L(H) = MPS0(H);

PA.L(A) = PA0(A);

PD.L(C) = PD0(C);

PE.L(C) = PE0(C);

PF.L(F) = PF0(F);

PM.L(C) = PM0(C);

PQ.L(C) = PQ0(C);

PVA.L(A) = PVA0(A);

PX.L(C) = PX0(C);

QA.L(A) = QA0(A);

QD.L(C) = QD0(C);

QE.L(C) = QE0(C);

QF.L(F,A) = QF0(F,A);

QFU.L(F) = QFU0(F);

QH.L(C,H) = QH0(C,H);

QINT.L(C,A) = QINT0(C,A);

QINV.L(C) = QINV0(C);

QM.L(C) = QM0(C);

QQ.L(C) = QQ0(C);

QX.L(C) = QX0(C);

YF.L(H,F) = YF0(H,F);

YH.L(H) = YH0(H);



DISPLAY

BOP.L, EXR.L, FPD.L, GBS.L, IADJ.L, MPS.L,

PA.L, PD.L, PE.L, PF.L, PM.L, PQ.L, PVA.L, PX.L,

QA.L, QD.L, QE.L, QF.L, QFU.L, QH.L, QINT.L, QINV.L, QM.L, QQ.L, QX.L,

YF.L, YH.L

;



######### SELECTING CLOSURES ############


\

  • WE WRITE THE PROGRAMME TO GIVE A CHOICE TO THE TYPE OF CLOSURES

  • FOR EXAMPLE, WE CAN HAVE TWO POSSIBLITIES FOR LABOUR MARKET CLEARING:

  • (i) FIXED WAGE RATE AND THE LABOUR EXCESS SUPPLY ADJUSTS TO CLEAR THE MARKET

  • (i) FLEXIBLE WAGE RATE WHICH ADJUSTS TO EQUATE DEMAND & SUPPLY


    \

  • SAVINGS-INVESTMENT BEHAVIOUR +++++++++++++++++++++++++

  • Define a dummy SICLOS = 1 or 2 so that

  • if SICLOS = 1, savings is investment-driven

  • if SICLOS = 2, investment is savings-driven



    SCALAR SICLOS “savings-investment closure” /1/;



    IF(SICLOS EQ 1,

  • Investment-driven savings,

  • MPS(‘U-HHD’) is flexible, permitting savings value to adjust

IADJ.FX = IADJ0;

MPS.FX(‘R-HHD’) = MPS0(‘R-HHD’);

MPS.LO(‘U-HHD’) = -INF;

MPS.UP(‘U-HHD’) = +INF;

MPS.L(‘U-HHD’) = MPS0(‘U-HHD’);

);



IF(SICLOS EQ 2,

  • Savings-driven investment

  • IADJ is flexible, permitting investment to adjust

MPS.FX(H) = MPS0(H);

IADJ.LO = -INF;

IADJ.UP = +INF;

IADJ.L = IADJ0;

);




\

  • CAPITAL MARKETS +++++++++++++++++++++++++

  • Define a dummy CAPCLOS = 1 or 2 so that

  • if CAPCLOS = 1, capital is mobile and fully employed

  • if CAPCLOS = 2, capital is activity-specific and fully employed



    SCALAR CAPCLOS “closure for capital market” /2/;

IF(CAPCLOS EQ 1,

  • Capital is fully and mobile and fully employed, QFU(‘CAP’)=0

  • FPD(‘CAP’,A) is fixed,

  • PF(‘CAP’) adjusts to clear the market

FPD.FX(‘CAP’,A) = FPD0(‘CAP’,A);

PF.LO(‘CAP’) = -INF;

PF.UP(‘CAP’) = +INF;

PF.L(‘CAP’) = PF0(‘CAP’);

QF.LO(‘CAP’,A) = -INF;

QF.UP(‘CAP’,A) = +INF;

QF.L(‘CAP’,A) = QF0(‘CAP’,A);

QFU.L(‘CAP’)=QFU0(‘CAP’);

);



IF(CAPCLOS EQ 2,

  • Capital is activity-specific and fully employed, , QFU(‘CAP’)=0

  • PF(‘CAP’) is fixed,

  • FPD(‘CAP’,A) adjusts to clear the market

FPD.LO(‘CAP’,A) = -INF;

FPD.UP(‘CAP’,A) = +INF;

FPD.L(‘CAP’,A) = FPD0(‘CAP’,A);

PF.FX(‘CAP’) = PF0(‘CAP’);

QF.FX(‘CAP’,A) = QF0(‘CAP’,A);

QFU.L(‘CAP’)=QFU0(‘CAP’);

);




\

  • LABOUR MARKETS +++++++++++++++++++++++++

  • Define a dummy LABCLOS = 1 or 2 so that

*if LABCLOS = 1, labour is mobile and fully employed

*if LABCLOS = 2, labour is mobile and unemployed (fixed wages)



SCALAR LABCLOS “closure for labour market” /2/;



IF(LABCLOS EQ 1,

  • Labor is fully employed and mobile

  • there is no unemployed labour and QFU(‘LAB’)=0

  • FPD(‘LAB’,A) is fixed,

  • PF(‘LAB’) adjusts to clear the market

FPD.FX(‘LAB’,A) = FPD0(‘LAB’,A);

PF.LO(‘LAB’) = -INF;

PF.UP(‘LAB’) = +INF;

PF.L(‘LAB’) = PF0(‘LAB’);

QF.LO(‘LAB’,A) = -INF;

QF.UP(‘LAB’,A) = +INF;

QF.L(‘LAB’,A) = QF0(‘LAB’,A);

QFU.L(‘LAB’)=QFU0(‘LAB’);

);



IF(LABCLOS EQ 2,

  • labour is mobile

  • FPD(‘LAB’,A)*PF(‘LAB’) is fixed.

  • there is unemployed labour, QFU(‘LAB’) adjusts to clear the market

FPD.FX(‘LAB’,A) = FPD0(‘LAB’,A);

PF.FX(‘LAB’) = PF0(‘LAB’);

QF.LO(‘LAB’,A) = -INF;

QF.UP(‘LAB’,A) = +INF;

QF.L(‘LAB’,A) = QF0(‘LAB’,A);

QFU.LO(‘LAB’) = -INF;

QFU.UP(‘LAB’) = +INF;

QFU.L(‘LAB’)=QFU0(‘LAB’);

);




\

  • EXCHANGE RATE POLICY +++++++++++++++++++++++++

  • Define a dummy ROWCLOS = 1 or 2 so that

  • if ROWCLOS = 1, exchange rate is flexible ensures BOP=0

  • if ROWCLOS = 2, BOP is flexible and EXR is fixed.



    SCALAR ROWCLOS “exchange rate regime closure” /1/;



    IF(ROWCLOS EQ 1,

  • BOP is fixed.

  • A flexible exchange rate clears the current account

BOP.FX = BOP0;

EXR.LO = -INF;

EXR.UP = +INF;

EXR.L = EXR0;

0 );



IF(ROWCLOS EQ 2,

  • The exchange rate is fixed.

  • A flexible BOP is allowed

EXR.FX = EXR0;

BOP.LO = -INF;

BOP.UP = +INF;

BOP.L = BOP0;

);





DISPLAY SICLOS, CAPCLOS, LABCLOS, ROWCLOS;



######################################################


\

  • YOU CAN SOLVE THE MODEL FOR THE BASE CASE HERE BY ISSUING THE COMMAND

  • SOLVE SOEMV1 USING MCP;


    \

  • BUT THIS WOULD BE THE SAME AS THE CALIBRATED VALUES DISPLAYED ABOVE.


    \

  • BUT IT IS NICER TO SET A LOOP SOLUTION IN WHICH:

  • THE 1ST ITEM GENERATES THE BASE SOLUTION,

  • THE 2ND ITEM GENERATES THE SOLUTION FOR A GIVEN SHOCK,

  • THE 3RD ITEM GENERATES THE SOLUTION FOR ANOTHER GIVEN SHOCK, ETC.





    ######### SETTING UP FOR SIMULATING FOR BASE & SHOCKED CASES #########



    #### SETS AND PARAMETERS FOR REPORTING THE RESULTS #####



    SETS

  • CASES FOR WHICH A SOLUTION IS TO BE OBTAINED IN THE LOOP

SIM simulations

/

BASE “base simulation = calibrated values”

PWEINCR “SHOCK 1 = 25% increase in agricultural export price PWE(‘AGR-C’)”

/


\

  • SET OF VARIABLE SOLUTION VALUES TO BE DISPLAYED

ACGDP “All GDP items”

/

GDPFC GDP at factor prices

GDPGAP gap bt alternative calculations for GDP at market prices

GDPMP1 GDP at market prices (from spending side)

GDPMP2 GDP at market prices (from income side)

GOVCON government consumption

INVEST investment

EXP exports of goods and services

IMP imports of goods and services

NITAX net indirect taxes

PRVCON private consumption

/



ACGDP1(ACGDP) “components of GDP at market prices”

/

EXP exports of goods and services

GOVCON government consumption

IMP imports of goods and services

INVEST investment

PRVCON private consumption

/

;



PARAMETERS


\

  • VARIABLE VALUES TO BE USED IN SOLUTION FOR BASE & SHOCKED CASES

PWEAGRSIM(SIM) agricultural export price (just for an experiment)


\

  • VARIABLE VALUES TO BE REPORTED FOR BASE & SHOCKED CASES

PWEREP(C,SIM) export price for commodity c (value used)

BOPREP(SIM) foreign savings (foreign currency)

EXRREP(SIM) exchange rate (dom. cur. per unit of for. cur.)

FPDREP(F,A,SIM) wage distortion factor for factor f in activity a

GBSREP(SIM) government budget surplus

GDPREP(*,SIM) nominal GDP data: National Income Accounts

IADJREP(SIM) investment adjustment factor

MPSREP(H,SIM) marginal (and avg) propensity to save for household h

PAREP(A,SIM) price of activity a

PDREP(C,SIM) domestic price of domestic output c

PEREP(C,SIM) export price for c (domestic currency)

PFREP(F,SIM) average price of factor f

PFAREP(F,A,SIM) price of factor f for activity a

PMREP(C,SIM) import price for c (domestic currency)

PQREP(C,SIM) composite commodity price for c

PVAREP(A,SIM) value-added price for activity a

PXREP(C,SIM) producer price for commodity c

QAREP(A,SIM) level of activity a

QDREP(C,SIM) quantity sold domestically of domestic output c

QEREP(C,SIM) quantity of exports for commodity c

QFREP(F,A,SIM) demand for factor f from activity a

QFUREP(F,SIM) excess supply of factor f for sim

QHREP(C,H,SIM) consumption of commodity c by household h

QINTREP(C,A,SIM) qnty of commodity c as intermed. input for activity a

QINVREP(C,SIM) quantity of investment by commodity of origin c

QMREP(C,SIM) quantity of imports for commodity c

QQREP(C,SIM) quantity of composite goods supplied domestically

QXREP(C,SIM) quantity of domestic output of commodity c

YFREP(H,F,SIM) income of household h from factor f

YHREP(H,SIM) income of household h

WALRREP(SIM) dummy variable (zero at equilibrium)

;


\

  • SETTING THE BENCH & SHOCKED CASES ++++++++++++++++



    PWEAGRSIM(‘BASE’) = PWE(‘AGR-C’);

PWEAGRSIM(‘PWEINCR’) = 1.25*PWE(‘AGR-C’);



DISPLAY PWEAGRSIM;


\

  • SOLVING FOR THE BENCH & SHOCKED CASES ++++++++++++++++

  • THE LOOP BELOW RUNS OVER THE SET SIM ={BASE, PWEINCR}, AND

  • FOR EACH SOLUTION STORES THE VALUES OF THE VARIABLES AS REQUIRED



    LOOP(SIM,


    \

  • CHOOSING THE VALUE OF THE VARIABLE THAT IS SHOCKED

PWE(‘AGR-C’) = PWEAGRSIM(SIM);


\

  • SOLVING THE MODEL

SOLVE SOEMV1 USING MCP;


\

  • STORING THE SOLUTION

PWEREP (CE,SIM) = PWE(CE);

BOPREP (SIM) = BOP.L;

EXRREP (SIM) = EXR.L;

FPDREP (F, A ,SIM) = FPD.L(F,A);

GBSREP (SIM) = GBS.L;

IADJREP (SIM) = IADJ.L;

MPSREP (H, SIM) = MPS.L(H);

PAREP (A, SIM) = PA.L(A);

PDREP (C, SIM) = PD.L(C);

PEREP (CE, SIM) = PE.L(CE);

PFREP (F, SIM) = PF.L(F);

PFAREP (F,A, SIM) = PF.L(F)*FPD.L(F,A);

PMREP (CM, SIM) = PM.L(CM);

PQREP (C, SIM) = PQ.L(C);

PVAREP (A, SIM) = PVA.L(A);

PXREP (C, SIM) = PX.L(C);

QAREP (A, SIM) = QA.L(A);

QDREP (C, SIM) = QD.L(C);

QEREP (CE, SIM) = QE.L(CE);

QFREP (F,A, SIM) = QF.L(F,A);

QFUREP (F, SIM) = QFU.L(F);

QHREP (C, H, SIM) = QH.L(C,H);

QINTREP (C, A, SIM) = QINT.L(C,A);

QINVREP (C, SIM) = QINV.L(C);

QMREP (CM, SIM) = QM.L(CM);

QQREP (C, SIM) = QQ.L(C);

QXREP (C, SIM) = QX.L(C);

YFREP (H, F , SIM) = YF.L(H,F);

YHREP (H, SIM) = YH.L(H);

WALRREP (SIM) = WALR.L;


\

  • CREATING AND PROCESSING THE GDP data

  • This is the equivalent of the National Income Table

GDPREP (‘PRVCON’, SIM) = SUM((C,H), PQ.L(C)*QH.L(C,H)) ;

GDPREP (‘GOVCON’, SIM) = SUM(C, PQ.L(C)*QG(C));

GDPREP (‘INVEST’, SIM) = SUM(C, PQ.L(C)*QINV.L(C));

GDPREP (‘EXP’, SIM) = SUM(C, EXR.L*PWE(C)*QE.L(C));

GDPREP (‘IMP’, SIM) = - SUM(C, EXR.L*PWM(C)*QM.L(C));

GDPREP (‘GDPFC’, SIM) = SUM((F,A), PF.L(F)*FPD.L(F,A)*QF.L(F,A));

GDPREP (‘NITAX’, SIM)

= SUM(C, tq(C)*(PD.L(C)*QD.L(C) + (PM.L(C)*QM.L(C))$CM(C)))

  • SUM(C$CM(C), tm(C)EXR.LPWM(C)*QM.L(C))

  • SUM(C$CE(C), te(C)EXR.LPWE(C)*QE.L(C));

)

;



*Processing GDP data

GDPREP(‘GDPMP1’,SIM) = SUM(ACGDP1, GDPREP(ACGDP1,SIM));

GDPREP(‘GDPMP2’,SIM) = GDPREP(‘GDPFC’,SIM) + GDPREP(‘NITAX’,SIM);

GDPREP(‘GDPGAP’,SIM) = GDPREP(‘GDPMP1’,SIM)-GDPREP(‘GDPMP2’,SIM);


\

  • SETTING THE DISPLAY FORMATIN OPTIONS

OPTION QFREP : 3 : 1: 1, QHREP:3:1:1, QINTREP:3:1:1, PFAREP:3:1:1,

PFAREP : 3 : 1 : 1, FPDREP : 3 : 1 : 1, YFREP : 3 : 1 : 1

;


\

  • DISPLAYING THE RESULTS

DISPLAY

PWEREP, BOPREP, EXRREP, FPDREP, GBSREP, IADJREP, MPSREP, PAREP, PDREP,

PEREP, PFREP, PFAREP, PMREP, PQREP, PVAREP, PXREP, QAREP, QDREP, QEREP,

QFREP, QFUREP, QHREP, QINTREP, QINVREP, QMREP, QQREP, QXREP, YFREP,

YHREP, WALRREP, GDPREP

;

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.