Home
A User Guide for Matlab Code for an RBC Model Solution
Contents
1. begin with ry II Bes fae eS a kls 1 beta 1 delta alpha 1 alpha 1 denoted as I can ignore v since it is normalized at one Note that so far I only use step by step substitutions to obtain r w and k l k1s For the rest of the part a little device will save lots of computational burden Divide resource constraint by Then we have c I cls as follows This is denoted as cls kls alpha delta kls Then redefine c c I x and eliminating w from eqn 4 and leaves 1 k AA x e 1 a Note that this equation contains only one unknown variable since k l k1s is already known and c is a function of To solve this non linear equation numerically we can use solve command in Matlab You will find the following lines in the code ssi lamda ls lamda 1 cs sigma 1 alpha kls alpha lss solve ssi ls ls double lss kstar kls lstar cstar clstar lstar Now you find all the steady state values There can be many other ways to compute them This part depends on your way of thinking how to minimize the computational burden 3 2 Model proc First make the list of all the variables that you want to compute by using syms command In this simple RBC case we have cz kt lt rt Ut Ceti Kkt 1 lt 1 rt 1 and v41 which can be written as syms ct kt lt rt vt ca ka la ra va Remember that a stands for one period ahead such that
2. ca denotes c 1 similarly ka denotes ki41 This is just my notation Then write down all the efficiency conditions and resource constraints There is only one rule here Express all the equations with zero in the left hand side Further you can give each equation a name and write those names in the LHS instead of zero wt vt 1 alpha kt 1t alpha ra va alpha ka la 1 alpha labor lamda 1t lamda 1 wt ct sigma euler beta 1 ra ca sigma ct sigma capital ka 1 delta kt vt kt alpha 1t 1 alpha ct tech va phixvt Before writing those conditions I eliminate w and rz using firm s optimal conditions You do not necessarily have to do this Nonetheless this procedure will reduce computational burden Note that the two efficiency conditions euler and labor are expressed only by quantity variables cz Ct 1 lt lt 1 kt and ky41 since the first and second lines substitute w and rz41 out of them optcon compiles those efficiency conditions vertically in one matrix This makes it possible to use jacobian command in next step 3 3 Linearization proc xx denotes endogenous variables vector to which you want to take derivative When you pool them into the xx vector let the t 1 variables come first such that xx ca la ka va ct lt kt vt The next line jopt is the analytical expression of first order derivatives of all the equation pooled in optcon jacobian command is extrem
3. defined as a set of c lt me kt 1 we and ri which satisfy the following efficiency conditions Fib 1 ri xa of euler M w 0 labor 1 k Ot 1 avr wt 2 ky a l Le 2f QUE Tt 3 and resource constraints kt 1 1 6 ki Ut p capital lt Mt where y vekni We can add one more exogenous stochastic process for productivity shock v such as AR 1 as follows Veq1 pvr 1 ony v Et where v denotes a normalized steady state level of productivity 3 The Matlab code 3 1 Steady state proc Let s start with the steady state part The purpose of this part is to compute steady state values of endogenous variables You have to solve a non Inear multiple equation system numerically Here is the steady state conditions for our example Bl r 1 AL 1 wie 0 4 1 a v uw 5 e a l avu r n 6k amp e y v k e 1 e You have to think for yourself in this part if you change the model in this example There can be many different orders for computation Of course you will obtain right answers as long as you write down the steady state conditions correctly But here in a Matlab code I encourage you to pick up one that requires less computational burden Note that Matlab works more quickly with step by step substitution rather than solving simultaneous equations So basically reduce simultaneous equations Here is my suggestion I
4. A User Guide for Matlab Code for an RBC Model Solution and Simulation Ryo Kato Department of Economics The Ohio State University and Bank of Japan DECEMNBER 10 2002 Abstract This note provides an easy and quick instruction for solution and simulation of a standard RBC model using Matlab The Matlab code introduced here is extremely compact and easy to hadle in the sense that it requires neither external functions sub procedures nor benchmark data The solution method used in the code is standard undermined coefficient method eigen de composition method based on log linearized system The code is available at http economics sbs ohio state edu kato matlab RBC1 m E mail kato 13 osu edu or ryou katou boj or jp 1 Overview Make sure that your PC is installed with Symbolic Math tool box in an appropriate folder Usually you find a folder named toolbox under your MATLAB folder The code introduced in this note is only one sheet in length but everything necessary to solve simulate an RBC model is contained in the sheet You do not have to take derivatives to derive the first order conditions here in the code All those analytical calculations are processed au tomatically by your Matlab Generally what you have to do to run the code is only two things namely choosing parameter values and writing down all the first order conditions and resource constraints Note that those conditions can be non linear since as I m
5. ely useful since it gives you the Jacobian matrix in analytical form Now evaluating the Jacobian matrix at the steady state values will be the completion of linearization This can be done by substituting the steady state values that we have already computed You will see coef eval jopt which converts the Jacobian matrix in analytical form jopt into numerical form coef In the final part of the linearization step you need to separate the coef matrix in two The first four columns correspond to period t 1 variables and the rest of four columns to period t variables w ll coef 1 4 TW coef 5 8 TW Q u where TW denotes steady state values again so that the coefficient matrix could be mea sured as percentage deviation from the steady state values Here we have the following linearized system Cyt41 By where ye ct li ky v4 and B and C are 4 x 4 matrix with numerical elements Finally define A matrix as follows yt C7 Byt41 Ayy 6 3 4 Solution proc In the Solution proc our purpose is to decompose A matrix and eliminate all the unstable roots 0 lt 1 You can ignore the instruction of this proc since you do not have to change this proc for any dynamic general equilibrium models First eqn 6 can be expanded and eigen decomposed as follows Ct Qi a14 Cet l li 1 kt Kya Vt as a44 Vt 1 Q VQy 01 0 Qu Oe Qu y Yt 1 7 Qs 03 Qs r 0 04 Do no
6. en tioned automatic log linearization is a part of the code The Matlab code is downloadable at http www econ ohio state edu kato matlab RBC1 m The code consists of five parts as follows 1 Parameter proc 2 Steady State proc 3 Model proc 4 Linearization proc 5 Solution proc 6 Simulation proc If you change the Model part then you have to modify the Steady state part accordingly In most cases you do not have to change the Linearization part and Solution part There are two versions for the Simulation part that is 1 impulse response and 2 stochastic simulations to obtain second moment of simulated data This note is organized as follows First I illustrate a standard RBC model that will be solved in the code Namely I start with an example since it is always easier at least for me to consider an example than general abstract argument Section 3 is the instruction for each part of a code Section 4 provides some remarks 2 The standard RBC model Consider a standard RBC economy with a representative household whose preference is specified as follows Cele cot l o max Eo 8 i t 0 S t at4 1 1 14 Qt Cr wilt where c and l denote consumption and labor supply at re and ws stand for non human asset interest rate and wage rate for households Assume that the representative firm has a Cob Douglas technology in labor and capital The recursive competitive equilibrium of the economy is
7. n 1 n k implies Q Qu _ Pa Psg Qs Pc Pp Then the following relation is true to satisfy transversality condition Quyt Pa Ps y 0 where Qu is a 2 x 4 matrix This can be rewritten as P3 Pg ke Ut kt Ut This is the rational expectation solution of the system The corresponding part in the code P is P inv PA PB Expanding eqn 7 and substituting the solution yields k 03 0 kee Po Pp Po Pp Y l Ut 0 4 leat Ut 1 _ f Resa Vy PcP Pp Vt 1 vV P Keri Ut 1 Then finally we have Key k i Pi VLPe Vt 1 Ut Ill gt gt 1 s js The ultimate purpose of this section is to derive Aa matrix shown above 3 5 Simulation proc Once you obtained the Aa matrix impulse response function can be computed by step by step substitution as shown below Ss S1 S zeros t k for i 1 t q AA Ss S i q Ss S i end SY S1 S where S1 and SY denote arbitrary initial value and the simulated path of state variable ki ivt i Multiplying P matrix will give you the solution path of jump control variables Ct i 44 X namely X real P SY Instruction for stochastic simulation is a work in progress 4 Remark If you have any question you can email me to kato 13 osu edu or ryou katou boj or jp Enjoy
8. t get confused with the notation Matlab computes the eigen matrix as the inverse of what we have in our mind So make sure that 1 6 is a root of the characteristic equation The following part of the code corresponds to the above calculation Namely 1 decom position of A matrix 2 Extracting stable roots 0 gt 1 and definition of the matrices Qu UQ and Qs SQ W V eig A Q inv W W V Q theta diag V Extract stable vectors sQ jw 1 for j 1 length theta if abs theta j gt 1 000000001 SQ jw Q j jw jwti end end Extract unstable vectors ug 0 jjw 1 for jj 1 length theta if abs theta jj lt 1 000001 UQGjjw Q jj jjw jjwtt end end Extract stable roots lamda gt 1 VLL jjjw 1 for jjj 1 length theta if abs theta jjj gt 1 000000001 VLL jjjw theta jjj jjjw jjjw t end end Show Eigen Vectors on U S Roots UQ n x ntk SQ k x ntk By applying the Blanchard Kahn theorem we know that two out of four eigen values are greater than one Let 03 gt 1 and 64 gt 1 Remember that they are stable roots The number of rows of Qu UQ coincides with the number of unstable roots n and similarly number of rows of Qs is equal to that of stable roots k min size SQ of predetermined vars min size UQ of jump vars And the following part PA UQ 1i n 1 n PB PC SQ 1 k 1 n PD UQ 1 n n 1 n k SQ 1 k
Download Pdf Manuals
Related Search
Related Contents
Manuel de transmission relatif à la circulaire 10/467 KFC-241-L シリーズ 取扱説明書 HYTEC INTER Co., Ltd. 第 1.1 版 3 - Idrotop (介護予防)福祉用具貸与 特定(介護予防)福祉用具販売 資料 Manual Motor Starters Copyright © All rights reserved.
Failed to retrieve file