Lecture VI. Linearization Methods

Similar documents
Session 2 Working with Dynare

First order approximation of stochastic models

Stochastic simulations with DYNARE. A practical guide.

DYNARE SUMMER SCHOOL

Real Business Cycle Model (RBC)

Linearization. (Lectures on Solution Methods for Economists V: Appendix) Jesús Fernández-Villaverde 1 and Pablo Guerrón 2 February 21, 2018

Linearized Euler Equation Methods

Solving Monetary (MIU) models with Linearized Euler Equations: Method of Undetermined Coefficients

G Recitation 9: Log-linearization. Contents. 1 What is log-linearization? Some basic results 2. 2 Application: the baseline RBC model 4

Dynare. Wouter J. Den Haan London School of Economics. c by Wouter J. Den Haan

Suggested Solutions to Homework #6 Econ 511b (Part I), Spring 2004

Graduate Macroeconomics - Econ 551

Lecture 15. Dynamic Stochastic General Equilibrium Model. Randall Romero Aguilar, PhD I Semestre 2017 Last updated: July 3, 2017

Introduction to Coding DSGE Models with Dynare

Dynare Class on Heathcote-Perri JME 2002

Christiano 416, Fall 2014 Homework 1, due Wednesday, October Consider an economy in which household preferences have the following form:

The full RBC model. Empirical evaluation

DSGE-Models. Calibration and Introduction to Dynare. Institute of Econometrics and Economic Statistics

An Introduction to Perturbation Methods in Macroeconomics. Jesús Fernández-Villaverde University of Pennsylvania

... Solving Dynamic General Equilibrium Models Using Log Linear Approximation

Macroeconomics Theory II

Perturbation Methods I: Basic Results

A simple macro dynamic model with endogenous saving rate: the representative agent model

Introduction to Numerical Methods

Hansen s basic RBC model

Solving a Dynamic (Stochastic) General Equilibrium Model under the Discrete Time Framework

Solving Linear Rational Expectation Models

Deterministic Models

When Inequality Matters for Macro and Macro Matters for Inequality

Macroeconomics Theory II

Approximation around the risky steady state

Solving Deterministic Models

Perturbation and Projection Methods for Solving DSGE Models

ADVANCED MACROECONOMICS I

Simple New Keynesian Model without Capital. Lawrence J. Christiano

Solution Methods. Jesús Fernández-Villaverde. University of Pennsylvania. March 16, 2016

1. Using the model and notations covered in class, the expected returns are:

(a) Write down the Hamilton-Jacobi-Bellman (HJB) Equation in the dynamic programming

Extracting Rational Expectations Model Structural Matrices from Dynare

News-Shock Subroutine for Prof. Uhlig s Toolkit

Applications for solving DSGE models. October 25th, 2011

Suggested Solutions to Problem Set 2

Money in the utility model

1 The Basic RBC Model

The Basic RBC model with Dynare

Graduate Macro Theory II: Notes on Quantitative Analysis in DSGE Models

When Inequality Matters for Macro and Macro Matters for Inequality

MA Advanced Macroeconomics: 7. The Real Business Cycle Model

Decentralised economies I

ADVANCED MACROECONOMIC TECHNIQUES NOTE 1c

Public Economics The Macroeconomic Perspective Chapter 2: The Ramsey Model. Burkhard Heer University of Augsburg, Germany

The welfare cost of energy insecurity

The economy is populated by a unit mass of infinitely lived households with preferences given by. β t u(c Mt, c Ht ) t=0

DSGE (3): BASIC NEOCLASSICAL MODELS (2): APPROACHES OF SOLUTIONS

Solutions Methods in DSGE (Open) models

Dynamic stochastic general equilibrium models. December 4, 2007

Lecture 7: Linear-Quadratic Dynamic Programming Real Business Cycle Models

Linear and Loglinear Approximations (Started: July 7, 2005; Revised: February 6, 2009)

Small Open Economy RBC Model Uribe, Chapter 4

Advanced Econometrics III, Lecture 5, Dynamic General Equilibrium Models Example 1: A simple RBC model... 2

Computing first and second order approximations of DSGE models with DYNARE

ECON607 Fall 2010 University of Hawaii Professor Hui He TA: Xiaodong Sun Assignment 2

Lecture 4 The Centralized Economy: Extensions

Dynamic Stochastic General Equilibrium Models

Lecture 2. (1) Aggregation (2) Permanent Income Hypothesis. Erick Sager. September 14, 2015

