Lect Notes 9
Lect Notes 9
9.1
9.1.1
(9.1)
where F : Rny Rnx Rny Rnx Rne Rny +nx describes the model. t
is the set of innovations of the structural shocks that hit the economy. The
solution of the model is a set of decision rules for the control variables
yt = g(xt ; )
that define the next period state variables as
xt+1 h(xt , yt , t+1 ) = h(xt , g(xt ; ), t+1 )
such that the model can be rewritten
Et R(xt , t+1 ; g, ) = 0
(9.2)
The idea of the minimum weighted residual method is to replace the true
decision rule by a parametric approximation function, (xt; ), of the current
state variables xt and a vector of parameters . Therefore, in its original
implementation the minimum weighted residual method differs from the PEA
algorithm in that we are not seeking directly an expectation function but a
decision rule.1 The problem is then to find a vector of parameters such that
when the agents use the so defined rule of thumb, Et F (xt , t+1 ; g, ) can be
made as small as possible. But, What do we mean by small? In fact we
want to find a vector of parameters b such that
kEt R(xt , t+1 ; g, {}ni=0 )k = 0
which corresponds to
Z
(9.3)
9.1.2
Implementation
Choosing an implementation of the minimum weighting residual method basically amounts to make 3 choices
1. the choice of a family of approximating functions,
2. the choice of the weighting function,
3. the choice of the method to approximate the integral involved by (i) the
rational expectation and (ii) the identifying restriction (9.3).
Choosing a family of approximating functions:
xi xi1
xi+1 x
(xi ) =
x
x
i+1 i
0
3
p
X
i i (xt )
i=0
extremely important in that it will define the method we will use. Traditionally, we may define 3 broad classes of method, depending on the weighting
function we use:
1. The Least square method sets
i (x) =
R(xt , t+1 ; g, )
i
1 if x = xi
0 if x 6= xi
1. The problem of the rational expectation: In this case, everything depends on the form of the process for the shocks. If we are to use Markov
chains, the integration problem is highly simplified as it only involves
a discrete sum. If we use continuous support for the shocks, the choice
of an integration method is dictated by the type of distribution we are
assuming. In most of the cases, we will use gaussian shocks such that
we will rely on GaussHermite quadrature methods described in lecture
notes # 4.
2. The problem of the inner product (equation (9.3)): In this case everything depends on the approximation method. If we are to use a
collocation method, no integration method is to be used as collocation
5
amounts to impose that the residuals are zero at each node, such that
(9.3) reduces to
Et R(xi , t+1 ; g, {}ni=0 ) = 0 for i = 1, . . . , n
When Least square methods are used, it is often the case that Legendre
quadrature will do the job. When a Galerkin method is selected, this will
often be the right choice too. However, when we are to use Chebychev
polynomials, a Chebychev quadrature is in order provided each weighting
function is defined as2
Ti ((x))
i (x) = p
1 (x)2
9.2
Practical implementation
In the sequel, we will essentially discuss the collocation and Galerkin implementations of a spectral method using Chebychev polynomials as they seem
to be the most popular implementation of this method.3
9.2.1
In this section, we present the collocation method in its simplest form. We will
start by presenting the general algorithm, when Chebychev polynomials are
used, and then present as an example the stochastic optimal growth model.
For the moment, let us assume that we want to solve a rational expectation
model that writes as
Et R(xt , t+1 ; g, ) = 0
2
3
The least square method can be straightforwardly implemented minimizing the implicit
objective function we discussed.
and we want to find an approximating function for the decision rule g(xt ) over
the domain [x, x]. Assume that we take as approximating function
(xt , )
n
X
i Ti ((xt ))
i=0
(2i 1)
zi = cos
for i = 1, . . . , n + 1
2(n + 1)
and formulate an initial guess for .
2. Compute xi as
xi = x + (zi + 1)
(x x)
for i = 1, . . . , n + 1
2
n
X
i Ti ((xt ))
i=0
We will discuss the one dimensional case. However, the multidimensional case will
be illustrated in an example. You are also referred to lecture notes #3 which presented
multidimensional approximation technics
The updating scheme for will typically be given by a nonlinear solver of the
type described in lecture notes #5. The computation of the integral involved
by the rational expectation will depend on the process we assumed for the
shocks. In order to better understand it, let us discuss the implementation of
the collocation method on the stochastic optimal growth model both in the
case of a Markov chain, and an AR(1) process.
The stochastic OGM (Markov chain)
p
1p
=
1p
p
The Euler equation is given by
1
c
=0
t Et ct+1 exp(at+1 )kt+1 + 1
= 0
(1 p) ct+1 (a) exp(a)kt+1 (a)1 + 1
= 0
p ct+1 (a) exp(a)kt+1 (a)1 + 1
where the notation ct (a) (resp. ct (a)) stands for the fact that the consumption
decision is contingent on the realization of the shock, a (resp. a), likewise for
kt+1 (a) (resp. kt+1 (a)).
It therefore appears that we actually have only two decision rules to compute, one for ct (a) and one for ct (a), each taking the form5
n
X
j=0
n
X
j=0
(9.4)
(9.5)
where the notation (a) accounts for the fact that the form of the decision
rule may differ depending on the realization of the shock, a. We may also
select different order of approximation for the two rules, but in order to keep
things simple we chose to impose the same order. The algorithm then works
as follows.
1. Choose an order of approximation n, compute the n + 1 roots of the
Chebychev polynomial of order n + 1 as
zi = cos
(2i 1)
2(n + 1)
for i = 1, . . . , n + 1
log(k) log(k)
ki = exp log(k) + (zi + 1)
2
for i = 1, . . . , n + 1
3. Compute
n
X
j (a)Tj ((log(ki )))
ct (a) ' (kt , (a)) exp
j=0
n
X
ct (a) ' (kt , (a)) exp
j (a)Tj ((log(ki )))
j=0
and
at+1
a
a
a
a
Consumption
P
(kt+1 (ki , a), (a)) nj=0 j (a)Tj ((kt+1 (ki , a)))
P
(kt+1 (ki , a), (a)) nj=0 j (a)Tj ((kt+1 (ki , a)))
P
(kt+1 (ki , a), (a)) nj=0 j (a)Tj ((kt+1 (ki , a)))
P
(kt+1 (ki , a), (a)) nj=0 j (a)Tj ((kt+1 (ki , a)))
where
for all i = 1, . . . , n.
6. if all residuals are close enough to zero then stop, else update and go
back to 3.
10
From a practical point of view, the last step is performed using a Newton
algorithm. Initial conditions can be obtained from a linear approximation of
the model (see the matlab codes in directory growth/collocmc).
Matlab Code: Collocation Method (OGM, Main Code)
clear all
global kmin ksup XX kt;
global nstate nbk ncoef XX XT PI;
nbk
nodes
nstate
ncoef
=
=
=
=
4;
nbk+1;
2;
nbk+1;
%
%
%
%
Degree of polynomials
# of Nodes
# of possible states for technology shock
# of coefficients
delta
= 0.1;
% depreciation rate
beta
= 0.95;
% discount factor
alpha
= 0.3;
% capital elasticity
sigma
= 1.5;
% parameter of utility
%
% Steady state
%
ysk
=(1-beta*(1-delta))/(alpha*beta);
ksy
= 1/ysk;
ys
= ksy^(alpha/(1-alpha));
ks
= ys^(1/alpha);
is
= delta*ks;
cs
= ys-is;
%
% Markov Chain: technology shock (Tauchen Hussey)
%
rho
= 0.8;
se
= 0.2;
ma
= 0;
[agrid,wmat] = hernodes(nstate);
agrid
= agrid*sqrt(2)*se;
PI
= transprob(agrid,wmat,0,rho,se);
at
= agrid+ma;
%
% grid for the capital stock
%
kmin
= log(0.1);
ksup
= log(6);
rk
= rcheb(nodes);
% roots
kt
= exp(itransfo(rk,kmin,ksup)); % grid
XX
= cheb(rk,[0:nbk]);
% Polynomials
%
% Initial Conditions
11
%
a0=repmat([-0.2 0.65 0.04 0 0],nstate,1);
a0=a0(:);
%
% Main loop
%
param
= [alpha beta delta sigma];
th
= fcsolve(residuals,a0,[],param,at);
th
= reshape(th,ncoef,nstate);
=
=
=
=
=
=
param(1);
param(2);
param(3);
param(4);
length(theta);
reshape(theta,lt/nstate,nstate);
RHS=[];
LHS=[];
for i=1:nstate;
ct
= exp(XX*theta(:,i));
% C(t)
k1
= exp(at(i))*kt.^alpha+(1-delta)*kt-ct;
% k(t+1)
rk1 = transfo(log(k1),kmin,ksup);
% k(t+1) in kmin,ksup
xk1 = cheb(rk1,[0:nbk]);
% polynomials
%
% Euler equation for all states
%
aux = 0;
for j=1:nstate;
c1
= exp(xk1*theta(:,j));
% c(t+1)
%
% Cumulates the left hand side of the Euler equation for all states
%
resid = beta*(alpha*exp(at(j))*k1.^(alpha-1)+1-delta).*c1.^(-sigma);
aux
= aux+PI(i,j)*resid;
end;
RHS = [RHS -sigma*log(ct)];
LHS = [LHS log(aux)];
end;
res=LHS-RHS;
res=res(:);
12
For the parameterization we use in the codes, and using 4th order Chebychev polynomials, we obtain the decision rules reported in table 9.1. Figure
Table 9.1: Decision rules (OGM, Collocation)
0
-0.2807
-0.4876
1
0.7407
0.8406
2
0.0521
0.0546
3
0.0034
0.0009
4
-0.0006
-0.0006
(9.1) reports the decision rules of consumption and next period capital stock.
As can be seen, they are (hopefully) alike those obtained from the value iteration method (see lecture notes #7).
Figure 9.1: Decision rules (OGM, Collocation)
6
1.5
4
3
0.5
1
0
0
Consumption
0
0
The AR(1) process : In this case, we assume that the technology shock is
modelled as
at+1 = at + t+1
where ; N (0, 2 ). The Euler equation is given by
1
c
=0
t Et ct+1 exp(at+1 )kt+1 + 1
13
1
1
ct p
ct+1 exp(at + t+1 )kt+1 + 1 exp t+1
dt+1 = 0
2
22
2
kt+1 exp(at )kt + ct (1 )kt = 0
1
ct+1 exp(at + z 2 )kt+1
ct
+ 1 exp z 2 dz = 0
which makes more explicit the need for a GaussHermite quadrature. We then
just have to compute the nodes and weight for the quadrature, such that the
Euler equation rewrites
c
t
1 X
1
+1 =0
j ct+1 exp(at + zj 2 )kt+1
j=1
We now have to formulate a guess for the decision rule. Note that since we
have not specified particular values for the technology shock, we can introduce
it into the approximating rule, such that we will take
nk X
na
X
ct ' (kt , at , ) exp
jk ja Tjk ((log(kt )))Tja ((at ))
jk =0 ja =0
Note that since we use collocation, the numbers of nodes should be equal to
the total numbers of coefficients. It may then be much easier to work with
tensor basis rather than complete polynomials in this case. The algorithm
then works as follows.
14
1. Choose an order of approximation nk and na for each dimension, compute the nk + 1 and na + 1 roots of the Chebychev polynomial of order
nk + 1 and na + 1 as
zki
zai
(2i 1)
for i = 1, . . . , nk + 1
= cos
2(n + 1)
(2i 1)
= cos
for i = 1, . . . , na + 1
2(n + 1)
log(k) log(k)
i
for i = 1, . . . , nk + 1
ki = exp log(k) + (zk + 1)
2
to map [-1;1] into [k; k] and
ai = log(a) + (zai + 1)
aa
for i = 1, . . . , na + 1
2
nk X
na
X
jk =0 ja =0
and
nk X
na
X
for ` = 1, . . . , q.
15
q
X
` (ki , aj , z` ; )
`=1
where
6. if all residuals are close enough to zero then stop, else update and go
back to 3.
From a practical point of view, the last step is performed using a Newton
algorithm. Initial conditions can be obtained from a linear approximation of
the model (see the matlab codes in directory growth/collocg).
Matlab Code: Collocation Method (Stochastic OGM, Main Code)
clear all
global nbk kmin ksup XK kt;
global nba amin asup XA at;
global nstate nodea nodek wmat wgrid;
nbk=4;
nba=2;
nodek=nbk+1;
nodea=nba+1;
nstate=12;
%
%
%
%
%
delta
= 0.1;
% depreciation rate
beta
= 0.95;
% discount factor
alpha
= 0.3;
% capital elasticity
sigma
= 1.5;
% parameter of utility
rho
= 0.8;
% persistence of AR(1)
se
= 0.2;
% standard deviation of innovation
ma
= 0;
% average of the process
%
% deterministic steady state
%
ysk
=(1-beta*(1-delta))/(alpha*beta);
ksy
= 1/ysk;
ys
= ksy^(alpha/(1-alpha));
ks
= ys^(1/alpha);
16
is
= delta*ks;
cs
= ys-is;
ab
= 0;
%
% grid for the technology shocks
%
[wgrid,wmat]=hernodes(nstate);
% weights and nodes for quadrature
wgrid
= wgrid*sqrt(2)*se;
amin
= (ma+wgrid(nstate));
asup
= (ma+wgrid(1));
ra
= rcheb(nodea);
% roots
at
= itransfo(ra,amin,asup);
% grid
XA
= cheb(ra,[0:nba]);
% Polynomials
%
% grid for the capital stock
%
kmin
= log(.1);
ksup
= log(6);
rk
= rcheb(nodek);
% roots
kt
= exp(itransfo(rk,kmin,ksup)); % grid
XK
= cheb(rk,[0:nbk]);
% Polynomials
%
% Initial Conditions
%
a0
= [
-0.23759592487257
0.60814488103911
0.03677400318790
0.69025680170443
-0.21654209984197
0.00551243342828
0.03499834613714
-0.00341171507904
-0.00449139656933
0.00085302605779
0.00285737302122
-0.00002348542016
-0.00011606672164
-0.00003323351559
0.00018045618825];
a0
= a0(:);
%
% main part!
%
param
= [alpha beta delta sigma ma rho];
th
= fcsolve(residuals,a0,[],param);
17
For the parameterization we use in the codes, and using 4th order Chebychev polynomials for the capital stock and second order polynomials for the
technology shock, we obtain the decision rules reported in table 9.2.
18
T0 (at )
T1 (at )
T2 (at )
T0 (kt )
-0.3609
0.6474
0.0338
T1 (kt )
0.7992
-0.2512
0.0103
T2 (kt )
0.0487
-0.0096
-0.0058
T3 (kt )
0.0019
0.0048
-0.0004
T4 (kt )
-0.0003
0.0001
0.0004
Figure (9.2) reports the decision rules of consumption and next period
capital stock.
Consumption
10
3
2
5
1
0
10
5
k
9.2.2
0 2
t
0
10
5
k
0 2
Et R(xt , t+1 ; g, ) = 0
19
We therefore want to find an approximating function for the decision rule g(x t )
over the domain [x, x]. Assume that we take as approximating function
(xt , )
n
X
i Ti ((xt ))
i=0
where
Ti ((x))
i (x) = p
1 (x)2
which rewrites
T ((x))R(x, t+1 ; , ) = 0
where
T0 ((x1 )) . . . T0 ((xm ))
..
..
..
T (x) =
.
.
.
Tn ((x1 )) . . . Tn ((xm ))
(2i 1)
for i = 1, . . . , m
zi = cos
2m
and formulate an initial guess for .
6
We will discuss the one dimensional case. However, the multidimensional case will
be illustrated in an example. You are also referred to lecture notes #3 which presented
multidimensional approximation technics
20
T0 (z1 ) . . . T0 (zm )
..
..
..
T (x) =
.
.
.
Tn (z1 ) . . . Tn (zm )
3. Compute xi as
xi = x + (zi + 1)
(x x)
for i = 1, . . . , n + 1
2
n
X
i Ti ((xt ))
i=0
p
1p
=
1p
p
1
=0
c
t Et ct+1 exp(at+1 )kt+1 + 1
and the law of motion of capital
1
0.7407
0.8406
2
0.0521
0.0546
3
0.0034
0.0009
4
-0.0005
-0.0006
The AR(1) process : Like in the case of a Markov chain, the matlab codes
associated to the Galerkin method are basically the same as the ones for the
collocation method, up to some minor differences. We were using a greater
number of nodes (20 for capital and 10 for the shock) such that in the main
code, the line nodek=nbk+1; and nodea=nba+1; now read nodek=20; and
nodea=10;, and the residuals are projected on the chebychev matrix, such
that the codes for the residuals is slightly modified, as the line res=LHS-RHS;
is now replaced by res=XX*(LHS-RHS);. Further, we used complete basis
rather than tensor basis (see the makepoly.m function)
Table 9.4: Decision rule parameters
T0 (a) -0.359970
T1 (a) 0.009890
T2 (a) 0.001764
T0 (k)
0.647039
0.048143
0.004738
T1 (k)
0.032769
-0.009799
-0.000247
23
T2 (k)
0.799127
-0.005171
T3 (k)
-0.252257
T4 (k)
9.3
9.3.1
Let us first recall the type of problem we have in hand. We are about to solve
the set of equations
1
t Et t+1 exp(at+1 )kt+1
+1
= 0
c
t t = 0
1
Et t+1 exp(at+1 )kt+1
+1
In this problem, we will deal with a continuous AR(1) process,7 such we have
2 state variables: kt and at , such that (.) should be a function of both kt and
7
See directory growth/peagalmc for the matlab code with a Markov chain.
24
at . Like in the standard Galerkin procedure, we will use a guess of the form
(kt , at , ) exp
jk =0,...,nk
ja =0,...,na
ja +jk 6max(nk ,na )
(2i 1)
= cos
for i = 1, . . . , mk
2(n + 1)
(2i 1)
= cos
for i = 1, . . . , ma
2(n + 1)
log(k) log(k)
i
ki = exp log(k) + (zk + 1)
for i = 1, . . . , mk
2
to map [-1;1] into [k; k] and
ai = log(a) + (zai + 1)
aa
for i = 1, . . . , ma
2
(kt+1 (ki , aj ), aj + z` 2 , )
and the consumption in t + 1
`=1
where
At this point, it is not clear why the PEA modification to the minimum
weighted residual method could be interesting, as it does not differ so much
from its standard implementation. However, it has the attractive feature of
being able to deal with binding constraints extremely easily. As an example
of implementation, we shall now study the stochastic optimal growth model
with an irreversibility in investment decision.8
9.3.2
Irreversible investment
We now consider a variation to the previous model, in the sense that we restrict
gross investment to be positive in each and every period:
it > 0 kt+1 > (1 )kt
(9.6)
This assumption amounts to assume that there does not exist a second hand
market for capital. In such a case the problem of the central planner is to
determined consumption and capital accumulation, such that utility is maximum:
max E0
s.t.
X
t=0
c1
1
t
1
c1 1
8
You will also find in the matlab codes a version of the problem of a consumer facing a
borrowing constraint in the directory borrow.
27
(9.7)
1
t t = Et t+1 exp(at+1 )kt+1
+ 1 t+1 (1 )
(9.8)
(9.9)
(9.10)
The main difference with the previous example is that now the central planner
faces a constraint that may be binding in each and every period. Therefore,
this complicates a little bit the algorithm, and we have to find a rule for both
the expectation function
Et [t+1 ]
where
1
t+1 t+1 exp(at+1 )kt+1
+ 1 t+1 (1 )
nk
X
Et [t+1 ] ' (kt , a` ; ) exp
(a` )Tj ((log(ki ))) for each a` , ` = 1, . . . , na
j=0
The algorithm is very close to the one we used in the case of PEA and
closely follows ideas suggested in Marcet and Lorenzoni [1999] and Christiano
and Fisher [2000]. In the case of a Markov chain and for the Galerkin procedure, it can be sketched as follows.
9
You are left to study the matlab code located in /irrev/peagalg for the continuous
AR(1) case.
28
(2i 1)
2(n + 1)
for i = 1, . . . , mk
T0 (z1 ) . . . T0 (zm )
..
..
..
T (z) =
.
.
.
Tn (z1 ) . . . Tn (zm )
3. Compute ki as
log(k) log(k)
for i = 1, . . . , nk + 1
ki = exp log(k) + (zi + 1)
2
to map [-1;1] into [k; k].
4. Compute the approximating expectation function at each node ki , i =
1, . . . , mk , and for each possible state a` , ` = 1, . . . , na :
nk
X
(ki , a` ; ) = exp
(a` )Tj ((log(ki )))
j=0
t (ki , a` ; ) = 0
If it is binding then set
kt+1 (ki , a` ; ) = (1 )ki
t (ki , a` ; ) = ct (ki , a` ; )
t (ki , a` ; ) = t (ki , a` ; ) (ki , a` ; )
7. Then, for each state (ki , a` ), i = 1, . . . , nk and ` = 1, . . . , na , compute
the possible levels of future consumption without taking the constraint
into account
ct+1 (kt+1 (ki , a` ; ), a ; ) = (kt+1 (ki , a` ; ), a ; )1/
for = 1, . . . , na , the level of next period investment
it (kt+1 (ki , a` ; ), a ; ) = exp(a )kt+1 (ki , a` ; ) ct (kt+1 (ki , a` ; ), a ; )
8. Check whether the constraint is binding at each position
If the constraint is not binding then keep computed values for
ct+1 (kt+1 (ki , a` ; ), a ; ) and set
na
X
` (ki , a` , a ; )
=1
where
(ki , a` , a ; ) ct+1 (kt+1 (ki , a` ; ), a ; )
%
%
%
%
Degree of polynomials
# of Nodes
# of possible states for the shock
# of coefficients
= 0.1;
% depreciation rate
= 0.95;
% discount factor
= 0.3;
% capital elasticity
= 1.5;
% CRRA Utility
=(1-beta*(1-delta))/(alpha*beta);
= 1/ysk;
31
ys
= ksy^(alpha/(1-alpha));
ks
= ys^(1/alpha);
is
= delta*ks;
cs
= ys-is;
%
% Markov Chain: (Tauchen-Hussey 1991) technology shock
%
rho
= 0.8;
% persistence
se
= 0.075;
% volatility
ma
= 0;
[agrid,wmat]=hernodes(nstate);
agrid
= agrid*sqrt(2)*se;
PI
= transprob(agrid,wmat,0,rho,se);
at
= agrid+ma;
%
% grid for the capital stock
%
kmin
= log(1);
ksup
= log(7);
rk
= rcheb(nodes);
% roots
kt
= itransfo(rk,kmin,ksup);
% grid
XX
= cheb(rk,[0:nbk]);
% Polynomials
%
% Initial Conditions
%
a0=[
-0.32518704
-0.22798091
-0.15021991
-0.12387075
-0.61535041
-0.64879442
-0.70031744
-0.84056683
-0.02892469
-0.03369096
-0.05570433
-0.15063263
-0.00565378
-0.00941495
-0.02618621
-0.09526710
-0.00296230
-0.00547789
-0.01692339
-0.06102182
-0.00145337
-0.00274142
-0.00988611
-0.03461623
-0.00065225
-0.00115070
-0.00536657
-0.01776343
-0.00025245
-0.00038302
-0.00291504
-0.00838555
-0.00004845
-0.00001360
-0.00162292
-0.00365588
0.00001150
0.00013398
-0.00088759
-0.00124601
-0.00003248
0.00013595
-0.00055706
-0.00013116
];
%
% Solves the problem effectively
%
param
= [alpha beta delta sigma];
th
= fcsolve(residuals,a0,[],param,at);
th
= reshape(th,ncoef,nstate);
%
% Evaluate the approximation
%
lt
= length(th);
nb
= 100;
32
-0.23608269
-1.23998020
-0.45685868
-0.32031660
-0.21319594
-0.13635186
-0.09027963
-0.06431768
-0.04689460
-0.03294968
-0.02163670
kt
= [kmin:(ksup-kmin)/(nb-1):ksup];
rk
= transfo(kt,kmin,ksup);
XX
= cheb(rk(:),[0:nbk]);
kt
= exp(kt);
kp
= zeros(nb,nstate);
it
= zeros(nb,nstate);
ct
= zeros(nb,nstate);
mu
= zeros(nb,nstate);
for i=1:nstate;
Upsilon = exp(XX*th(:,i));
y
= exp(at(i))*kt.^alpha;
it(:,i) = max(y-Upsilon.^(-1/sigma),0);
ct(:,i) = y-it(:,i);
kp(:,i) = it(:,i)+(1-delta)*kt;
mu(:,i) = ct(:,i).^(-sigma)-Ephi;
end;
Matlab Code: Residuals Function (Irreversible Investment)
function res=residuals(theta,param,at);
global nbk kmin ksup XX kt PI nstate;
alpha
= param(1);
beta
= param(2);
delta
= param(3);
sigma
= param(4);
lt
= length(theta);
theta
= reshape(theta,lt/nstate,nstate);
RHS=[];LHS=[];
% lhs and rhs of Euler equation
for i=1:nstate;
Upsilon = exp(XX*theta(:,i));
% evaluate expectation
y
= exp(at(i))*exp(kt).^alpha;
% Output
iv
= max(y-Ephi.^(-1/sigma),0);
% takes care of the constraint
k1
= (1-delta)*exp(kt)+iv;
% next period capital stock
rk1
= transfo(log(k1),kmin,ksup);
% maps it into [-1;1]
xk1
= cheb(rk1,[0:nbk]);
% Computes the polynomials
aux
= 0;
for j=1:nstate;
Upsilon1 = exp(xk1*theta(:,j));
% used for the consumption
y1
= exp(at(j))*k1.^alpha;
% next period output
mu1
= max(y1.^(-sigma)-Ephi1,0); % mu>0 <=> lambda=(c=y)^(-sigma)
tmp
= beta*((alpha*y1./k1+1-delta).*Upsilon1-mu1*(1-delta));
aux
= aux+PI(i,j)*tmp;
end;
RHS = [RHS (aux)];
LHS = [LHS (Ephi)];
end;
res = XX*(LHS-RHS);
% Galerkins projection
res = res(:);
33
T0 (log(kt ))
T1 (log(kt ))
T2 (log(kt ))
T3 (log(kt ))
T4 (log(kt ))
T5 (log(kt ))
T6 (log(kt ))
T7 (log(kt ))
T8 (log(kt ))
T9 (log(kt ))
T1 0(log(kt ))
a1
-0.271633
-0.617972
-0.020999
-0.000673
-0.000403
-0.000251
-0.000073
-0.000031
-0.000042
-0.000028
-0.000008
a2
-0.198195
-0.639585
-0.021617
-0.001298
-0.000913
-0.000670
-0.000312
-0.000103
-0.000104
-0.000093
-0.000032
a3
-0.131885
-0.662475
-0.024964
-0.004093
-0.002900
-0.002002
-0.001192
-0.000519
-0.000363
-0.000359
-0.000182
a4
-0.076585
-0.701972
-0.042518
-0.017748
-0.012222
-0.007493
-0.004215
-0.001893
-0.000923
-0.000890
-0.000557
a5
-0.044720
-0.786584
-0.094447
-0.053895
-0.032597
-0.015666
-0.005548
-0.000922
0.000202
-0.000995
-0.001279
Table 9.5 and Figure 9.3 report the approximate decision rules for an economy where = 0.3, = 0.95, = 0.1, = 1.5, the persistence of the shock
34
is = 0.8 and the volatility = 0.075. As can be seen, only low values
for the shock make the constraint binds. This is illustrated by the fact that
the Lagrange multiplier becomes positive, and investment becomes negative.
Therefore, the next period capital stock is given by what is left by the depreciation and output is fully consumed.
Figure 9.3: Decision rules (Irreversible investment, PEAGalerkin)
7
Consumption
6
5
1.5
4
3
2
1
0
4
k
0.5
0
4
k
Investment
0.5
0.3
0.4
Lagrange multiplier
0.2
0.3
0.1
0.2
0
0.1
0
0
4
k
0.1
0
4
k
Note that up to now, we have not address the important issue of the
evaluation of the rule we obtained using any of the method we have presented
so far. This is the object of the next lecture notes.
35
36
Bibliography
Christiano, L.J. and J.D.M. Fisher, Algorithms for solving dynamic models
with occasionally binding constraints, Journal of Economic Dynamics
and Control, 2000, 24 (8), 11791232.
Judd, K., Projection Methods for Solving Aggregate Growth Models, Journal
of Economic Theory, 1992, 58, 410452.
Marcet, A. and G. Lorenzoni, The Parameterized Expectations Approach:
Some Practical Issues, in M. Marimon and A. Scott, editors, Computational Methods for the Study of Dynamic Economies, Oxford: Oxford
University Press, 1999.
McGrattan, E., Solving the Stochastic Growth Model with a Finite Element
Method, Journal of Economic Dynamics and Control, 1996, 20, 1942.
, Application of Weighted Residual Methods to Dynamic Economic Models, in M. Marimon and A. Scott, editors, Computational Methods for the
Study of Dynamic Economies, Oxford: Oxford University Press, 1999.
37
38
Contents
9 Minimum Weighted Residual Methods
9.1
9.2
9.3
9.1.1
9.1.2
Implementation . . . . . . . . . . . . . . . . . . . . . . .
Practical implementation . . . . . . . . . . . . . . . . . . . . .
9.2.1
9.2.2
19
24
9.3.1
24
9.3.2
Irreversible investment . . . . . . . . . . . . . . . . . . .
27
39
40
List of Figures
9.1
13
9.2
19
9.3
35
41
42
List of Tables
9.1
13
9.2
19
9.3
23
9.4
23
9.5
43