Exercise Session Advanced Macroeconomics II Prof. Michal Kejak TA: Petr Harasimovic Spring 2007 Using the Uhlig Toolbox1 ­ Handout This handout derives the systems of linear equations for the examples No. 0 and 1 in the Uhlig toolbox. These examples are contained in the files exampl0.m and exampl1.m. Before you start using Uhlig toolbox type readme in the Matlab command window.2 1 Example 0 ­ Neoclassical Stochastic Growth Model The model we want to solve is max {Ct,Kt} t=0 E t=0 t C1t - 1 1 - , s.t. Ct + Kt = ZtK t-1 + (1 - )Kt-1 log(Zt) = (1 - ) log( Z) + log(Zt-1) + t, t i.i.d. N(0, 2 ) First order conditions generate the following Euler Equation Ct = E C- t+1(Zt+1K-1 t + (1 - )) As we want to solve the model for five variables (C, K, Y, R, Z) we need 1 Available at http://www2.wiwi.hu-berlin.de/institute/wpol 2 Don't forget to put the folder with the toolbox on Matlab's search path either by the command addpath ­ then put it on the top of the search path by the argument -begin or by copying the toolbox in your working directory. 1 five equations3 , which are Rt = ZtK-1 t-1 + (1 - ) (1.1) Ct = Yt + (1 - )Kt-1 - Kt (1.2) Yt = ZtK t-1 (1.3) 1 = E Ct Ct+1 Rt+1 (1.4) log Zt = log Z + (1 - ) log Zt-1 + (1.5) Eliminating the time subscripts we can solve for steady state4 K = Z R - 1 + 1 1- (1.6) Y = Z K (1.7) C = Y - K (1.8) R = Z K-1 + (1 - ) (1.9) 1 = R (1.10) To use the Uhlig toolbox we have to linearize the system of equations (1.1)-(1.5) first. Define the lowercase variables as ct log Ct-log C, similarly for all the other variables. By construction we have Ct = Cect and using the first order Taylor approximation5 it follows Cect C(1 + ct). Using this substitution in equation (1.1) gives R + Rrt Z K-1 + (1 - ) + Z K-1 (zt + ( - 1)kt-1) using (1.9) Rrt ( R - (1 - ))(zt + ( - 1)kt-1) which after substituting (1.10) becomes rt (1 - (1 - ))zt - (1 - (1 - ))kt-1 (1.11) 3 We could alternatively use smaller number of equations and compute the other variables later substituting the solution. However, the algorithm can handle more equations easily and there is thus no reason to reduce the system. It is,in fact, convenient to solve for all the variables simultaneously. 4 Z is an arbitrary parameter. 5 Recall that ex e0 + e0 (x - 0). 2 The second equation is linearized as follows C + Cct Z K + Z K (zt + kt-1) + (1 - ) K + (1 - ) Kkt-1 - Kkt - K using (1.8) ct Y C zt + Y C + (1 - ) K C kt-1 - K C kt further, using the fact that K C Y C + (1 - ) = K C R we get ct 1 + K C zt + K C kt-1 - K C kt (1.12) The third equation becomes Y + Y yt Z K + Z K (zt + kt-1) which reduces to yt zt + kt-1 (1.13) The Euler Equation yields 1 E ( Cect Cect+1 ) R(1 + rt+1) 1 E R(1 + (ct - ct+1) + rt+1 + (ct - ct+1)rt+1) since the last term in the brackets is negligible and using again (1.10) we get 0 E [(ct - ct+1) + rt+1] (1.14) The last equation can be transformed as log( Zezt ) = (1 - ) log Z + log( Zezt-1 ) + t log Z + zt = log Z + zt-1 + t zt = zt-1 + t (1.15) The last step before running the toolbox is to rewrite the system of linear equations (1.11)-(1.15) in the form 0 = Ax(t) + Bx(t - 1) + Cy(t) + Dz(t) 0 = Et [Fx(t + 1) + Gx(t) + Hx(t - 1) + Jy(t + 1) + Ky(t) + Lz(t + 1) + Mz(t)] z(t + 1) = Nz(t) + (t + 1) where x is the vector of endogenous state variables, y is the vector of other endogenous variables, and z is the vector of exogenous state variables. Obviously, x = k, y = [c, r, y], and z = z. After feeding the toolbox with the required matrices we are done. 3 2 Example 1 ­ Hansen's RBC Model The model we want to solve reads max {Ct,Kt,Nt,It} t=0 E t=0 t (log Ct - ANt) , s.t. Ct + It = Yt Yt = ZtK t-1N1- t Kt = It + (1 - )Kt-1 log(Zt) = (1 - ) log( Z) + log(Zt-1) + t, t i.i.d. N(0, 2 ) The first order conditions yield A = 1 Ct (1 - )ZtK t-1N- t 1 Ct = E 1 Ct+1 (Zt+1K-1 t N1t+1 + (1 - )) We have the following seven equations describing the model Ct = Yt - It (2.1) Kt = It + (1 - )Kt-1 (2.2) Yt = ZtK t-1N1t (2.3) A = 1 Ct (1 - )ZtK t-1Nt (2.4) Rt = ZtK-1 t-1 N1t + (1 - ) (2.5) 1 = E Ct Ct+1 Rt+1 (2.6) log Zt = log Z + (1 - ) log Zt-1 + (2.7) 4 The steady state values are given by6 I = K (2.8) C = Y - K (2.9) Y = Z K N1- (2.10) R = 1 (2.11) Y K = R + - 1 (from (2.10)) (2.12) K = Y K Z 1 -1 N (from (2.3)) (2.13) A = (1 - )Y C N (from (2.4) and using (2.10)) (2.14) Now we have to linearize the system of equations (2.1)-(2.7). By the same procedure as in the previous example the first three equations simply Cct Y yt - Iit (2.15) Kkt Iit + (1 - ) Kkt-1 (2.16) yt zt + kt-1 + (1 - )nt (2.17) Using eq. (2.17) the eq. (2.4) becomes ct yt - nt (2.18) The expression for interest rate (eq. (2.5)) can be approximated as R + Rrt Z K1- N1+ (1 - ) + Z K1- N1(zt + ( - 1)kt-1 + (1 - )nt) which after using eqs. (2.11) and (2.17) becomes Rrt Y K yt - Y K kt-1 (2.19) The last two equations are the same as in the previous example and they read 0 E [(ct - ct+1) + rt+1] (2.20) zt = zt-1 + t (2.21) The vectors x, y and z now become x = k, y = [c, y, n, r, i], and z = z. 6 Following Uhlig's example we take N as a parameter and solve for the steady state value of A. Usually, however, A is calibrated and N is derived. This would give N = 1- A Y K Y K - . 5