problem. max Both k (0) and h (0) are given at time 0. (a) Write down the Hamilton-Jacobi-Bellman (HJB) Equation in the dynamic programming

Projection Methods. Michal Kejak CERGE CERGE-EI ( ) 1 / 29

What are we going to do?

Macroeconomics II Money in the Utility function

New Keynesian Macroeconomics

Perturbation and Projection Methods for Solving DSGE Models

Macroeconomics I. University of Tokyo. Lecture 13

Foundation of (virtually) all DSGE models (e.g., RBC model) is Solow growth model

The Real Business Cycle Model

Endogenous Growth. Lecture 17 & 18. Topics in Macroeconomics. December 8 & 9, 2008

Bayesian Estimation of DSGE Models: Lessons from Second-order Approximations

A comparison of numerical methods for the. Solution of continuous-time DSGE models. Juan Carlos Parra Alvarez

Perturbation Methods

The Growth Model in Continuous Time (Ramsey Model)

Resolving the Missing Deflation Puzzle. June 7, 2018

Macroeconomic Theory and Analysis Suggested Solution for Midterm 1

PANEL DISCUSSION: THE ROLE OF POTENTIAL OUTPUT IN POLICYMAKING

Signaling Effects of Monetary Policy

The Basic New Keynesian Model. Jordi Galí. June 2008

0 β t u(c t ), 0 <β<1,

Inference. Jesús Fernández-Villaverde University of Pennsylvania

u(c t, x t+1 ) = c α t + x α t+1

Problem Set 4. Graduate Macro II, Spring 2011 The University of Notre Dame Professor Sims

Rising Wage Inequality and the Effectiveness of Tuition Subsidy Policies:

Permanent Income Hypothesis Intro to the Ramsey Model

Lecture VIII. Income Process: Facts, Estimation, and Discretization

Graduate Macro Theory II: Notes on Solving Linearized Rational Expectations Models

Foundations for the New Keynesian Model. Lawrence J. Christiano

High-dimensional Problems in Finance and Economics. Thomas M. Mertens

News Driven Business Cycles in Heterogenous Agents Economies

DSGE Methods. Estimation of DSGE models: Maximum Likelihood & Bayesian. Willi Mutschler, M.Sc.

Advanced Macroeconomics II The RBC model with Capital

Lecture Notes 7: Real Business Cycle 1

SOLVING LINEAR RATIONAL EXPECTATIONS MODELS. Three ways to solve a linear model

about this, go to the following web page: michel/dynare/

Transcription:

Lecture VI Linearization Methods Gianluca Violante New York University Quantitative Macroeconomics G. Violante, Perturbation Methods p. 1 /40

Local Approximations DSGE models are characterized by a set of nonlinear equations, some of which are intertemporal Euler equations (stochastic difference equations), others are intratemporal FOCs, others feasibility/budget constraints Aim: transform the nonlinear system into a system of linear equations and use techniques from linear RE to solve it To do this transformation, we use local approximations: the idea is to obtain a good approximation of the function in a neighborhood 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, but with small shocks and no occasionally binding constraints. G. Violante, Perturbation Methods p. 2 /40

Taylor principle The starting point of this theory is Taylor s theorem. Suppose f : R R is a C function, then for any x in its domain we have f (x) f (x )+f (x )(x x )+ 1 2 f (x )(x x ) 2 +... + 1 n! f(n) (x )(x x ) n +O n+1 so the error is asymptotically smaller than any of its terms. Taylor s theorem says the RHS polynomial approximation is good near x. But how near is near? More in general, write the power series expansion of f around x : f (x) = α k (x x ) k where α k = 1 k! f(k) (x ) k=0 G. Violante, Perturbation Methods p. 3 /40

Taylor principle Theorem: Consider the power series k=0 α k(x x ) k. If it converges for x = x r, it converges for x < x r. Then, we can define the radius of convergence of the power series as the quantity r > 0 s.t.: r = sup { x x : } α k (x x ) k < k=0 r provides the maximal radius around x s.t. series converges. Definition. A function f : Ω C is said to be analytic on the open set Ω if, for every x Ω, there exists a sequence {α k } and a radius r > 0 such that f admits representation: f (x) = α k (x x ) k for x x < r k=0 G. Violante, Perturbation Methods p. 4 /40

