introduction to dynare - ice homepageice.uchicago.edu/2005_slides/juillard_part1_part2.pdf ·...

32
INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University Paris 8 INTRODUCTION TO DYNARE – p. 1/1

Upload: vudat

Post on 08-Mar-2018

244 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

INTRODUCTION TO DYNAREICE 2005

Michel Juillard

CEPREMAP, Paris Sciences Economics, University Paris 8

INTRODUCTION TO DYNARE – p. 1/13

Page 2: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Acknowledgments

DYNARE started at CEPREMAP in 1994.

DYNARE development: S. Adjemian, O. Kamenik

Built on work of: R. Boucekkine, F. Collard, J.P. Laffargue,M. Ratto, F. Schorfheide, C. Sims, R. Wouters

Public domain software: cygwin, gnumex, lapack, styxbox,asamin, asa.

INTRODUCTION TO DYNARE – p. 2/13

Page 3: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

DYNARE

1. computes the steady state of the model

2. computes the solution of deterministic models(arbitrary accuracy)

3. computes first and second order approximation tosolution of stochastic models

4. estimates (maximum likelihood or Bayesian approach)parameters of DSGE models

INTRODUCTION TO DYNARE – p. 3/13

Page 4: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Solution of deterministic models

based on work of Laffargue, Boucekkine and myself

approximation: impose return to equilibrium in finitetime instead of asymptotically

computes the trajectory of the variables numerically

uses a Newton–type method

usefull to study full implications of non–linearities

INTRODUCTION TO DYNARE – p. 4/13

Page 5: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

An example

The effect of a change in tax rate in a model withmonopolistic competition (adapted from Hairault, Langotand Portier, 2001)

Wt = ln ct + η ln(1 − ht) + βWt+1

ct + it = Akα

t−1h1−α

t

it = kt − (1 − δ)kt−1

1

ct

= βEt

�1

ct+1

(zt+1 + 1 − δ)

η

1 − ht

=wt

ct

α

�kt−1

ht

�α−1

= (1 + µ)(1 + τt)zt

(1 − α)

�kt−1

ht

�α

= (1 + µ)(1 + τt)wt

INTRODUCTION TO DYNARE – p. 5/13

Page 6: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

DYNARE implementation – Preambule

var Welf w c h i k z;varexo tau;

parameters beta delta alpha mu eta rho Abar;delta = 0.025;eta = 2;mu = 0.1;alpha = 0.36;rho = 0.95;beta = 0.988;Abar = 1;

INTRODUCTION TO DYNARE – p. 6/13

Page 7: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

DYNARE implementation – Model

model;Welf = log(c)+eta * log(1-h)+beta * Welf(+1);c+i = Abar * k(-1)ˆalpha * hˆ(1-alpha);i = k - (1-delta) * k(-1);1/c = beta * (1/c(+1)) * (z(+1)+1-delta);eta/(1-h) = w/c;alpha * (k(-1)/h)ˆ(alpha-1) = (1+mu) * (1+tau) * z;(1-alpha) * (k(-1)/h)ˆalpha = (1+mu) * (1+tau) * w;end;

INTRODUCTION TO DYNARE – p. 7/13

Page 8: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

DYNARE implementation – Initialization

initval;Welf = -100;w = 0.5;c = 0.6;h = 0.3;i = 0.4;k = 3;z = 0.1;tau = 0;end;

steady;

INTRODUCTION TO DYNARE – p. 8/13

Page 9: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

DYNARE implementation – Initialization

endval;Welf = -100;w = 0.5;c = 0.6;h = 0.3;i = 0.4;k = 3;z = 0.1;tau = -mu/(1+mu);end;

steady;

INTRODUCTION TO DYNARE – p. 9/13

Page 10: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

DYNARE implementation – Computations

simul(periods=300);

dsample 0 50;rplot Welf;rplot k;rplot c;rplot h;

INTRODUCTION TO DYNARE – p. 10/13

Page 11: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Stochastic models: First order approximation

In a a stochastic framework, the unknowns are the decisionfunctions.For a large class of DSGE models, DYNARE computesapproximated decision rules and transition equations of theform

yt = y + Ayt−1 + But

with yt = yt − y.Method proposed by Klein (2000) and Sims (2002).DYNARE computes also theoretical moments and IRFs.

INTRODUCTION TO DYNARE – p. 11/13

Page 12: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Example

In the previous example, one introduces stochasticproductivity according to

ln At = (1 − ρ) ∗ ln A + ρ ∗ ln At−1 + et

and one considers the case of no tax.New instructions:shocks;var e; stderr 0.072;end;

stoch_simul(order=1) Welf h c i w z;

INTRODUCTION TO DYNARE – p. 12/13

