lecture x perturbation methods - new york university · lecture x perturbation methods gianluca...

59
Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation Methods” p. 1 /59

Upload: lamtu

Post on 03-Jul-2018

226 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Lecture X

Perturbation Methods

Gianluca Violante

New York University

Quantitative Macroeconomics

G. Violante, ”Perturbation Methods” p. 1 /59

Page 2: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Local Approximations

• DSGE models are characterized by a set of nonlinear equations,some of which are intertemporal Euler equations (stochasticdifference equations), others are intratemporal FOCs, othersfeasibility/budget constraints.

• We want to transform the nonlinear system into a system of linearequations and then use well known techniques from linear RE

• To do this transformation, we use local approximations: the idea isthen to obtain a good approximation of the function in aneighborhood of a benchmark point

• Benchmark point needs to have two features: 1) easy to compute,2) visited often by the dynamic system. Usually, the SS.

• These methods are useful to solve economies with distortions, butwith small shocks and no occasionally binding constraints.

G. Violante, ”Perturbation Methods” p. 2 /59

Page 3: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Taylor principle

• The starting point of this theory is Taylor’s theorem. Supposef : R → R is a C∞ function, then for any x∗ in its domain we have

f (x) ≃ f (x∗) + f ′ (x∗) (x− x∗) +1

2f ′′ (x∗) (x− x∗)

2+ ...

+1

n!f (n) (x∗) (x− x∗)

n+On+1

so the error is asymptotically smaller than any of its terms.

• Taylor’s theorem says the RHS polynomial approximation is goodnear x∗. But how near is near?

• More in general, write the power series expansion of f around x∗ :

f (x) =∞∑

k=0

αk (x− x∗)k where αk =

1

k!f (k) (x∗)

G. Violante, ”Perturbation Methods” p. 3 /59

Page 4: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Taylor principle

• Theorem: Consider the power series∑∞

k=0 αk (x− x∗)k. If it

converges for xr, it converges for all x < xr.

• Then, we can define the radius of convergence of the powerseries as the quantity r > 0 s.t.:

r = sup

|x− x∗| : |∞∑

k=0

αk (x− x∗)k| < ∞

r provides maximal radius around x∗ for which series converges.

• Definition. A function f : Ω → C is said to be analytic on the openset Ω if, for every x∗ ∈ Ω, there exists a sequence αk and aradius r > 0 such that:

f (x) =∞∑

k=0

αk (x− x∗)k for |x− x∗| < r

G. Violante, ”Perturbation Methods” p. 4 /59

Page 5: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Taylor principle

• f analytic ↔ locally given by a convergent power series

• If f is analytic at x∗, then f has continuous derivatives of allorders at x∗ (not too surprising...)

• A point where f is not analytic is called a singularity of f . That’swhere the local approximation goes berserk...

• Example: tangent function with power series representation:

tan (x) =sinx

cosx=

∑∞k=0 (−1)k x2k

2k!∑∞

k=0 (−1)k x2k+1

(2k+1)!

but the function has a singularity at x0 = π/2 for which cos (x) = 0.

G. Violante, ”Perturbation Methods” p. 5 /59

Page 6: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Taylor principle

• Then, we can state an important theorem for local approximations.

• Theorem: Let f be analytic at x∗. If f or any derivative of fexhibits a singularity at x0, then the radius of convergence of theTaylor series expansion of f in the neighborhood of x∗ is boundedabove by |x0 − x∗|.

• This theorem gives us a guideline to use Taylor seriesexpansions, as it actually tells us that the series at x∗ cannotdeliver any accurate, and therefore reliable, approximation for f atany point farther away from x∗ than any singular point of f.

G. Violante, ”Perturbation Methods” p. 6 /59

Page 7: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Taylor principle

• Example I: log (1− x) with singularity at 1.

x log (1− x) Taylor1000.9 −2.3026 −2.3026

0.99 −4.6052 −4.3894

0.999 −9.2103 −5.1774

• Example II: production function y = kα with α ∈ (0, 1) andsteady-state k∗ = 0.5.

• The function has a singularity at x0 = 0 (first derivative), andhence the Taylor expansion has a radius bounded above by 0.5.

• Bottom line: when you linearize, think about the radius ofconvergence (calibration-specific)

G. Violante, ”Perturbation Methods” p. 7 /59

Page 8: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Linearization of FOCs

• Consider the standard deterministic growth model:

kt+1 − kαt + ct − (1− δ) kt = 0

1

ct− β

1

ct+1

(

αkα−1t+1 + 1− δ

)

= 0

• Let kt ≡ kt − k∗ and c ≡ ct − c∗ be deviations from SS

• The feasibility constraint is an equation g (kt+1, kt, ct) = 0:

g (kt+1, kt, ct) = g∗ + g∗1 kt+1 + g∗2 kt + g∗3 ct

= kt+1 −[

α (k∗)α−1 + (1− δ)]