Taylor principle f analytic locally given by a convergent power series If f is analytic at x, then f has continuous derivatives of all orders at x (not too surprising...) A point where f is not analytic is called a singularity of f. That s where the local approximation fails Example: tangent function with power series representation: tan(x) = sinx cosx = k=0 ( 1)k x 2k 2k! k=0 ( 1)k x 2k+1 (2k+1)! has a singularity at x 0 = π/2 for which cos(x) = 0. G. Violante, Perturbation Methods p. 5 /40

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 f exhibits a singularity at x 0, then the radius of convergence of the Taylor series expansion of f in the neighborhood of x is bounded above by x 0 x. This theorem gives us a guideline to use Taylor series expansions: it tells us that the power series evaluated at x cannot deliver an accurate approximation for f at any point farther away from x than any singular point of f. G. Violante, Perturbation Methods p. 6 /40

Taylor principle Example I: log(1 x) with singularity at 1. x log(1 x) Taylor 100 at x = 0 0.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) and steady-state k = 0.5. The function has a singularity at x 0 = 0 (first derivative), and hence the Taylor expansion has a radius bounded above by 0.5. Bottom line: when you linearize, think about the radius of convergence (calibration-specific) G. Violante, Perturbation Methods p. 7 /40

Linearization of FOCs Consider the standard deterministic growth model: k t+1 k α t +c t (1 δ)k t = 0 (1) 1 c t β 1 c t+1 ( αk α 1 t+1 +1 δ) = 0 (2) Let ˆk t k t k and ĉ c t c be level-deviations from SS The feasibility constraint (1) is an equation g(k t+1,k t,c t ) = 0: g(k t+1,k t,c t ) = g +g1ˆk t+1 +g2ˆk t +g3ĉ t = ˆk [ t+1 α(k ) α 1 +(1 δ)]ˆkt +ĉ since g = 0 (SS equilibrium condition) G. Violante, Perturbation Methods p. 8 /40

Linearization of FOCs 1 β 1 ( αk α 1 t+1 c t c +1 δ) = 0 (2) t+1 The EE (2) is an equation of the form g(c t,c t+1,k t+1 ) = 0: 0 = g +g 1ĉ t +g 2ĉ t+1 +g 3ˆk t+1 0 = 1 (c ) 2ĉt +β Simplifying: [ ] α(k ) α 1 +1 δ (c ) 2 ĉ t+1 β α(α 1)(k ) c α 2 ˆkt+1 0 = ĉ t +β [ ] ( ) α(k ) α 1 c +1 δ ĉ t+1 βα(α 1) k (k ) α 1ˆkt+1... and we are done G. Violante, Perturbation Methods p. 9 /40

Log-linearization of FOCs Another common practice is to take a log-linear approximation to the equilibrium It delivers a natural interpretation of the coefficients in front of the variables: these can be interpreted as elasticities. Define log-deviations from SS: ˆx = log(x) log(x ) and now linearize around log(x ) First-order Taylor exp. of g(x) = g(exp(logx)) around log(x ): g(x) g(exp(logx ))+g x (exp(logx ))exp(logx )ˆx = g +g xx ˆx G. Violante, Perturbation Methods p. 10 /40

Log-linearization of feasibility constraint g(k t+1,k t,c t ) = k t+1 k α t +c t (1 δ)k t = 0 Log-linearization: g(k t+1,k t,c t ) = g +g 1 k ˆkt+1 +g 2 k ˆkt +g 3 c ĉ t = k ˆkt+1 α(k ) αˆkt +c ĉ t (1 δ)k ˆkt G. Violante, Perturbation Methods p. 11 /40

Alternative approach There is a simple way to do it w/o computing derivatives based on three building blocks: 1. Log approximation: ax = ax exp(logx logx ) = ax exp(ˆx) ax (1+ ˆx) 2. Steady-state relation all additive constants, like ax 1 above, drop out because each log-linearized equation is a SS relationship: g(k,k,c ) = 0 3. Second order terms negligible and set to zero: ˆxŷ = 0 G. Violante, Perturbation Methods p. 12 /40

