Dynare Class on Heathcote-Perri JME 2002

Similar documents
Stochastic simulations with DYNARE. A practical guide.

Comprehensive Exam. Macro Spring 2014 Retake. August 22, 2014

Macroeconomics Qualifying Examination

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

Notes on Alvarez and Jermann, "Efficiency, Equilibrium, and Asset Pricing with Risk of Default," Econometrica 2000

The Small-Open-Economy Real Business Cycle Model

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

Neoclassical Business Cycle Model

Lecture 2. (1) Permanent Income Hypothesis (2) Precautionary Savings. Erick Sager. February 6, 2018

Notes on Winnie Choi s Paper (Draft: November 4, 2004; Revised: November 9, 2004)

Equilibrium in a Production Economy

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

Global Value Chain Participation and Current Account Imbalances

Small Open Economy RBC Model Uribe, Chapter 4

1 The Basic RBC Model

Chapter 4. Applications/Variations

Business Cycles and Exchange Rate Regimes

New Notes on the Solow Growth Model

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

Ramsey Cass Koopmans Model (1): Setup of the Model and Competitive Equilibrium Path

1 Two elementary results on aggregation of technologies and preferences

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

1 Bewley Economies with Aggregate Uncertainty

RBC Model with Indivisible Labor. Advanced Macroeconomic Theory

Macroeconomic Theory and Analysis V Suggested Solutions for the First Midterm. max

Pricing To Habits and the Law of One Price

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

Competitive Equilibrium and the Welfare Theorems

Macroeconomic Theory and Analysis Suggested Solution for Midterm 1

Dynamics of Firms and Trade in General Equilibrium. Robert Dekle, Hyeok Jeong and Nobuhiro Kiyotaki USC, Seoul National University and Princeton

Uncertainty Per Krusell & D. Krueger Lecture Notes Chapter 6

Macroeconomic Topics Homework 1

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

Real Business Cycle Model (RBC)

The TransPacific agreement A good thing for VietNam?

Monetary Economics: Solutions Problem Set 1

The Real Business Cycle Model

Lecture 4 The Centralized Economy: Extensions

Closing Small Open Economy Models

Lecture notes on modern growth theory

Advanced Macroeconomics II. Real Business Cycle Models. Jordi Galí. Universitat Pompeu Fabra Spring 2018

Macroeconomics Theory II

MA Advanced Macroeconomics: 7. The Real Business Cycle Model

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

Problem 1 (30 points)

Solutions Methods in DSGE (Open) models

Graduate Macroeconomics - Econ 551

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

Advanced Macroeconomics

CEMMAP Masterclass: Empirical Models of Comparative Advantage and the Gains from Trade 1 Lecture 3: Gravity Models

Graduate Macroeconomics 2 Problem set Solutions

Lecture 1: Introduction

Homework 3 - Partial Answers

Introduction to Coding DSGE Models with Dynare

CIRPÉE Centre interuniversitaire sur le risque, les politiques économiques et l emploi

Lecture 5: Competitive Equilibrium in the Growth Model

6. Open Economy Models

Economics 232c Spring 2003 International Macroeconomics. Problem Set 3. May 15, 2003

A Modern Equilibrium Model. Jesús Fernández-Villaverde University of Pennsylvania

The Ramsey Model. (Lecture Note, Advanced Macroeconomics, Thomas Steger, SS 2013)

Econ 204A: Section 3

Small Open Economy. Lawrence Christiano. Department of Economics, Northwestern University

Economics 2010c: Lecture 3 The Classical Consumption Model

ECON FINANCIAL ECONOMICS

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

Macroeconomics Qualifying Examination

4- Current Method of Explaining Business Cycles: DSGE Models. Basic Economic Models

Macroeconomics Theory II

Graduate Macro Theory II: Business Cycle Accounting and Wedges

Permanent Income Hypothesis Intro to the Ramsey Model

Government The government faces an exogenous sequence {g t } t=0

Part A: Answer question A1 (required), plus either question A2 or A3.

Advanced Macroeconomics

Deep Habits: Technical Notes

Topic 3. RBCs

UNIVERSITY OF WISCONSIN DEPARTMENT OF ECONOMICS MACROECONOMICS THEORY Preliminary Exam August 1, :00 am - 2:00 pm

