Hi everyone,
I am very new to GAMs and I am just finding my way around:
I want to add variables to model to report the quantity of goods that the economy imports and exports. This is the inputs used in export production functions, and outputs from import production functions. My code is
$TITLE A 2-good, 2-factor small open economy model
$ONTEXT
The model os calibrated to the social accounting matrix below
| X Y W | CONS
---------------------------------------------------------
PX | 100 -100 |
PY | 100 -100 |
PW | 200 | -200
PL | -25 -75 | 100
PK | -75 -25 | 100
---------------------------------------------------------
$OFFTEXT
* Include a scalar to scale labour endowments and define a parameter to report output
Scalar LMULT Labour endowment multiplier/1/;
Parameter Output(*,*) Production by good and scenario;
Parameter Consumption(*,*) Consumption by good and scenario;
Parameter NetExports(*,*) Value of net exports by scenario;
Parameter Quantity(*,*) net exports by scenario;
SCALAR PW1 Export price of good 1 /1/
PW2 Export price of good 2 /1/
trade Trade flag /0/;
$ONTEXT
$MODEL:mymodel
$SECTORS:
X1 ! Production index for good 1
X2 ! Production index for good 2
W ! Welfare index
M1$trade ! Imports of good 1
M2$trade ! Imports of good 2
E1$trade ! Exports of good 1
E2$trade ! Exports of good 2
$COMMODITIES:
P1 ! Price index for good 1
P2 ! Price index for good 2
PFX$trade ! Price of foreign exchange
PL ! Price index for primary factor L
PK ! Price index for primary factor K
PW ! Price index for welfare
$CONSUMERS:
HH ! Household income and expenditure
* Production
$PROD:X1 s:1
O:P1 Q:100
I:PL Q:25
I:PK Q:75
$PROD:X2 s:1
O:P2 Q:100
I:PL Q:75
I:PK Q:25
* Imports and exports
$PROD:M1$trade
O:P1 Q:1
I:PFX Q:PW1
$PROD:M2$trade
O:P2 Q:1
I:PFX Q:PW2
$PROD:E1$trade
O:PFX Q:PW1
I:P1 Q:1
$PROD:E2$trade
O:PFX Q:PW2
I:P2 Q:1
$PROD:W s:1
O:PW Q:200
I:P1 Q:100
I:P2 Q:100
$DEMAND:HH
D:PW Q:200
E:PL Q:(100*LMULT)
E:PK Q:100
$REPORT:
V:OUT1 O:P1 PROD:X1
V:OUT2 O:P2 PROD:X2
V:D1 I:P1 PROD:W
V:D2 I:P2 PROD:W
$OFFTEXT
$SYSINCLUDE mpsgeset mymodel
* Set a numeraire
P2.FX = 1;
* Check the benchmark
mymodel.iterlim = 0;
$INCLUDE mymodel.GEN
SOLVE mymodel USING MCP;
mymodel.iterlim = 1000;
$INCLUDE mymodel.GEN
SOLVE mymodel USING MCP;
* Record the benchmark values
Output("X1","Benchmark") = OUT1.L;
Output("X2","Benchmark") = OUT2.L;
Consumption("X1","Benchmark") = D1.L;
Consumption("X2","Benchmark") = D2.L;
* Allow the nation to trade with a world price of good 1 10% above the autarky price
trade = 1;
PW1 = 1.1;
$INCLUDE mymodel.GEN
SOLVE mymodel USING MCP;
* Record the new values of report Variables
Output("X1","P1 = 1.1") = OUT1.L;
Output("X2","P1 = 1.1") = OUT2.L;
Consumption("X1","P1 = 1.1") = D1.L;
Consumption("X2","P1 = 1.1") = D2.L;
NetExports("X1","P1.L = 1.1") = (OUT1.L - D1.L)*P1.L;
NetExports("X2","P1.L = 1.1") = (OUT2.L - D2.L)*P2.L;
Quantity("X1","P1.L = 1.1") = (OUT1.L - D1.L);
Quantity("X2","P1.L = 1.1") = (OUT2.L - D2.L);
Display Output, Consumption, NetExports, Quantity;
The output looks weird though.
---- 935 PARAMETER Quantity net exports by scenario
P1.L = 1.1
X1 18.202
X2 -20.023