Reference
Category : GAMS NOA library
Mainfile : macro.gms
$onText
A small linear dynamic macroeconomic model of U.S. economy in which
both monetary and fiscal policy variables are used.
Linear Quadratic Riccati Equations are solved as a General Nonlinear
Programming Problem instead of the usual Matrix Recursion.
Please see:
Kendrick, D, Caution and Probing in a Macroeconomic Model.
Journal of Economic Dynamics and Control 4, 2 (1982) pp.149-170.
$offText
Sets n states / consumpt, invest /
m controls / gov-expend, money /
k horizon / 1964-i, 1964-ii, 1964-iii, 1964-iv
1965-i, 1965-ii, 1965-iii, 1965-iv /
ku(k) control horizon
ki(k) initial period
kt(k) terminal period ;
Alias (n,np), (m,mp) ;
ku(k) = yes$(ord(k) lt card(k));
ki(k) = yes$(ord(k) eq 1);
kt(k) = not ku(k);
Display k, ki, kt, ku;
Table a(n,np) state vector matrix
consumpt invest
consumpt .914 -.016
invest .097 .424
Table b(n,m) control vector matrix
gov-expend money
consumpt .305 .424
invest -.101 1.459
Table wk(n,np) penalty matrix for states - input
consumpt invest
consumpt .0625
invest 1
Table rk(m,mp) penalty matrix for controls
gov-expend money
gov-expend 1
money .444
Parameter c(n) constant term / consumpt -59.4, invest -184.7 /
xinit(n) initial value / consumpt 387.9, invest 85.3 /
uinit(m) initial controls / gov-expend 110.5, money 147.1 /
xtilde(n,k) desired path for x
utilde(m,k) desired path for u
w(n,np,k) penalty matrix on states ;
w(n,np,ku) = wk(n,np);
w(n,np,kt) = 10000*wk(n,np);
xtilde(n,k) = xinit(n)*1.0075**(ord(k)-1);
utilde(m,k) = uinit(m)*1.0075**(ord(k)-1);
Display w, xtilde, utilde;
Variables x(n,k) state variable
u(m,k) control variable
j criterion
Equations criterion criterion definition
stateq(n,k) state equation ;
criterion..
j =e= .5*sum((k,n,np),
(x(n,k)-xtilde(n,k))*w(n,np,k)*(x(np,k)-xtilde(np,k)))
+ .5*sum((ku,m,mp),
(u(m,ku)-utilde(m,ku))*rk(m,mp)*(u(mp,ku)-utilde(mp,ku)));
stateq(n,k+1)..
x(n,k+1) =e= sum(np, a(n,np)*x(np,k)) + sum(m, b(n,m)*u(m,k)) + c(n);
Model macro /all/;
x.l(n,k) = xinit(n);
u.l(m,k) = uinit(m);
x.fx(n,ki) = xinit(n);
Solve macro minimizing j using nlp;
Display x.l, u.l;
$ifThenI x%mode%==xbook
file res1 /macro.dat/;
put res1
loop(k, put xtilde('consumpt',k):10:5, put/)
loop(k, put xtilde('invest',k):10:5, put/)
loop(k, put x.l('consumpt',k):10:5, put/)
loop(k, put x.l('invest',k):10:5, put/)
loop(k, put utilde('gov-expend',k):10:5, put/)
loop(k, put utilde('money',k):10:5, put/)
loop(k, put u.l('gov-expend',k):10:5, put/)
loop(k, put u.l('money',k):10:5, put/)
$endIf
* End Macro