Income Inequality, Trade and Financial Openness

Topic 2. Consumption/Saving and Productivity shocks

NBER WORKING PAPER SERIES CLOSING SMALL OPEN ECONOMY MODELS. Stephanie Schmitt-Grohé Martín Uribe. Working Paper 9270

General Equilibrium and Welfare

Lecture 6: Competitive Equilibrium in the Growth Model (II)

Relationships between phases of business cycles in two large open economies

1. Money in the utility function (start)

General Examination in Macroeconomic Theory SPRING 2013

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

Modelling Czech and Slovak labour markets: A DSGE model with labour frictions

14.452: Introduction to Economic Growth Problem Set 4

The full RBC model. Empirical evaluation

STATE UNIVERSITY OF NEW YORK AT ALBANY Department of Economics

Econ 5110 Solutions to the Practice Questions for the Midterm Exam

Explaining the Effects of Government Spending Shocks on Consumption and the Real Exchange Rate. M. Ravn S. Schmitt-Grohé M. Uribe.

Autarky Equilibrium for Home Country

Financial Factors in Economic Fluctuations. Lawrence Christiano Roberto Motto Massimo Rostagno

TECHNICAL APPENDIX. 7. Agents Decisions in the Cobb-Douglas Case

Handout: Competitive Equilibrium

The Basic RBC model with Dynare

Learning to Optimize: Theory and Applications

ECOM 009 Macroeconomics B. Lecture 2

Redistributive Taxation in a Partial-Insurance Economy

ECON 5118 Macroeconomic Theory

Transcription:

Dynare Class on Heathcote-Perri JME 2002 Tim Uy University of Cambridge March 10, 2015

Introduction Solving DSGE models used to be very time consuming due to log-linearization required Dynare is a collection of Matlab codes that essentially allows you to solve models without having to do log-linearization It is also useful for estimating and simulating a wide variety of models and hence is becoming increasingly more popular It is limited by its inability to handle models that require global solution methods (e.g. discrete choice, etc)

Introduction To set up Dynare, simply download it from the Dynare website Choose a destination folder for storing the files, and set the Matlab path to include this folder To solve your model, create a filename.mod file that contains the model equations and parameterization Then simply type dynare filename and off you go!

This Class In this class, we will focus on the models in Heathcote Perri JME (2002) There are essentially three models discussed in that paper: a model with complete markets (CM), a bond economy (BE), and an environment with financial autarky (FA) I will go over the models and then talk about how I implement them in Dynare I will share my code with you but it is only meant to be for students in this class- please ask for my permission before sharing them with anyone else

Heathcote and Perri JME 2002 Two-country, two-good IRBC model with production There are two shocks in the economy: productivity shocks that are highly persistent and correlated across countries Capital and labor are not mobile across countries, and preferences are non-separable in consumption and leisure The three model setups only differ in asset trade that shows up in the budget constraint faced by households With CM, households have access to a full set of Arrow securities (state-contingent claims on output); With BE, households only have access to a non-contingent bond; under FA, households do not trade assets, only goods FA comes closest to matching data on RER volatility and cross-country correlations (positive for investment, labor, etc)

Intuition Three shortcomings of the standard IRBC model: cross-country consumption levels more correlated than output, negative cross-country correlation in investment and labor, and relatively non-volatile RER This is best understood from a CM perspective: CM provides insurance against output shocks so that consumption becomes strongly positively correlated across countries (risk sharing) With a positive shock in country A, CM implies moving resources from B to A to increase investment and labor in A, hence the negative cross-country correlation RER need not be volatile as adjustment in quantities mitigates adjustment to prices induced by productivity shock BE is close to CM because it still allows agents to borrow abroad, so shock need not imply big TOT adjustment and shocks are small (so gains from pooling risks are small)

Model Period utility Production function U(c i, 1 n i ) = 1 γ [cµ i (1 n i ) 1 µ ] γ F (z, k i, n i ) = exp(z i )k θ i n 1 θ i Law of motion for vector of shocks z = [z 1, z 2 ] z t = Az t 1 + ɛ t where A is a 2x2 matrix and ɛ is a 2x1 vector of iid random variables with covariance matrix Σ. History dependence is suppressed when possible to simplify notation.