Log-linearization of feasibility constraint k t+1 kt α +c t (1 δ)k t = 0 ) [ )] α ) k exp (ˆkt+1 (k )exp(ˆkt +c exp(ĉ t ) (1 δ)k exp (ˆkt = 0 ) [ )] ) k exp (ˆkt+1 (k ) α exp (αˆk t +c exp(ĉ t ) (1 δ)k exp (ˆkt = 0 k ( 1+ˆk t+1 ) [(k ) α( 1+αˆk t )]+c (1+ĉ t ) (1 δ)k ( ) 1+ˆk t = 0 k ˆkt+1 α(k ) αˆkt +c ĉ (1 δ)k ˆk = 0 where the last line uses the SS restriction: k (k ) α +c (1 δ)k = 0 Same expression as the one on slide 11. G. Violante, Perturbation Methods p. 13 /40

Log-linearization of Euler equation 0 = 1 c t β 1 c t+1 ( αk α 1 t+1 +1 δ ) 1 0 = c exp(ĉ t ) β 1 c exp(ĉ t+1 ) ( c exp(ĉ t+1 ) = βc exp(ĉ t ) α(k ) α 1 exp [ exp(ĉ t+1 ) = βexp(ĉ t ) α(k ) α 1 exp ( ) ) α 1 α(k ) α 1 exp (ˆkt+1 +1 δ ((α 1)ˆk t+1 ) ((α 1)ˆk t+1 ) ) +1 δ ] +1 δ ] +1 δ = βexp(ĉ t ) [α(k ) α 1( ) 1+(α 1)ˆk t+1 [ ] = exp(ĉ t ) βα(k ) α 1 +β(α 1)ˆk t+1 α(k ) α 1 +β(1 δ) = exp(ĉ t ) [1+β(α 1)ˆk t+1 α(k ) α 1] where the last line uses the SS version of the EE. Taking logs: ĉ t+1 = ĉ t +β(α 1)ˆk t+1 α(k ) α 1 G. Violante, Perturbation Methods p. 14 /40

The method of undetermined coefficients This is Uhlig s toolkit method Alternative classic methods 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 /40

Strategy 1. Derive the nonlinear dynamic system that characterizes the model economy (same number of equations and unknowns) 2. Compute the steady state. 3. (Log) linearize the nonlinear system around the SS. The system is linear in controls and (exogenous and endogenous) state variables. Some eqns are difference eqns. 4. Express the linear system in some matrix representation. This representation is what differs across solution methods. 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., linear functions from the states at t to the states at t+1. G. Violante, Perturbation Methods p. 16 /40

Stochastic growth model with leisure and 2 shocks Household problem: s.t. max {c t,k t+1,h t } E 0 t=0 1 β t logc t ϕ h1+ γ t 1+ 1 γ c t +k t+1 = (1 τ)w t h t +(1+r t δ)k t Firm problem: max {h t,k t } ez t kt α h 1 α t w t h t r t k t Government: ḡe g t = τw t h t, with g t+1 = ρ g g t +σ g η t+1 Laws of motion for capital and productivity: k t+1 = (1 δ)k t +i t z t+1 = ρ z z t +σ z ε t+1 G. Violante, Perturbation Methods p. 17 /40

Step 1: Equilibrium conditions w t 1 c t = βe t (1 τ) = ϕh 1 γ t c t [ ] 1+rt+1 δ c t+1 w t = (1 α)e z t kt α h α t r t = αe z t kt α 1 h 1 α t ḡe g t = τw t h t c t +k t+1 = (1 τ)w t h t +(1+r t δ)k t k t+1 = (1 δ)k t +i t z t+1 = ρz t +σ z ε t+1 g t+1 = ρ g g t +σ g η t+1 We can exclude the law of motion for k from the system because, once we know k t+1 we know i t, and i t does not enter anywhere else. And we can substitute the tax revenues out from the household BC. G. Violante, Perturbation Methods p. 18 /40

Step 1: Reduced system of equilibrium conditions w t 1 c t = βe t (1 τ) = ϕh 1 γ t c t [ ] 1+rt+1 δ c t+1 w t = (1 α)e z t kt α h α t r t = αe z t kt α 1 h 1 α t c t +k t+1 +ḡe g t = w t h t +(1+r t δ)k t z t+1 = ρz t +σ z ε t+1 g t+1 = ρ g g t +σ g η t+1 At any t, (k t,z t,g t ) are pre-determined 3 choice variables (c t,k t+1,h t ) and 2 prices (w t,r t ) to be determined (by the first 5 equations) plus 2 equations for law of motions of the exogenous states G. Violante, Perturbation Methods p. 19 /40

Step 2: SS system Set z = ḡ = 0. Evaluate at SS the first 5 equations: Solve for: ( k, h, c, w, r ) r = 1 β 1+δ ( k 1/β 1+δ h = α w = (1 α) c+ḡ = w h+ r k w c (1 τ) = ϕ h 1 γ ( k h ) α ) 1 α 1 G. Violante, Perturbation Methods p. 20 /40

Step 3: Log-linearize around SS Euler equation: 1 c t 1 ceĉt 1 eĉt 1 eĉt = βe t [ ] 1+rt+1 δ c t+1 [ 1+ reˆr t+1 ] δ = βe t ceĉt+1 [ ] 1+ r(1+ ˆrt+1 ) δ = βe t eĉt+1 [ ] 1+ r + rˆrt+1 δ = βe t eĉt+1 e ĉ t = E t [ (1+β rˆrt+1 )e ĉ t+1 ] 1 ĉ t = E t [(1+β rˆr t+1 )(1 ĉ t+1 )] 0 = E t [β rˆr t+1 ĉ t+1 +ĉ t ] G. Violante, Perturbation Methods p. 21 /40

Step 3: Log-linearize Intratemporal FOC: w t (1 τ) = ϕh 1 γ t c t eŵt = 1 eĥt γ eĉt ĥ t = γ(ŵ t ĉ t ) Firm s FOC for labor: w t = (1 α)e z t kt α h α t ) ŵ t = z t +α(ˆkt ĥt Firm s FOC for capital: ) ˆr t = z t +(1 α) (ĥt ˆk t G. Violante, Perturbation Methods p. 22 /40

Step 3: Log-linearize Budget constraint: c t +ḡe g t +k t+1 = w t h t +(1+r t δ)k t ceĉt +ḡe g t + keˆk t+1 = w heŵt+ĥt + ( reˆr t +1 δ) keˆkt c(1+ĉ t )+ḡ(1+g t )+ k (1+ ˆk ) t+1 ( ) = w h(1+ŵ t ) 1+ĥt + r(1+ ˆr t ) k (1+ ˆk ) ) t +(1 δ) k (1+ˆk t cĉ t +ḡg t + kˆk t+1 = w h ( ) ŵ t +ĥt + r k (ˆr t + ˆk ) t +(1 δ) kˆk t G. Violante, Perturbation Methods p. 23 /40

Step 3: Log-linearize Final log-linear system: 0 = E t [β rˆr t+1 ĉ t+1 +ĉ t ] ĥ t = γ(ŵ t ĉ t ) ˆr t = z t +(1 α) (ĥt ˆk ) t ) ŵ t = z t +α(ˆkt ĥt cĉ t +ḡg t + kˆk ( ) t+1 = w h ŵ t +ĥt + r k (ˆr t + ˆk ) t +(1 δ) kˆk t Substitute away factor prices (last eqn. uses CRS: ȳ = r k + w h) [ 0 = E t {β r z t+1 +(1 α) (ĥt+1 ˆk } t+1 )] ĉ t+1 +ĉ t ĥ t [ ] = γ z t +α(ˆkt ĥt ) ĉ t cĉ t +ḡg t + kˆk t+1 [ ] = ȳ z t +αˆk t +(1 α)ĥt +(1 δ) kˆk t G. Violante, Perturbation Methods p. 24 /40

Step 3: Log-linearize Now substitute away consumption in the EE using the intratemporal FOC: [ E t {β r z t+1 +(1 α) (ĥt+1 ˆk )] ) t+1 z t+1 α(ˆkt+1 ĥt+1 + 1 } ĥ t+1 = γ ) z t +α(ˆkt ĥt 1 γ ĥ t [ ) c z t +α(ˆkt ĥt 1 ĥ t ]+ḡg t + kˆk [ ] t+1 = ȳ z t +αˆk t +(1 α)ĥt +(1 δ) kˆk t γ z t+1 = ρz t +σ z ε t+1 g t+1 = ρ g g t +σ g η t+1 We cannot reduce the dimensionality of the system further. Note: the variance of the shock does not affect any of the first two equilibrium equations. Certainty equivalence holds. G. Violante, Perturbation Methods p. 25 /40

Step 4: Solve the system To ease the notation, express the system in recursive form and collect terms: ] 0 = E[ˆk +φ 1ˆk +φ2 ĥ +φ 3 ĥ+φ 4 z +φ 5 z 0 = ˆk +φ 8ˆk +φ9 ĥ+φ 10 z +φ 11 g z = ρ z z +σ z ε g = ρ g g +σ g η We are looking for a linear solution to the system of the form: ˆk = λ 1ˆk +λ2 z +λ 3 g ĥ = λ 4ˆk +λ5 z +λ 6 g We want to express the λ s as a function of the φ s and the ρ s G. Violante, Perturbation Methods p. 26 /40

Step 4: Solve the system Substituting 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 ρ z +φ 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 ρ z +φ 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 /40

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 and collapse the other terms with M so L = 0. Note also that the C is a square matrix, in our case (1,1) so it can be inverted. When it is not square, you have to amend a bit the strategy. G. Violante, Perturbation Methods p. 28 /40

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 /40

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 1 AP 2 ( JC 1 B +KC 1 A G ) P ( KC 1 B H ) = 0 This is a quadratic matrix equation in P. A number of ways to solve this problem. Uhlig suggests using the generalized eigenvalue problem (also called the QZ decomposition or generalized Schur decomposition) P,R. Now we need Q,S G. Violante, Perturbation Methods p. 30 /40

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 1 A ) Q JC 1 AQN JC 1 DN KC 1 D +M = 0 Q is the only unknown, but not trivial as Q is sandwiched in some terms. Use vec(axb) = ( B T A ) vec(x), where is the Kronecker product, to pull out the sandwiched X matrix. Apply this vectorization to equation (4) to obtain Q: 0 = I ( G+JR KC 1 A ) vec(q) N T ( JC 1 A ) vec(q) vec(jc 1 DN KC 1 D +M) [ vec(q) = I ( G+JR KC 1 A ) N T ( JC 1 A )] 1 vec(jc 1 DN KC 1 D +M) G. Violante, Perturbation Methods p. 31 /40

Dynare It is a collection of routines which solves and simulates non-linear models with forward looking variables. It can be used in either MATLAB or Octave (an open source and free Matlab clone). It is freely downloadable from the Dynare website http://www.dynare.org/ Dynare can solve forward looking non-linear models under perfect foresight, when the model is deterministic, and rational expectations, when the model is stochastic. In the first case, the solution method preserves all the non-linearities. In the second case, Dynare computes a (first or second order) local approximation around the steady state G. Violante, Perturbation Methods p. 32 /40

Equilibrium conditions for the stochastic growth model 1 c t w t = βe t = ϕh 1 γ t c t w t r t [ ] 1+rt+1 δ c t+1 = (1 α)e z t kt α h α t = αe z t kt α 1 h 1 α t c t +k t+1 = w t h t +(1+r t )k t k t+1 = (1 δ)k t +i t y t z t+1 = c t +i t = ρz t +σ z ε t 8 endogenous variables (c t,h t,k t+1,w t,r t,i t,y t,z t+1 ) and 8 equations. One exogenous variable ε t G. Violante, Perturbation Methods p. 33 /40

Dynare timing convention Predetermined variables at date t must have time index t 1 Rewrite system with this convention: 1 c t w t = βe t = ϕh 1 γ t c t w t r t [ ] 1+rt+1 δ c t+1 = (1 α)e z t k α t 1h α t = αe z t kt 1 α 1 h1 α t c t +k t k t y t z t = w t h t +(1+r t )k t 1 = (1 δ)k t 1 +i t = c t +i t = ρz t 1 +σ z ε t G. Violante, Perturbation Methods p. 34 /40

Dynare program blocks Write a file with extension.mod and run it in Matlab by typing dynare filename. The file must contain 6 blocks: 1. Labeling block: declare endogenous variables, exogenous variables, 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 the variance of the shock 6. Solution block: solves model and computes IRFs G. Violante, Perturbation Methods p. 35 /40

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. 36 /40

Model Block Dynare s default: linear approximation. If we want log-linear approximations, need to specify a variable as exp(x), so that x is the 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. 37 /40

Initialization block for steady state Dynare will solve for the steady state numerically, if you provide an initial guess When giving initial values, remember that Dynare is interpreting all 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. 38 /40

Initialization block for steady state Shock variance block shocks; vareps= sigma_epsˆ2; 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. 39 /40

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) c t = c+a c,k (k t 1 k)+a c,z 1 (z t 1 z)+a c,z ε t that can be rewritten, in more familiar notation as: c t = c+a c,k (k t 1 k)+a c,z (z t z) where a c,z = a c,z 1 ρ 5. first and second moments, correl. matrix, autocov. up to order 5 6. IRFs G. Violante, Perturbation Methods p. 40 /40