kt + c

since g∗ = 0 (SS equilibrium condition)

G. Violante, ”Perturbation Methods” p. 8 /59

Page 9: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Linearization of Euler equation

1

ct− β

1

ct+1

(

αkα−1t+1 + 1− δ

)

= 0

• The FOC is an equation g (ct, ct+1, kt+1) = 0:

0 = g∗ + g∗1 ct + g∗2 ct+1 + g∗3 kt+1

0 = −1

(c∗)2ct + β

[

α (k∗)α−1

+ 1− δ]

(c∗)2ct+1 − β

α (α− 1) (k∗)α−2

c∗kt+1

• Simplifying

0 = −ct + β[

α (k∗)α−1

+ 1− δ]

ct+1 − βα (α− 1)

(

c∗

k∗

)

(k∗)α−1

kt+1

G. Violante, ”Perturbation Methods” p. 9 /59

Page 10: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Log-linearization of FOCs

• Another common practice is to take a log-linear approximation tothe equilibrium.

• It delivers a natural interpretation of the coefficients in front of thevariables: these can be interpreted as elasticities.

• Define log deviations from SS:

x = log (x)− log (x∗)

and linearize around log (x∗)

• First order Taylor expansion around log (x∗)

g (x) ≃ g (x∗) + gx (exp (log x∗)) exp (log x∗) x = g (x∗)+ g∗xx

∗x

G. Violante, ”Perturbation Methods” p. 10 /59

Page 11: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Log-linearization of feasibility constraint

g (kt+1, kt, ct) = kt+1 − kαt + ct − (1− δ) kt = 0

• Log-linearization:

g (kt+1, kt, ct) = g∗ + g1k∗kt+1 + g2k

∗kt + g3c∗ct

= k∗kt+1 − α (k∗)α kt + c∗ct − (1− δ) k∗kt

G. Violante, ”Perturbation Methods” p. 11 /59

Page 12: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Alternative approach

There is a simple way to do it w/o computing derivatives based onthree building blocks:

1. Log approximation:

ax = ax∗ exp (log x− log x∗) = ax∗ exp (x) ≃ ax∗ (1 + x)

2. Steady-state relation → all additive constants, like ax∗ above, dropout because each log-linearized equation is a SS relationship:

g (k∗, k∗, c∗) = 0

3. Second order terms negligible and set to zero:

xy = 0

G. Violante, ”Perturbation Methods” p. 12 /59

Page 13: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Log-linearization of feasibility constraint

kt+1 − kαt + ct − (1− δ) kt = 0

k∗ exp(

kt+1

)

−[

(k∗) exp(

kt

)]α

+ c∗ exp (ct)− (1− δ) k∗ exp(

kt

)

= 0

k∗ exp(

kt+1

)

−[

(k∗)α exp(

αkt

)]

+ c∗ exp (ct)− (1− δ) k∗ exp(

kt

)

= 0

k∗(

1 + kt+1

)

−[

(k∗)α(

1 + αkt

)]

+ c∗ (1 + ct)− (1− δ) k∗(

1 + kt

)

= 0

k∗kt+1 − α (k∗)α kt + c∗c− (1− δ) k∗k = 0

where the last line uses the SS restriction:

k∗ − (k∗)α + c∗ − (1− δ) k∗ = 0

G. Violante, ”Perturbation Methods” p. 13 /59

Page 14: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Log-linearization of Euler equation

0 =1

ct− β

1

ct+1

(

αkα−1

t+1+ 1− δ

)

0 =1

c∗ exp (ct)− β

1

c∗ exp (ct+1)

(

α (k∗)α−1 exp(

kt+1

)α−1

+ 1− δ

)

c∗ exp (ct+1) = βc∗ exp (ct)(

α (k∗)α−1 exp(

(α− 1) kt+1

)

+ 1− δ)

exp (ct+1) = β exp (ct)[

α (k∗)α−1 exp(

(α− 1) kt+1

)

+ 1− δ]

= β exp (ct)[

α (k∗)α−1(

1 + (α− 1) kt+1

)

+ 1− δ]

= exp (ct)[

βα (k∗)α−1 + β (α− 1) kt+1α (k∗)α−1 + β (1− δ)]

= exp (ct)[

1 + β (α− 1) kt+1α (k∗)α−1]

where the last line uses the SS version of the EE. Taking logs:

ct+1 = ct + β (α− 1) kt+1α (k∗)α−1

G. Violante, ”Perturbation Methods” p. 14 /59

Page 15: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

The method of undetermined coefficients

• This is Uhlig’s toolkit method

• Other classic references for solving linear RE models:

Blanchard-Kahn (ECMA, 1980)

Christiano (Comp. Economics, 2002)

King-Watson (Comp. Economics, 2002)

Klein (JEDC, 2000)

Sims (Comp. Econ, 2001)

G. Violante, ”Perturbation Methods” p. 15 /59