Model Capital accumulation k it+1 = (1 δ)k it + x it Goods production Home: G 1 (a 1, b 1 ) = [ωa σ 1 σ 1 + (1 ω)b σ 1 σ Foreign: 1 ] G 2 (a 2, b 2 ) = [(1 ω)a σ 1 σ 2 + ωb σ 1 σ 2 ] Two key parameters: ω > 0.5 home bias, σ elasticity of substitution Firm problem max a i,b i G i (a i, b i ) q a i a i q b i b i

Budget constraints Complete markets c 1 (s t ) + x 1 (s t ) + q1(s a t ) Q(s t, s t+1 )B 1 (s t, s t+1 ) = s t+1 q1(s a t )[r 1 (s t )k 1 (s t ) + w 1 (s t )n 1 (s t )] + q1(s a t )B 1 (s t ) Bond economy c 1 (s t ) + x 1 (s t ) + q1(s a t )Q(s t )B 1 (s t ) = q1(s a t )[r 1 (s t )k 1 (s t ) + w 1 (s t )n 1 (s t )] + q1(s a t )B 1 (s t 1 ) Financial autarky c 1 (s t ) + x 1 (s t ) = q1(s a t )[r 1 (s t )k 1 (s t ) + w 1 (s t )n 1 (s t )]

Market Clearing Intermediate goods a and b a 1 + a 2 = F (z 1, k 1, n 1 ) b 1 + b 2 = F (z 2, k 2, n 2 ) Final goods c i + x i = G i (a i, b i ), i = 1, 2 Bond markets B 1 (s t, s t+1 ) + B 2 (s t, s t+1 ) = 0, [CM] B 1 (s t ) + B 2 (s t ) = 0, [BE]

Additional Variables of Interest GDP Net exports (for country 1) y i = q a 1F (z 1, k 1, n 1 ) nx = qa 1 a 2 q b 1 b 1 y 1 Import ratio: ratio of imports to non-traded domestic intermediate good production ir = qb 1 qa 1 Terms of trade: price of imports to exports p = qb 1 q a 1 = 1 ω ω 1 ir σ Real Exchange Rate: price of consumption in 2 relative to 1 rx = qa 1 q a 2 = qb 1 q b 2

Implementation in Dynare: CM Endogenous variables v a r G1, G2, F1, F2, y1, y2, c1, c2, n1, n2, k1, k2, x1, x2, a1, a2, b1, b2, z1, z2, qa1, qb1, qa2, qb2, nx, xp, im, p, rx, i r 1, i r 2 ; Exogenous variables v a r e x o e1, e2 ; Parameters p a r a m e t e r s omega, theta, p1, p2, p3, p4, sigma, gamma, beta, mu, d e l t a ;

Implementation in Dynare: CM Parameters values omega = 0. 8 7 3 ; t h e t a = 0. 3 6 ; p1 = 0. 9 7 ; p2 = 0. 0 2 5 ; p3 = 0. 0 2 5 ; p4 = 0. 9 7 ; sigma = 0. 9 0 ; gamma = 1; beta = 0. 9 9 ; mu = 0. 3 4 ; d e l t a = 0. 0 2 5 ;

Implementation in Dynare: CM Model: market clearing conditions model ; a1 + a2 = F1 ; b1 + b2 = F2 ; c1 + k1 (1 d e l t a ) k1 ( 1) = G1 ; c2 + k2 (1 d e l t a ) k2 ( 1) = G2 ; Production functions G1 = ( omega a1 ˆ ( ( sigma 1)/ sigma )+(1 omega ) b1 ˆ ( ( sigma 1)/ sigma ) ) ˆ ( sigma /( sigma 1)); G2 = ( omega b2 ˆ ( ( sigma 1)/ sigma )+(1 omega ) a2 ˆ ( ( sigma 1)/ sigma ) ) ˆ ( sigma /( sigma 1)); F1 = exp ( z1 ) k1 ( 1)ˆ t h e t a n1ˆ(1 t h e t a ) ; F2 = exp ( z2 ) k2 ( 1)ˆ t h e t a n2ˆ(1 t h e t a ) ;