Page 13: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Second order approximation

Two features:

decision rules and transition functions are 2nd orderpolynomials

departure from certainty equivalence: the variance offuture shocks matters

Decision rules and transition equations of the form

yt = y+Ayt−1+But+0.5(

y′t−1Cyt−1 + u′

tDut

)

+y′t−1Fut+∆ (Σu)

Method suggested by K. Judd, developped by C. Sims(2002), S. Schmitt-Grohe and M. Uribe (2003), F. Collardand M. Juillard (2000).

INTRODUCTION TO DYNARE – p. 13/13

Page 14: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

A k-order Perturbation Approach toSolve Complete Market RBC Models

July 2004

prepared for the conference “Computational Methods forDynamic Stochastic Economic Models”, SITE 2004.

Michel JuillardCEPREMAP and University Paris 8

– p. 1/19

Page 15: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Solving DSGE models

Let’s consider the following model:

Et (f(yt−1, yt, yt+1, ut)) = 0

with

ut = σεt, E(εt) = 0, E(

[εt]β1 . . . [εt]

βk

)

= [Σ]β1...βk

The solution takes the form:

yt = g(yt−1, ut, σ)

– p. 2/19

Page 16: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

The perturbation method

Computes a Taylor expansion for g() from thecoefficients of the Taylor expansion of f().

The Taylor expansion is generaly computed around thedeterministic equilibrium of the model:

f(y, y, y, 0, 0) = 0

– p. 3/19

Page 17: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

The state variables

The state variables are yt−1, and ut.Then,

yt+1 = g(yt, ut+1, σ)

= g(g(yt−1, ut, σ), ut+1, σ)

and

F (yt−1, ut, σ, ut+1) = f(

yt−1, g(yt−1, ut, σ),

g(g(yt−1, ut, σ), ut+1, σ), ut

)

F (yt−1, ut, σ) = Et

(

F (yt−1, ut, σ, ut+1))

= 0

– p. 4/19

Page 18: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

The first order approximation

First order Taylor expansion of the structural model:

F (1)(yt−1, ut, σ) = Et

{

f(y, y, y, 0, 0) + fy−

y

+fy(gyy + guu + gσσ)

+fy+gy(gyy + guu + gσσ)

+ fy+guu′ + fy+

gσσ + fuu}

= 0

where y = yt−1 − y, u = ut, u′ = ut+1. The partial derivatives are taken at the

deterministic equilibrium and aren’t stochastic.

– p. 5/19

Page 19: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

for this to hold . . .

(

fy−

+ fygy + fy+gygy

)

y = 0

(fygu + fy+gygu + fu) u = 0

(fygσ + fy+gygσ + fy+

gσ) σ = 0

– p. 6/19

Page 20: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

k order approximation

Let’s write

s = [yt−1, ut]′

s = [y, 0]′

s = s − s

u = ut

u′ = ut+1

– p. 7/19

Page 21: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Tensor notation

∂jF i

∂sα1. . . ∂sαj

=[

F i

sj

]

α1...αj

and

n∑

α1

. . .

n∑

αj

∂jF i

∂sα1. . . ∂sαj

sα1. . . sαj

=[

F i

sj

]

α1...αj

[s]α1 . . . [s]αj

– p. 8/19

Page 22: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Taylor expansion of the model

F(p)

i(s, σ, u′)

= Fi(s, 0, 0) +

pX

j=1

1

j!

��

F i

sj

α1...αj[s]α1 . . . [s]αj

+

j−1X

k=1

F i

skσj−k

α1...αk[s]α1 . . . [s]αk σj−k

+

j−1X

k=1

h

F i

sku′j−k

i

α1...αkβ1...βj−k

[s]α1 . . . [s]αk

�u′

�β1 . . .

�u′

�βj−k

+

j−1X

k=1

h

F i

u′kσj−k

iβ1...βk

�u′

�β1 . . .

�u′

�βk σj−k

+

j−2X

k=1

j−1Xm=k+1

hF i

sku′m−kσj−m

iα1...αkβ1...βm−k

[s]α1 . . . [s]αk

u′

β1 . . .

u′

βm−k σj−m

+

�F i

σj

�σj +

hF i

u′ji

β1...βj

�u′

�β1 . . .

�u′

�βj

– p. 9/19

Page 23: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Reminding

u = σε

E(

[u]β1 . . . [u]βk

)

= σk [Σ]β1...βk

– p. 10/19

Page 24: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Taking the expectation

E

F(p)

i(s, σ)

= Fi(s, 0, 0) +

pX

j=1

1

j!

��

F i

sj

α1...αj[s]α1 . . . [s]αj

+

j−1X

k=1

F i

skσj−k

α1...αk[s]α1 . . . [s]αk σj−k