Page 16: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Strategy

1. Find the nonlinear dynamic system that characterizes the modeleconomy (same number of equations and unknowns).

2. Stationarize the economy, if needed. Compute the steady state.

3. (Log) linearize the nonlinear system around the SS. The system islinear in controls and (exogenous and endogenous) statevariables. Some eqns are difference eqns.

4. Express the linear system in some matrix representation. Thisrepresentation is what differs by solution method.

5. Use a matrix decomposition method to derive:

(a) Decision rules, i.e., linear functions from states to controls.

(b) Laws of motion for the endogenous state variables, i.e., linearfunctions from the states at t to the states at t+ 1.

G. Violante, ”Perturbation Methods” p. 16 /59

Page 17: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Stochastic growth model with leisure and 2 shocks

• Household problem:

maxct,kt+1,ht

E0

∞∑

t=0

βt log ct − ϕh1+ 1

γ

t

1 + 1γ

s.t.

ct + kt+1 = (1− τ)wtht + (1 + rt − δ) kt

• Firm problem:

maxht,kt

eztkαt h1−αt − wtht − rtkt

• Government:

gegt = τwtht, with gt+1 = ρggt + ηt+1

• Laws of motion for endogenous and exogenous states:

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

zt+1 = ρzzt + εt+1

G. Violante, ”Perturbation Methods” p. 17 /59

Page 18: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Step 1: Equilibrium conditions

1

ct= βEt

[

1 + rt+1 − δ

ct+1

]

wt

ct(1− τ) = ϕh

t

wt = (1− α) eztkαt h−αt

rt = αeztkα−1t h1−α

t

gegt = τwtht

ct + kt+1 = (1− τ)wtht + (1 + rt − δ) kt

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

zt+1 = ρzt + εt+1

gt+1 = ρggt + ηt+1

We can exclude the law of motion for k from the system because, oncewe know k we know i, and i does not enter anywhere else. And wecan substitute the tax revenues out from the household BC.

G. Violante, ”Perturbation Methods” p. 18 /59

Page 19: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Step 1: Reduced system of equilibrium conditions

1

ct= βEt

[

1 + rt+1 − δ

ct+1

]

wt

ct(1− τ) = ϕh

t

wt = (1− α) eztkαt h−αt

rt = αeztkα−1t h1−α

t

ct + kt+1 + gegt = (1− τ)wtht + (1 + rt − δ) kt

zt+1 = ρzt + εt+1

gt+1 = ρggt + ηt+1

• At any t, (kt, zt, gt) are pre-determined

• 3 choice variables (ct, kt+1, ht) and 2 prices (wt, rt) to bedetermined (by the first 5 equations) plus 2 equations for law ofmotions of the exogenous states

G. Violante, ”Perturbation Methods” p. 19 /59

Page 20: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Step 2: SS system

• Set zt = 0, gt = 0. Evaluate at SS the first 5 equations:

r =1

β− 1 + δ

k

h=

(

1/β − 1 + δ

α

)1

α−1

w = (1− α)