Implementation in Dynare: CM Shock processes z1 = p1 z1 ( 1) + p2 z2 ( 1) + e1 ; z2 = p3 z1 ( 1) + p4 z2 ( 1) + e2 ; Intertemporal Euler equations for capital (2) Intratemporal Euler equations for consumption and leisure (2) International risk sharing conditions for a and b These 16 equations determine a1, a2, b1, b2, G1, G2, F 1, F 2, z1, z2, c1, c2, k1, k2, n1, n2

Implementation in Dynare: CM Equations to determines other endogenous variables: prices qa1 = G1ˆ(1/ sigma ) omega a1ˆ( 1/ sigma ) ; qb1 = G1ˆ(1/ sigma ) (1 omega ) b1ˆ( 1/ sigma ) ; qa2 = G2ˆ(1/ sigma ) (1 omega ) a2ˆ( 1/ sigma ) ; qb2 = G2ˆ(1/ sigma ) omega b2ˆ( 1/ sigma ) ; Relative prices p = qb1/qa1 ; r x = qa1 /qa2 ; GDP y1 = qa1 F1 ; y2 = qb2 F2 ;

Implementation in Dynare: CM Additional equations for other interesting variables xp = a2 ; im = b1 ; x1 = k1 (1 d e l t a ) k1 ( 1); x2 = k2 (1 d e l t a ) k2 ( 1); nx = ( a2 p b1 )/ y1 ; i r 1 = b1/a1 ; i r 2 = b2/a2 ; end ; We started out by declaring 31 endogenous variables; combining these 15 equations to the 16 mentioned earlier yields the system of 31 equations needed to solve the model

Implementation in Dynare: CM Provide initial values for endogenous variables i n i t v a l ; G1 = 1. 6 5 1 9 ; G2 = 1. 6 5 1 9 ; F1 = 1. 5 1 0 3 ; F2 = 1. 5 1 0 3 ; c1 = 1. 2 2 8 3 ; c2 = 1. 2 2 8 3 ; n1 = 0. 3 8 7 7 ; n2 = 0. 3 8 7 7 ;... end ;

Implementation in Dynare: CM Specify shock process s h o c k s ; v a r e1 ; s t d e r r 0. 0 0 7 3 ; v a r e2 ; s t d e r r 0. 0 0 7 3 ; v a r e1, e2 = 0. 2 9 0. 0 0 7 3 0. 0 0 7 3 ; end ; Ask Dynare to check to make sure the model can be solved s t e a d y ; check ; Specify what to do with the model s t o c h s i m u l ( o r d e r = 1, h p f i l t e r = 1600, i r f =0);

CM vs BE and FA Notice that in solving the CM economy we did not solve for the decentralized equilibrium The welfare theorems and functional forms assumed allow us to solve the planning problem instead This will no longer be the case in BE and FA When markets are not complete, we will have to solve for the decentralized equilibrium directly The main difference is that now we have to solve for prices explicitly as part of equilibrium

Implementation in Dynare: FA What are the differences relative to CM? The main difference is in the budget constraint, which we now specify explicitly c1 + x1 = qa1 ( r1 k1( 1)+w1 n1 ) ; c2 + x2 = qb2 ( r2 k2( 1)+w2 n2 ) ; What conditions did these equations replace? We still have the same number of endogenous variables p = qb1/qa1 ; r x = qa1 /qa2 ; The international risk sharing conditions! Why? (Hint: Walras Law.)

Implementation in Dynare: FA Are there other differences? For completeness, we also specify the prices, which are technically required to complete equilibrium r1 = t h e t a F1 /( k1 ( 1)); r2 = t h e t a F2 /( k2 ( 1)); w1 = (1 t h e t a ) F1/n1 ; w2 = (1 t h e t a ) F2/n2 ; Given that we ve added these conditions, what other parts of the code have to be modified? Hint: number of equations = number of? What else is required to solve the model?

Implementation in Dynare: FA The two places that have to be updated are: (1) the var list, and the (2) initval conditions We have introduced four new variables v a r G1, G2, F1, F2, y1, y2, c1, c2, n1, n2, k1, k2, x1, x2, a1, a2, b1, b2, z1, z2, qa1, qa2, qb1, qb2, i r 1, i r 2, p, rx, xp, im, nx, r1, r2, w1, w2 ; Four initial values to help Dynare find steady state r1 = 0. 0 5 2 5 ; r2 = 0. 0 5 2 5 ; w1 = 1. 8 9 0 5 ; w2 = 1. 8 9 0 5 ;