+

j−1X

k=1

h

F i

sku′j−k

i

α1...αkβ1...βj−k

[s]α1 . . . [s]αk [Σ]β1...βj−k σj−k

+

j−1X

k=1

h

F i

u′kσj−k

iβ1...βk

[Σ]β1...βk σj

+

j−2Xk=1

j−1Xm=k+1

hF i

sku′m−kσj−m

iα1...αkβ1...βm

[s]α1 . . . [s]αk [Σ]β1...βm−k σj−k

+

�F i

σj

�σj +

hF i

u′j

iβ1...βj

[Σ]β1...βj σj

= 0.

– p. 11/19

Page 25: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Constraints on the partial derivatives

(1)[

F isj

]

α1...αj

= 0

(2)[

F iskσj−k

]

α1...αk

+[

F isku′

j−k

]

α1...αkβ1...βj−k

[Σ]β1...βj−k

+∑j−1

m=k+1

[

F isku′

m−kσj−m

]

α1...αkβ1...βm

[Σ]β1...βm−k = 0

(3)[

F iσj

]

+[

F iu′j

]

β1...βj

[Σ]β1...βj

+∑j−1

k=1

[

F iu′kσj−k

]

β1...βk

[Σ]β1...βk = 0

j = 1, . . . , p k = 1, . . . , j − 1

– p. 12/19

Page 26: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

F as a composition of functions

Let’s define z as

z =

yt−1

yt

yt+1

ut

= z(y, u, σ, u′) =

y

g(y, u, σ)

g(g(y, u, σ), u′, σ)

u

andF (y, u, σ, u′) = f

(

z(y, u, σ, u′))

– p. 13/19

Page 27: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

kth order derivatives of a composition

Faa Di Bruno formula: if y = f(z(s)), then

[

f i

sj

]

α1...αj

=

j∑

l=1

[

f i

zl

]

β1...βl

c⊂Ml,j

l∏

m=1

[zsN (cm) ]

βm

αcm

where Ml,j is the set of all partitions of the set of j indiceswith l classes and N (cm) is the cardinality of class cm.Note that M1,j = {1, . . . , j} and Mj,j = {{1}, {2}, . . . , {j}}.Good news: The highest order derivatives appear only onceand are multiplied by first order derivatives.

– p. 14/19

Page 28: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Recoveringgyj

Back into matrix notation. The partial derivatives unfoldalong the columns.

Fyj = fy+

(

gyj

j⊗

k=1

gy + gygyj

)

+ fygyj + D = 0

where D is a term depending on partial derivatives of g() oforder lower than j and therefor already computed. Thisrequires solving the generalized Sylvester equation

(fy+gy + fy) gyj + fy+gyj

j⊗

k=1

gy = −D,

using Kamenik’s algorithm.– p. 15/19

Page 29: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Recovering other terms ingsj

Fsj = fy+

(

gyj

j⊗

k=1

gs + gygsj

)

+ fygsj + D = 0

where D is a term depending on partial derivatives of g() oforder lower than j and therefor already computed. Thisrequires solving the linear system

(fy+gy + fy) gsj = −D − fy+gyj

j⊗

k=1

gs,

– p. 16/19

Page 30: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Recoveringgykσj−k

Must be solved in decreasing order of k.

Fykσj−k = fy+

(

gykσj−k

k⊗

`=1

gy + gygykσj

)

+ fygyj + D + E = 0

where D is a term not depending on gykσj−k , but on gyrσj−r ,for r > k and

[E]iα1...αk

=[

F i

sku′j−k

]

α1...αkβ1...βj−k

[Σ]β1...βj−k

+

j−1∑

m=k+1

[

F i

sku′m−kσj−m

]

α1...αkβ1...βm

[Σ]β1...βm−k

– p. 17/19

Page 31: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Recoveringgykσj−k (continued)

This requires solving the generalized Sylvester equation

(fy+gy + fy) gykσj−k + fy+gykσj−k

k⊗

`=1

gy = −D − E.

– p. 18/19

Page 32: INTRODUCTION TO DYNARE - ICE Homepageice.uchicago.edu/2005_slides/Juillard_part1_part2.pdf · INTRODUCTION TO DYNARE ICE 2005 Michel Juillard CEPREMAP, Paris Sciences Economics, University

Recoveringgσj

Fσj = fy+gygσj + fy+gσj + fygσj + D + E = 0

where D is a term not depending on gσj and

[E]iβ1...βj

=[

F i

u′j

]

β1...βj

[Σ]β1...βj +

j−1∑

k=1

[

F i

u′kσj−k

]

β1...βk

[Σ]β1...βk

This requires solving the linear system

(fy+gy + fy+ + fy) gσj = −D − E

– p. 19/19