(

k

h

c+ g = (1− τ) wh+ rk

w

c(1− τ) = ϕh

• Solve for:(

k, h, c, w, r)

G. Violante, ”Perturbation Methods” p. 20 /59

Page 21: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Step 3: Log-linearize around SS

• Euler equation:

1

ct= βEt

[

1 + rt+1 − δ

ct+1

]

1

cect= βEt

[

1 + rert+1 − δ

cect+1

]

1

ect= βEt

[

1 + r (1 + rt+1)− δ

ect+1

]

1

ect= βEt

[

1 + r + rrt+1 − δ

ect+1

]

e−ct = Et

[

(1 + βrrt+1) e−ct+1

]

1− ct = Et [(1 + βrrt+1) (1− ct+1)]

0 = Et [βrrt+1 − ct+1 + ct]

G. Violante, ”Perturbation Methods” p. 21 /59

Page 22: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Step 3: Log-linearize

• Intratemporal FOC:

wt

ct(1− τ) = ϕh

t

ewt

ect= eht

ht = γ (wt − ct)

• Firm’s FOC for labor:

wt = (1− α) eztkαt h−αt

wt = zt + α(

kt − ht

)

• Firm’s FOC for capital:

rt = zt + (1− α)(

ht − kt

)

G. Violante, ”Perturbation Methods” p. 22 /59

Page 23: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Step 3: Log-linearize

• Budget constraint:

ct + gegt + kt+1 = (1− τ)wtht + (1 + rt − δ) kt

cect + gegt + kekt+1 = (1− τ) whewt+ht +(

rert + 1− δ)

kekt

c (1 + ct) + g (1 + gt) + k(

1 + kt+1

)

= (1− τ) wh (1 + wt)(

1 + ht

)

+r (1 + rt) k(

1 + kt

)

+ (1− δ) k(

1 + kt

)

cct + ggt + kkt+1 = (1− τ) wh(

wt + ht

)

+ rk(

rt + kt

)

+ (1− δ) kkt

G. Violante, ”Perturbation Methods” p. 23 /59

Page 24: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Step 3: Log-linearize

• Final log-linear system:

0 = Et [βrrt+1 − ct+1 + ct]

ht = γ (wt − ct)

rt = zt + (1− α)(

ht − kt

)

wt = zt + α(

kt − ht

)

cct + ggt + kkt+1 = (1− τ) wh(

wt + ht

)

+ rk(

rt + kt

)

+ (1− δ) kkt

• Substitute away factor prices (last eqn. uses CRS: y = rk + wh)

0 = Et

βr[

zt+1 + (1− α)(

ht+1 − kt+1

)]

− ct+1 + ct

ht = γ[

zt + α(

kt − ht

)

− ct

]

cct + ggt + kkt+1 = (1− τ) y[

zt + αkt + (1− α) ht

]

+ (1− δ) kkt

G. Violante, ”Perturbation Methods” p. 24 /59

Page 25: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Step 3: Log-linearize

• Now substitute away consumption in the EE using theintratemporal FOC:

Et

βr[

zt+1 + (1− α)(

ht+1 − kt+1

)]

− zt+1 − α(

kt+1 − ht+1

)

+1

γht+1

=

zt + α(

kt − ht

)

−1

γht

c

[

zt + α(

kt − ht

)

−1

γht

]

+ ggt + kkt+1 = y[

zt + αkt + (1− α) ht

]

+ (1− δ) kkt

zt+1 = ρzt + εt+1

gt+1 = ρggt + ηt+1

• We cannot reduce the dimensionality of the system further.

• Note: the variance of the shock does not affect any of the first twoequilibrium equations. Certainty equivalence holds.

G. Violante, ”Perturbation Methods” p. 25 /59

Page 26: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Step 4: Solve the system

• To ease the notation, express the system in recursive form andcollect terms:

0 = E

[

k′ + φ1k + φ2h′ + φ3h+ φ4z

′ + φ5z]

0 = k′ + φ8k + φ9h+ φ10z + φ11g

z′ = ρzz + ε′

g′ = ρgg + η′

• We are looking for a linear solution to the system:

k′ = λ1k + λ2z + λ3g

h = λ4k + λ5z + λ6g

• In other words, we are looking to express the λ’s as a function ofthe φ’s (and ρ’s) only

G. Violante, ”Perturbation Methods” p. 26 /59

Page 27: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Step 4: Solve the system

• Substituting the decision rules into the first two equations:

0 = (λ1 + φ1 + φ2λ4λ1 + φ3λ4) k +

(λ2 + φ2λ4λ2 + φ2λ5ρz + φ3λ5 + φ4ρ+ φ5) z +

(λ3 + φ2λ4λ3 + φ2λ6ρg + φ3λ6) g

0 = (λ1 + φ8 + φ9λ4) k + (λ2 + φ9λ5 + φ10) z + (λ3 + φ9λ6 + φ11) g

• Since both equations need to be satisfied for all(

k, z, g)

:

λ1 + φ1 + φ2λ4λ1 + φ3λ4 = 0

λ2 + φ2λ4λ2 + φ2λ5ρz + φ3λ5 + φ4ρ+ φ5 = 0

λ3 + φ2λ4λ3 + φ2λ6ρg + φ3λ6 = 0

λ1 + φ8 + φ9λ4 = 0

λ2 + φ9λ5 + φ10 = 0

λ3 + φ9λ6 + φ11 = 0

• Linear system of 6 equations into 6 unknowns (λ’s)G. Violante, ”Perturbation Methods” p. 27 /59

Page 28: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

General case

• Let x be the m = 1 endogenous states (k), y the n = 1 control (h),z as the k = 2 exogenous states (z, g).

• Write the system as:

0 = Ax′ +Bx+ Cy +Dz

0 = E[Fx′′ +Gx′ +Hx+ Jy′ +Ky + Lz′ +Mz]

z′ = Nz + ε′

• Note that in our model F = 0 and you can substitute out z′ andcollapse the other terms with M so L = 0.

• Note also that the C is a square matrix, in our case (1, 1) so it canbe inverted. When it is not square, you have to amend a bit thestrategy.

G. Violante, ”Perturbation Methods” p. 28 /59

Page 29: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

General case

• The decision rules can be expressed as:

x′ = Px+Qz

y = Rx+ Sz

where P is (m×m), Q is (m× k), R is (n×m), and S is (n× k)

• Substitute the decision rules into the system:

0 = (AP +B + CR)x+ (AQ+ CS +D)z

0 = (GP +H + JRP +KR)x+ (GQ+ JRQ+ JSN +KS +M)z

• Since these equations must hold for any x and z:

0 = AP +B + CR (1)

0 = AQ+ CS +D (2)

0 = GP +H + JRP +KR (3)

0 = GQ+ JRQ+ JSN +KS +M (4)

G. Violante, ”Perturbation Methods” p. 29 /59

Page 30: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

General case

• Solving equation (1) for R, we obtain:

R = −C−1 (AP +B)

... and here is where it’s useful that C is a square matrix(invertible)

• Substituting this expression for R into equation (3):

−JC−1AP 2 −(

JC−1B +KC−1A−G)

P −(

KC−1B −H)

= 0

• This is a quadratic matrix equation in P . Number of ways to solvethis problem.

• Uhlig suggests using the generalized eigenvalue problem (alsocalled the QZ decomposition or generalized Schurdecomposition).

G. Violante, ”Perturbation Methods” p. 30 /59

Page 31: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

General case

• Now, solve for S as a function of Q with equation (2):

S = −C−1 (AQ+D)

• To solve for Q substitute expression above into equation (4):

GQ+ JRQ− JC−1 (AQ+D)N −KC−1 (AQ+D) +M = 0(

G+ JR−KC−1A)

Q− JC−1AQN − JC−1DN −KC−1D +M = 0

• Q is the only unknown, but not trivial as Q is sandwiched in someterms. Use vec (AXB) =

(

BT ⊗A)

vec (X), where ⊗ is theKronecker product, to pull out the sandwiched X matrix.

• Apply this vectorization to equation (4) to obtain Q:

0 = I ⊗(

G+ JR−KC−1A)

vec(Q)−NT⊗

(

JC−1A)

vec(Q)− vec(JC−1DN −KC−1D +M)

vec(Q) =[

I ⊗(

G+ JR−KC−1A)

−NT⊗

(

JC−1A)

]

−1

vec(JC−1DN −KC−1D +M)

G. Violante, ”Perturbation Methods” p. 31 /59

Page 32: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Perturbation methods: a baby example

• Stochastic growth model with inelastic leisure and z shock only

Et

[

1

ct+1β(

αezt+1kα−1t+1 + 1− δ

)

−1

ct

]

= 0

kt+1 − eztkαt + ct − (1− δ) kt = 0

zt+1 − ρzzt − σεt+1 = 0

• Rewrite as:

Et [f (yt+1, yt, xt+1, xt)] = Et

y−1t+1β

(

αex2,t+1xα−11,t+1 + 1− δ

)

− y−1t

x1,t+1 − ex2,txα1t + yt − (1− δ)x1t = 0

x2,t+1 − ρzx2t

where xt is vector of endogenous and exogenous states of sizem = 2 and yt vector of controls of size n = 1: n+m eqns in f .

• Note more compact notation, x denotes both endo and exo states

G. Violante, ”Perturbation Methods” p. 32 /59

Page 33: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Main idea of perturbation methods

• Transform the problem rewriting it in terms of a perturbationparameter

• Approximate the solution around a particular choice of theperturbation parameter

• Perturbation parameter: SD of the shock σ

• Particular choice for local approximation: σ = 0

• The proposed solution of this model is of the form:

yt = g (xt, σ)

xt+1 = h (xt, σ) + ησεt+1

where η = (0 1)′ and σ is the SD of the ε shock

G. Violante, ”Perturbation Methods” p. 33 /59

Page 34: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Linearization as a first-order perturbation

• We wish to find a first-order approximation of the functions g and haround σ = 0, i.e. around the non-stochastic steady state xt = x.

• We define the non-stochastic steady state as vectors (x, y) s.t.:

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

It is clear that y = g(x, 0) and x = h(x, 0).

• Substituting the solution into the system, we use the recursiveformulation to define:

F (x, σ) = E [f (g (h (x, σ) + ησε′, σ) , g (x, σ) , h (x, σ) + ησε′, x)] = 0

• Since this must hold for any x and σ, it is also true that thederivatives of any order of F wrt to x and σ must also be zero.

G. Violante, ”Perturbation Methods” p. 34 /59

Page 35: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Linearization as a first-order perturbation

• Recall that we are looking for first-order approximations of g and hat the point (x, σ) = (x, 0) of the form:

g (x, σ) = y + gx (x− x) + gσσ

h (x, σ) = x+ hx (x− x) + hσσ

• where we used the notation:

gx = gx (x, 0) , etc

• The four unknown coefficients

gx, gσ, hx, hσ

of the first-orderapproximation of g and h are found by imposing:

Fx = Fx (x, 0) = 0

Fσ = Fσ (x, 0) = 0

G. Violante, ”Perturbation Methods” p. 35 /59

Page 36: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Tensor notation

• Tensors are multidimensional arrays and in physics there is acompact notation to deal with them that we can use:

[

fy]i

α=

∂f i

∂yα |x=x,σ=0

is the (i, α) element of the derivative of f wrt y, which is a(n+m× n) matrix. Thus i = 1, ...n+m and α = 1, ..., n.

• We can also define:

[

fy]i

α[gx]

α

j =n∑

α=1

∂f i

∂yα∂gα

∂xj|x=x,σ=0

[

fy′

]i

α[gx]

αβ

[

hx

j=

n∑

α=1

m∑

β=1

∂f i

∂yα∂gα

∂xβ

∂hβ

∂xj|x=x,σ=0

G. Violante, ”Perturbation Methods” p. 36 /59

Page 37: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Linearization as a first-order perturbation

• Imposing Fx = 0:

[

Fx

]i

j= E

[

fy′

]i

α[gx]

αβ

[

hx

j+

[

fy]i

α[gx]

αj +

[

fx′

]i

β

[

hx

j+

[

fx]i

j

= 0

=[

fy′

]i

α[gx]

αβ

[

hx

j+

[

fy]i

α[gx]

αj +

[

fx′

]i

β

[

hx

j+

[

fx]i

j= 0

a system with (n+m)×m = 6 equations and (n+m)m = 6

unknowns: nm [gx] and m2[

hx

]

• Similarly, imposing Fσ = 0:

[

]i= E

[

fy′

]i

α[gx]

αβ

[

]β+

[

fy′

]i

α[gx]

αβ [η]β

φ

[

ε′]φ

+[

fy′

]i

α[gσ]

α

+[

fy]i

α[gσ]

α +[

fx′

]i

β

[

]β+

[

fx′

]i

β[η]β

φ

[

ε′]φ

= 0

=[

fy′

]i

α[gx]

αβ

[

]β+

[

fy′

]i

α[gσ]

α +[

fy]i

α[gσ]

α +[

fx′

]i

β

[

]β= 0

a system of (m+ n) = 3 eqns and unknowns: m[

]

and n [gσ] .

• This system is linearly homogeneous in(

hσ, gσ)

→ hσ = gσ = 0

G. Violante, ”Perturbation Methods” p. 37 /59

Page 38: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Second-order perturbations

• We look for functions g and h at point (x, σ) = (x, 0) of the form:

g (x, σ) = g+gx (x− x)+gσσ+1

2(x− x)′ gxx (x− x)+

1

2(x− x)′ gxσσ+

1

2gσσσ

2

and similarly for h (x, σ) .

• Analogously to FO perturb., to find gxx and hxx we exploit Fxx = 0.

• A useful result is the following:

[

Fσx

]i

j= E

[

fy′

]i

α[gx]

αβ

[

hσx

j+

[

fy′

]i

α[gσx]

αγ

[

hx

j+

[

fy]i

α[gσx]

αj +

[

fx′

]i

β

[

hσx

j

which is a system that is linear and homogeneous in unknownshσx and gσx and therefore:

hσx = gσx = 0

G. Violante, ”Perturbation Methods” p. 38 /59

Page 39: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Second-order perturbations

• This is an important results because, coupled with hσ = gσ = 0, itmeans that the only terms that affect the decision rules are theterms 1/2gσσσ

2 and 1/2hσσσ2 that shifts up and down the

constants in the decision rules.

• To summarize:

1. The coefficients on the terms linear and quadratic in the statevector in a second-order expansion of the decision rule areindependent of the volatility of the exogenous shocks. In otherwords, these coefficients must be the same in the stochasticand the deterministic versions of the model.

2. Thus, up to second order, the presence of uncertainty affectsonly the constant term of the decision rules.

G. Violante, ”Perturbation Methods” p. 39 /59

Page 40: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Issues with higher order approximations

• Far from the approximation point they can be worse than linear,and non-monotonic in the states

1 1.5 2 2.5

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

x

ln(x)

1st

2nd

5th

25th

ln(x) 1st

2nd

5th

25th

G. Violante, ”Perturbation Methods” p. 40 /59

Page 41: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Issues with higher order approximations

• Unstable dynamics of the approximated system

0 0.5 1 1.5 2 2.5 3 3.5 4

0

0.5

1

1.5

2

2.5

3

3.5

4

x

2nd

true value 2nd 45-degree

x*

x**

G. Violante, ”Perturbation Methods” p. 41 /59

Page 42: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Textbook example of unstable dynamics

• Consider a second order approximation of a univariate decisionrule xt+1 = g(xt) around x (where xt = xt − x):

xt+1 = α0xt + α1x2t

= α0xt (1− α2xt)

where α2 = −α1/α0

• Logistic map: even if α0 < 1, it can have chaotic dynamics:

G. Violante, ”Perturbation Methods” p. 42 /59

Page 43: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Pruning (Kim, Kim, Schaumburg, and Sims, 2008)

x(n)t+1 = g(n) (xt, σ)

where (n) denotes n-th order approxim. When we simulate the model:

x(1)t+1 = g(1)

(

x(1)t , σ

)

+ ησεt = gxx(1)t + ησεt

x(2)t+1 = g(2)

(

x(2)t , σ

)

= gxx(2)t +

1

2x(2)t gxxx

(2)t +

1

2gσσσ

2 + ησεt

• Under pruning:

xPt+1 = gP

(

x(2)t , σ, x

(1)t

)

= gxx(2)t +

1

2x(1)t gxxx

(1)t +

1

2gσσσ

2+ησεt

i.e., we use the dynamics from the first order approximation in thesecond order terms. It is easy to see that it is stationary.

• It adds new state variable / changes coefficient gxx of decision rule

G. Violante, ”Perturbation Methods” p. 43 /59

Page 44: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Dynare

• It is a collection of routines which solves and simulates non-linearmodels with forward looking variables.

• It can be used in either MATLAB or Octave (an open source andfree Matlab clone). It is freely downloadable from the Dynarewebsite

http://www.dynare.org/

• Dynare can solve forward looking non-linear models under perfectforesight, when the model is deterministic, and rationalexpectations, when the model is stochastic.

• In the first case, the solution method preserves all thenon-linearities. In the second case, Dynare computes a (first orsecond order) local approximation around the steady state

G. Violante, ”Perturbation Methods” p. 44 /59

Page 45: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Equilibrium conditions for the stochastic growth model

1

ct= βEt

[

1 + rt+1 − δ

ct+1

]

wt

ct= ϕh

t

wt = (1− α) eztkαt h−αt

rt = αeztkα−1t h1−α

t

ct + kt+1 = wtht + (1 + rt) kt

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

yt = ct + it

zt = ρzt−1 + εt

8 “endogenous” variables (ct, ht, kt+1, wt, rt, it, yt, zt+1) and 8equations. One exogenous variable εt

G. Violante, ”Perturbation Methods” p. 45 /59

Page 46: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Dynare timing convention

• Predetermined variables at date t must have time index t− 1

• Rewrite system with this convention:

1

ct= βEt

[

1 + rt+1 − δ

ct+1

]

wt

ct= ϕh

t

wt = (1− α) eztkαt−1h−αt

rt = αeztkα−1t−1 h

1−αt

ct + kt = wtht + (1 + rt) kt−1

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

yt = ct + it

zt = ρzt−1 + εt

G. Violante, ”Perturbation Methods” p. 46 /59

Page 47: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Dynare program blocks

• Write a file with extension .mod and run it in Matlab by typingdynare filename. The file must contain 6 blocks:

1. Labeling block: declare endogenous variables, exogenousvariables, and parameters.

2. Parameter values block: assigns values to the parameters.

3. Model block: between model and end write your n equil.conditions

4. Initialization block: Dynare solves for the SS.

5. Shock variance block: declare the parameters that is thevariance of the shock

6. Solution block: solves model and computes IRFs

G. Violante, ”Perturbation Methods” p. 47 /59

Page 48: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Blocks 1-2

• Labeling block (endo vars, exo vars, parameters)

var c h y i w r k z;

varexo eps;

parameters gamma beta alpha delta psi rho sigma_eps;

• Parameter values block

gamma = 0.5;

beta = 0.99;

alpha = 0.333;

delta = 0.025;

psi = 1.5;

rho = 0.95;

sigma_eps = 0.01;

G. Violante, ”Perturbation Methods” p. 48 /59

Page 49: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Model Block

• Dynare’s default: linear approximation. If we want log-linearapproximations, need to specify a variable as exp(x), so that x isthe log of the variable of interest and exp(x) is the level

• Dynare knows that when there is a (+1) there is an expectation

model;

1/exp(c) = beta ∗ (1/exp(c(+1)) ∗ (1+ exp(r(+1)) − delta));

exp(w)/exp(c) = psi ∗ exp(h)ˆ(1/gamma);

exp (w) = (1− alpha)∗ exp (z)∗ exp (k(−1))ˆalpha∗ exp (h)ˆ(−alpha);

exp (r) = alpha∗ exp (z)∗ exp (k(−1))ˆ(alpha − 1)∗ exp (h)ˆ(1− alpha);

exp (c) + exp(k) = exp(w) ∗ exp(h) + (1+ exp(r)) ∗ exp(k(−1));

exp (k) = (1− delta) ∗ exp(k(−1)) + exp(i);

exp (y) = exp(c) + exp(i);

z = rho ∗ z+ eps;

end;

G. Violante, ”Perturbation Methods” p. 49 /59

Page 50: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Initialization block for steady state

• Dynare will solve for the steady state numerically, if you providean initial guess

• When giving initial values, remember that Dynare is interpretingall the variables as logs

initval;

k = log(9);

c = log(0.7);

h = log(0.3);

w = log(2);

r = log(0.02);

y = log(1);

i = log(0.3);

z = 0;

end;

G. Violante, ”Perturbation Methods” p. 50 /59

Page 51: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Initialization block for steady state

• Shock variance block

shocks;

vareps= sigma_epsˆ2d;end;

• Computation of steady state

steady;

• Solution block

stoch_simul(hpfilter=1600,order=1,irf=40);

order is the order of approximation of the model around the SS

G. Violante, ”Perturbation Methods” p. 51 /59

Page 52: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Output of Dynare

1. steady state values of endogenous variables

2. a model summary, which counts variables by type

3. covariance matrix of shocks (which in this example is a scalar)

4. the policy and transition functions (in state space notation)

ct = c+ ac,k(kt−1 − k) + ac,z−1(zt−1 − z) + ac,zεt

that can be rewritten, in more familiar notation as:

ct = c+ ac,k(kt−1 − k) + ac,z(zt − z) where ac,z =ac,z−1

ρ

5. first and second moments, correl. matrix, autocov. up to order 5

6. IRFs

G. Violante, ”Perturbation Methods” p. 52 /59

Page 53: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Occbin

• Methodology (and suite of Matlab/Dynare codes) developed byGuerrieri and Iacoviello (JME, 2015) to apply first-orderperturbation approach in a piecewise fashion in order to handleoccasionally binding constraints

• Key insight: occasionally binding constraints can be handled asdifferent regimes of the same model. Under one regime, theoccasionally binding constraint is slack. Under the other regime,the same constraint is binding. The piecewise linear solutionmethod involves linking the first-order approximation of the modelaround the same point under each regime.

• Solution is nonlinear, i.e., decision rules parameters depend onthe values of the state variables.

G. Violante, ”Perturbation Methods” p. 53 /59

Page 54: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Occbin algorithm

• Two regimes. Reference regime (R1) that includes the SS, andalternative regime (R2). Assume the alternative regime is the onewhere the constraint binds and reference where it is slack

• In the reference regime R1, the equilibrium dynamics of theendogenous state Xt linearized around SS can be expressed as:

AEtXt+1 + BXt + CXt−1 + Fzt = 0

• In the alternative regime R2 (when constraint binds), theequilibrium dynamics of the endogenous state Xt linearizedaround the SS can be expressed as:

AcEtXt+1 +BcXt + CcXt−1 +Dc + F czt = 0

• The additional vector Dc is there because the linearization istaken around a point where R1 applies.

G. Violante, ”Perturbation Methods” p. 54 /59

Page 55: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Occbin algorithm

• Define the decision rules under the reference regime

Xt = PXt−1 +Qzt

and under the alternative regime

Xt = P ct Xt−1 +Qc

tzt +Rct

note that these function are time-dependent, i.e., depend on thevalues of the states.

• For a given point in the state space (Xt−1, zt) , how do we solvefor the decision rule?

G. Violante, ”Perturbation Methods” p. 55 /59

Page 56: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Occbin algorithm

1. Guess the number of periods T ≥ 0 for which the alternativeregime applies before returning to R1.

2. Use dynamics under R2 combined with the R1 decision rule at T :

AcET [PXT−1 +QzT ]+BcXT−1+CcXT−2+Dc+F czT−1 = 0

3. Assume agents expect no shocks from t onward (violation of RE)

AcPXT−1 + BcXT−1 + CcXT−2 +Dc = 0

XT−1 = − (AcP +Bc)−1 CcXT−2 − (AcP +Bc)−1 Dc

thus P cT−1 = − (AcP +Bc)

−1Cc, Rc

T−1 = − (AcP +Bc)−1

Dc

G. Violante, ”Perturbation Methods” p. 56 /59

Page 57: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Occbin algorithm

4. Using XT−1 = P cT−1XT−2 + Rc

T−1 and the dynamics under R2,obtain XT−2 = P c

T−2XT−3 +RcT−2 and iterate back until Xt−1

where

Xt = P ct Xt−1 +Rc

t +[

− (AcP +Bc)−1 F c]

zt

... the shock reappears in the decision rule only at t

5. From stochastic paths for Xt compute expected length of R2 toverify the current guess T . If the guess is verified, stop.Otherwise, update the guess and return to step 1.

G. Violante, ”Perturbation Methods” p. 57 /59

Page 58: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Occbin algorithm

• To get the entire decision rule, you need to repeat this for very pair(X, z) in the state space

• To calculate an IRF, you need to perform this loop only once, forgiven initial conditions (X0, z1)

• To compute a stochastic simulation of length N , you need torepeat this loop N times for every pair (Xt, zt) in the state spacereached by the simulation

• ...but according to the authors, it is very fast

G. Violante, ”Perturbation Methods” p. 58 /59

Page 59: Lecture X Perturbation Methods - New York University · Lecture X Perturbation Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, ”Perturbation

Occbin

• Main advantage: like any linear solution method, delivers anonlinear solution easily even for a problem with many statevariables

• Main limit: like any linear solution method, lack of precautionarybehavior in decision rules linked to the possibility that a constraintmay bind in the future

It discards all information regarding the realization of futureshocks

E.g., in SS decision rule ignores that constraint may bebinding under some realization of the shock

G. Violante, ”Perturbation Methods” p. 59 /59