Implementation in Dynare: FA and BE Do we expect something similar for BE? No. Why not? Which conditions change? Hint 1: think about the conditions that are affected by the budget constraint Hint 2: a more subtle point - is FA really that different from CM (when you think from a planner s perspective)

Implementation in Dynare: BE Relative to FA, these conditions are different: B1 + B2 = 0 ; c1 + x1 + qa1 Q B1 + qa1 p h i B1ˆ2 = qa1 ( r1 k1( 1)+w1 n1 ) + qa1 B1( 1); c2 + x2 + qa1 Q B2 + qa1 p h i B2ˆ2 = qb2 ( r2 k2( 1)+w2 n2 ) + qa1 B2( 1); ( c1 ˆmu (1 n1 )ˆ(1 mu) ) ˆgamma/ c1 (Q qa1+2 qa1 p h i B1) = beta ( ( c1 (+1))ˆmu (1 n1 (+1))ˆ(1 mu) ) ˆgamma/ c1 (+1) qa1 (+1); ( c2 ˆmu (1 n2 )ˆ(1 mu) ) ˆgamma/ c2 (Q qa1+2 qa1 p h i B2) = beta ( ( c2 (+1))ˆmu (1 n2 (+1))ˆ(1 mu) ) ˆgamma/ c2 (+1) qa1 (+1); What are these conditions, and why are they different?

Implementation in Dynare: BE First, ask the following question: do we need to introduce new variables relative to FA? Yes. We need to have bonds in each country. Anything else? Yes. The bond needs to have a price in equilibrium. What does this mean? If we have three new variables, we only need three new equations. Why do we have five? (Hint: remember what changed in FA relative to CM)

Implementation in Dynare: BE The budget constraints also change, hence five equations between the two setups: three new equations and two modified budget constraints Where are the three new equations coming from? One is obvious: bond market clearing. What about the other two? What are ( c1 ˆmu (1 n1 )ˆ(1 mu) ) ˆgamma/ c1 (Q qa1+2 qa1 p h i B1) = beta ( ( c1 (+1))ˆmu (1 n1 (+1))ˆ(1 mu) ) ˆgamma/ c1 (+1) qa1 (+1); ( c2 ˆmu (1 n2 )ˆ(1 mu) ) ˆgamma/ c2 (Q qa1+2 qa1 p h i B2) = beta ( ( c2 (+1))ˆmu (1 n2 (+1))ˆ(1 mu) ) ˆgamma/ c2 (+1) qa1 (+1);

Implementation in Dynare: BE They are intertemporal Euler equations for bonds; hence we have EEs for bonds and capital Are we done? No. Why not? Remember what we had to do in switching from CM to FA. We also have to declare the new variables and assign initial values to them.

Implementation in Dynare: FA The command declaring variables now becomes v a r G1, G2, F1, F2, y1, y2, c1, c2, n1, n2, k1, k2, x1, x2, a1, a2, b1, b2, z1, z2, qa1, qa2, qb1, qb2, i r 1, i r 2, p, rx, xp, im, nx, r1, r2, w1, w2, B1, B2, Q; Initial values to help Dynare find steady state B1 = 0 ; B2 = 0 ; Q = 1 ;

Two Things Two things before we move away from Dynare and back to the model First, the code presented asks Dynare to compute linear approximations of the levels of the variables We do this for presentation purposes (to avoid notational clutter). To compute a long-linear version of the model, replace variables y with exp(y). Careful though: some variables are already in logs so you need not add exp(.)! Second, bond economies like BE above tend to exhibit unit root behavior; see Schmitt-Grohe and Uribe for ways on how to get around this issue

Conclusion In this lecture, we looked at Heathcote-Perri JME 2002 and in particular, how to implement the three economies therein using Dynare Aside from being an introduction to Dynare as it applies to international models, the paper addresses three counterfactual predictions under CM: (1) high cross-country correlations of consumption relative to output; (2) negative cross-country correlations of investment and labor; (3) low RER volatility The paper finds that the FA setup comes closest to the data The main reason is that in the absence of asset trade, quantities adjust less (hence lower consumption correlation, and also less investment and labor in country with positive shock) so prices pick up the slack (hence more volatile RER)