IRIS Toolbox knowledge base article 2 Everything you always wanted to know about unit-root models (but were afraid to ask) Part I Jaromír Beneš* International Monetary Fund Martin Fukač Federal Reserve Bank of Kansas City First version: 1 November 2011 This draft: 23 November 2011 In progress. Unfinished. Incomplete. Imperfect. Early draft. Preliminary. Errors and typos quite likely. But feel free to quote. Abstract This is a practical guide to handling models with unit roots efficiently and conveniently. DSGEs included. No more pain stationar-ising your models; you don't deserve it. And by the way, all this has been implemented in IRIS since long. * Corresponding author: jaromir (dot) benes (at) gmail (dot) com. IRIS Toolbox knowledge base article 2: Unit-root models, Part I 2 Contents 1 Introduction 3 2 The model: RBC with exogenous growth 4 3 The old way 5 4 Going the extra mile 7 5 The new way 9 5.1 Steady state............................ 10 5.2 First-order expansion....................... 14 6 How is it done in IRIS? 16 A Equivalence 16 B Numerical example of non-stochastic steady state 17 C Algebraic system matrices for the stationarised model 17 D Numerical recursive-form solution of the unit-root model 17 IRIS Toolbox knowledge base article 2: Unit-root models, Part I 3 1 Introduction You have a nice model. The model has a nice unit root. Or perhaps two of them. Or five. What do you do? Transform some of the variables to make them stationary? Then apply the usual first-order approximate stuff? And then convert everything back into its original terms after each simulation? Wrong. Here is the deal (we can call it a "Big Unit-Root Proposition", or BURP). If you have a model that contains one or more unit roots, and are able to stationarise the model so to find its valid first-order solution, then you actually do not need to transform the model whatsoever in the first place. You simply deal with everything in its original form, and still arrive at exactly the same results. Does it not seem to be a big deal to you? That is probably because you have only played with models of just a few equations. In practice, however, there are people who work with dozens or even hundreds of equations, and possibly multiple unit roots (think of a small open economy with one technology process, price level home, and price level abroad: that is three and possibly counting). Stationarising such systems is a real pain. Not to speak of the fact that sometimes you have to re-transform and re-write everything from scratch every time you make a little change here or there. In the rest of the paper, we take the perhaps simplest possible example (an RBC model with exogenous growth), and first explain every step in solving the model the traditional way, i.e. by stationarising the model's unit-root variables. Then, with this solution at hand, we show that such a stationary solution can be easily translated to the original levels bringing back the unit root. Finally, we show we can take a short-cut arriving directly at the unit-root solution without making the intermediate step of stationarising the model. In the follow-up Part II of the paper, we show how to work conveniently with unit-root models using a triangular solution proposed by Benes (2011), including automatic recognition of unit-root variables, running a unit-root Kalman filter, and more. We also show simple rules of thumb that help to tell apart unit-root models in which first-order solutions, or local solutions in general, are valid from those in which they are not valid (no matter if you IRIS Toolbox knowledge base article 2: Unit-root models, Part I 4 stationarise the model or use the method proposed here). 2 The model: RBC with exogenous growth Here is our example model. It is a simple RBC with fixed labour and exogenous labour-augmenting productivity. Because we only deal with non-stochastic steady state and first-order accurate solutions in this paper, we take the liberty to drop the expectations operator for ease of notation. The model consists of five equations in five variables: l/Ct = PRt/Ct+1 (la) Yt = A^Kt-i1-1 (lb) Yt = Ct + Kt-(l- S)Kt-i (lc) (1- - 7) Yt+1/Kt = Rt-l + 5 (Id) At = At-iaexpet (le) where Ct denotes consumption, Yt output, Kt capital available for production at time t + 1, Rt the gross rate of real interest, and At productivity. The three parameters, a, j3, and 7 describe productivity growth, households' time preferences, and labour share of production, respectively. The next three steps are about as follows: 1. Find non-stochastic steady state (with the term 'steady state' becoming more blurred than what you might have ever imagined shortly). 2. Compute the first-order Taylor expansion of the equations around the steady state. 3. Solve out expectations expressing the model in recursive form. We perform these three steps both the traditional way (stationarising some of the variables) and the convenient way (keeping everyting in its original form as above), and show that the two are equivalent in the results they produce while the latter is clearly superior measured by the modeller's convenience. IRIS Toolbox knowledge base article 2: Unit-root models, Part I 5 3 The old way Even though solving the above model the traditional way may seem boring to you, bear with us. We add some not-so-common bits to it, explain a few new concepts, and derive results to be later compared with those obtained by applying the newly proposed method. Before computing steady state the traditional way, we first need to identify which variables are to be stationarised. This is trivial in our example model. Arguably, it ought to be rather trivial in any of your models, too -simply because knowing your model at least this well really is best practice in the profession. In other words, variables should be non-stationary by your assumption and by your intelligent design, so to speak, rather than taking you by surprise after you are done with the algebra. We introduce the following familiar transformations (mind the way at is defined!): ct := Ct/At, yt := Yt/At, kt := Kt/At, at := At/At-i; and re-write the original equations using the new variables: To find the non-stochastic steady state, we can now simply drop the time indices, replace shocks with zeros, and solve a system of 5 equations in 5 unknowns (denoting the steady-state levels by a bar) at+i/ct = (IRt/ct+i Vt = (h-l/at)1'1 yt = ct + kt - (1 - 6)kt-i/at (1 - 7) at+iyt+i/h = Rt-l+6 at = a exp s (1 y a = /3R y = (fc/a)1-T c + k[l- (1-5)/a] 7) ay/k = R-l+5 a = a (2a) (2b) (2c) (2d) (2e) We report steady-state values for an example set of parameters in Appendix B. IRIS Toolbox knowledge base article 2: Unit-root models, Part I 6 The next step is a first-order Taylor expansion around the steady state. To this end, we need to choose whether a particular variable will be linearised or log-linearised. The choice is relatively unimportant here, but becomes rather critical when we use the new method. For reasons that become clear later on, we must log-linearise the system in ct, yt, kt, and at. As for Rt, we are free to choose what to do; for convenience, we log-linearise Rt, too. The first-order expansions (with all terms concentrated on the LHS) are reported here in their raw forms with no simplifications or cancellations made: | [(In at+1 - In a) - (In ct - In c)] - — [(In Rt - In R) - (In cm - In c)l = 0, (3a) c L J ■■■ (3b) y (In yt — In y) — c (In q — In c) — k (In kt — In k) + (1-5)- [(In kt-i-kik)- (In at - In a)l = 0. (3c) (3d) ■■ (3e) We can now put the system in its first-difference matrix form f -4+1 B J C + Det = 0, (4) to make it ready for a rational-expectations solution. Note that we preserve the constant terms in the system; this will become important once we bring back the unit roots. The vector of predetermined (or backward-looking) variables, xbt, and the vector of non-predetermined (or forward-looking) vari-ables, j Eire defined as follows, respectively: In kt In ct In at InRt IRIS Toolbox knowledge base article 2: Unit-root models, Part I 7 Note that Rt, which does not occur in the equations with any lags or leads could be also alternatively included in x\ instead but it is computationally more efficient to keep it in x{. The coefficient matrices A, B, C, and D are again reported in Appendix. Finally, it is now easy to find the model's recursive solution, = Txbt_! +K + R0et + R1 Et[et+1] + ■ ■ ■ + Rk Et[et+k], (5) using one of the available methods, such as Klein (2000) or Benes (2011). To simulate the model, we need to set up the initial condition for Kt-\ and At-i, the current and future shocks, et, then convert the initial conditions to the transformed variables, simulate the stationarised model using (5), then compute the implied path for At based on at, and finally convert the all the variables back to their original levels. 4 Going the extra mile We now add an extra step to the traditional way. We take the first-order expansion around the stationary steady state from the previous section, and substitute back for the transformed variables. As a result, we get a system in the original levels (or, strictly speaking, in the logarithms of them, lnCj, In Ft, lnKt, and In At). The result will be a model log-linearised around its stationarised steady state but with its unit root brought back. Because we merely make a mechanical substitution, the two systems (the stationarised one, and the one in the original levels and with the unit root back) will be absolutely equivalent. Why do we do it? Or course, there is no improvement in the solution efficiency at this point (we still start from the first-order representation obtained by painfully stationarising the model). There are though two other good reasons for that. First, we want to introduce the very notion of a model solution with unit roots preserved in it. Second, it will be our point of reference for comparing the tradition solution method with the new, more convenient, one. Because the transformations are log-linear (the ratio of two variables is a simple difference between the respective logarithms), we can directly IRIS Toolbox knowledge base article 2: Unit-root models, Part I 8 plug them in a log-linearised system, and the system remains equivalent. This is exactly the reason we chose to log-linearise the variables earlier. Furthermore, we can choose whether to do so at the level of the unsolved system, i.e. in equations (3a)-(3e) and their matrix form (4), or the solved system, (5). We do both: they, of course, yield identical results. We first substitute for lnct, lnyt, lnkt, and lnat in (3a)-(3e): lnct = InCt - In At, lnyt = In Ft - In At, In kt = In Kt — In At, lnat = In At — In At_i. In equation (3a), we make use of the fact that a = j3R in steady state. Hence the Taylor coefficients are the same at all of the expansion terms, lnat+i cancels against the newly substituted lnAf+i — lnAf, and after collecting the constant terms together, the equation becomes In Ct+i - In Ct - In Rt - In (3 = 0, (6a) because In a — ln^ = ln/3. Obviously, we could have obtained exactly this equation by directly taking logs of both sides of the very original equation. In equation (3b) ■■■ (6b) In equation (3c), we make use of the fact that y = c + k + (1 — 5)k/a in steady state. Note also that all terms involving In At and lnAt_i cancel each other in this equation: yInF - clnCt - k\nKt + (1 - 6)-kiKt-i a k - ylny — cine — kink + (1 — 6) — (Ink — In a) a 0 (6c) In equation (3d) ■■ (6d) IRIS Toolbox knowledge base article 2: Unit-root models, Part I 9 In equation (3e) (6e) Based on these equations, we can write a new system A* Et X f t+1 B* xU X f C* +D*et = 0, (7) with the upper-case vectors of predetermined and non-predetermined variables given by, respectively X In At X f InCt In Ft In After we solve out for expectations, we get a new recursive form T*Xbt_i +K*+R*0et+ Rt Et et+1 + ■ ■ ■ + R*kEt et+k, (8) x\ f X. The new solution will have one unit root (which, by the way, needs to be treated as a non-explosive, or stable, root in the Blanchard-Kahn saddle path condition). Simulating the new recursive system, (8), is equivalent to the producedure described at the end of the previous section: simulating the old system, (5), calculating the path for At by cumulating at, and transforming all the variables back to their original levels. Now, we already know what it means working with a unit-root solution. But we still have to stationarise the model first to get to that point. Hence, the million-buck question is: Can we somehow arrive at the equations (6a)-(6e) directly without the intermediate step of stationarising the variables? The answer is: Yes, we can. 5 The new way Key to understanding the new way of solving models are two things. First, how do we pinpoint the (non-stochastic) steady state of the model when we do not stationarise the unit-root variables? And second, how do we calculate a first-order expansion of a non-stationary system? IRIS Toolbox knowledge base article 2: Unit-root models, Part I 10 The various steps we make to answer these questions might seem not so straightforward at first sight. But once you grasp the (very) simple logic of it, you will understand them perfectly at second sight. Equally important, all the steps are purely mechanical with no need for manual intervention at any point, and can be therefore easily automated using basic text or regexp manipulation functions available in virtually all programming packages. 5.1 Steady state The non-stochastic steady state of the stationarised system is defined in terms of some stable ratios, Ct/At, Yt/At, Kt/At, and a growth rate, AtjAt-\. We can easily translate these numbers into a balanced-growth path (BGP). Along a BPG, the four variables will be growing at the same rate in fixed proportion to each other. Picking a particular value for At determines uniquely the BGP values for all other variables (including Rt, which is fixed no matter what). Furthermore, to completely describe the steady state, we obviously also need to know the rate of change for each variable; we will denote the steady-state (or BGP) rate of change by a hat: Ct = Ct/Ct-i- In our example model, the steady-state rates of change are rather trivial, as C = Y = K = A = a (and R = 1, for that matter). Let's now form a ten-tuple (C, Y, K, A, R, C, Y, K, A, R), and let's call the ten-tuple "a BGP point". There are, of course, infinitely many BGP points, with different levels for C, Y, K, and A. All of the BGP points will though see the same ratios of these four variables, and on top of that, the same values for the rest of the ten-tuple, i.e. R, C, Y, K, A, R. To compute the first-order expansion without stationarising the model, the first step is now to simply find one arbitrary BGP point; any of them will do the job equally well. How to find a BGP? Let's say initially that we know the rates of change for every variable (which we do in this simple model), and we make use of this knowledge. In that case, the problem turns out to be very trivial. Later in this subsection, we also show how to solve the problem without this short-cut. We take the original equations in the original levels, (la)-(le), and replace • every occurence of a variable at time t with its BGP level, e.g. Kt with IRIS Toolbox knowledge base article 2: Unit-root models, Part I 11 K- • every occurence of a variable at time t — 1 with its BGP level divided by its gross rate of growth, e.g. Kt-\ with K/K; • every occurence of a variable at time i + 1 with its BGP level multiplied by its gross rate of growth, e.g. Kt+\ with KK; • in general, every occurence of a higher lag or lead with a term including an appropriate power of the rate of change, e.g. Kt_k with K/Kk, and Kt+k with KKk. Note that these substitutions can be fully automated using basic text or regexp manipulation functions, and there is absolutely no need for any kind of manual intervention after specifying the correct rates of change. We get the following system of five equations in five unknowns, where we explicitly substitute a for C, Y, K, and A, and 1 for R. l/C = PR/(Col) (9a) Y = A~* (K/a)1-"* (9b) Y = C + K - (1 - 5)K/a (9c) (l-^Ya/K = R-l + 5 (9d) A = A (9e) If you have immediately spotted resamblance of these equations to the sta-tionarised steady-state system (2a)-(2e) you are on the right track. The last equation, (9e), poses obviously a singularity. This is simply because the level of A is not pinned down by the logic of the model. In other words, A can be anything, and the levels for the three other variables, C, Y, and K, will adjust. But how do we deal with the singularity in practice? It is actually not an issue: Most of the numerical solvers available in optimization packages will easily deal with the singularity returning simple some value for A, and the correct values for the rest of the variables (examples of such solvers include f solve and lsqnonlin in Matlab). And we already know that any value will do the job. IRIS Toolbox knowledge base article 2: Unit-root models, Part I 12 Next, can we solve simultaneously for both the levels and the rates of change? Yes. All we need is five extra independent equations for the five extra unknowns (C, Y, K, A, and R). Where do we get them from? We simply add the five model equations a second time, now for a different BGP point. Think of it as writing the above steady-state equations (9a)-(9e) with all levels shifted by an arbitrary number of periods forward or backward. Choose a constant m ^ 0 (preferably an integer for easier interpretation of the resulting equations), and add five new equations based on (la)-(le) replacing • every occurence of a variable at time t with its BGP level mutliplied by the respective gross rate of change to the power of m, e.g. Kt with KKm; • every occurence of a variable at time t — 1 with its BGP level divided by its gross rate of growth to the power of m — 1, e.g. Kt-\ with KKm~x\ • every occurence of a variable at time i + 1 with its BGP level multiplied by its gross rate of growth to the power of m + 1, e.g. Kt+i with KKm+1; • in general, every occurence of a higher lag or lead with a term including an appropriate power of the rate of change, e.g. Kt-k with KKm~k, and Kt+k with KKm+k. The steady-state system for calculating the entire ten-tuple of BGP val- IRIS Toolbox knowledge base article 2: Unit-root models, Part I 13 ues in our example model will therefore become something like the following: l/C = /3R/(CC) (10a) Y = A1 (K/K)1-1 (10b) Y = C + K — {1 — 5)K/K (10c) {l-^YY/K = R-l + 5 (lOd) A = A/Aa (lOe) \/{CCm) = l3(RRm)/(CCm+1) (lOf) YYm = (AAmy {KK™-1)1-^ (lOg) yym = £(jm + _ (i _ 5)Kkm~1 (lOh) (1 - 7) YYm+1/(KKm) = RRm -1 + 5 (lOi) AAm = AAm-1 a (lOj) where m ^ 0 is a fixed number, and C, Y, K, A, R, C, Y, K, A, and R are the unknowns. As before, the system has one singularity across equations (9e) and (lOj) (with these two equations able to pin down the rate of change A but not the level A), but again this fact poses no practical problem. And as before, all the above substitutions can be again fully automated using basic text manipulation. Finally, we conclude this subsection with three practical considerations. First, when you compute steady state in all kinds of economic models, it is a good idea to restrict those variables that are supposed to be positive to really stay positive; such restrictions help tremendously the solvers to converge and converge fast. Note also that introducing a simple exponential transformation is usually much more powerful than imposing hard-typed inequality constraints even in the solvers that have been designed for constrained problems. Second, if you want to regain control over what kind of value you get for A,1 you can do the following. Replace A with 1 (or whatever number you wish) keeping the system of equations otherwise unchanged. Although we keep A on the list of unknowns, the variables will not occur in the equations 1Why would you want that? A typical situation is when you run a steady-state comparative static exercise changing a particular parameter, and you wish to compare the implied levels of output for a given fixed level of productivity. IRIS Toolbox knowledge base article 2: Unit-root models, Part I 14 any more. This is, in fact, equivalent to the singularity problem before; and again, many of the numerical solvers can handle this situation with no difficulty. Third, we can generlise the previous argument for any of the unit-root variables, C, Y, K, or A. Because we have one unit root in the model, we are free to choose a particular value for one of those four variables, replacing its occurences with the value of your choice (keeping though the steady-state rates of change for that variable untouched in the equations), and running the solver. 5.2 First-order expansion With a particular (yet arbitrary) BGP point at hand, we can proceed as follows to obtain a first-order expansion which will turn out to be identical to the one computed on the stationarised model with the transformations substituted back, (6a)-(6e): • in each individual equation, express algebraically the first-order Taylor expansion in the logarithms of the individual variables (treating current dates, lags, and leads as distinct variables, of course) around values that you simply denote with a bar, preserving the time subscript, using e.g. Kt, Kt-i, and Kt+i to denote three distinct values; • evaluate these derivatives at the BGP point found above adjusting the levels of lags and leads appropriately for the BGP rates of change; for instance, replace all occurences of Kt with K in these derivatives, Kt-i with the value of K/K, and Kt+i with the value of KK. We now do the calculations step by step for each of the five model equations. In eq. (lc), we express the first-order expansion in the logarithms of three variables: Ct, Rt, and Ct+i (hint: to express a derivative w.r.t. the logarithm of a variables, first calculate the derivative w.r.t. the variable itself, and then multiply the result by the BGP value of that variable). -l/Ct(lnCt-InCt) - PRt/Ct+iQnRt - InRt) + $Rt/Ct+i(lnCt+i - lnCt+i) = 0 IRIS Toolbox knowledge base article 2: Unit-root models, Part I 15 Next, we substitute C for Ct, R for Rt, and finally CC for Ct+i, and collect (only for the sake of convenience) the constant terms at the end of the equation: - 1/C InCt - flR/{CC) InRt + flR/{CC) \nCt+i - [-1/C InC - flR/{CC) \nR + flR/{CC) \n{CC)] = 0 (11a) In eq. (lb) ■■■ (lib) In eq. (lc), we express the first-order expansion in the logarithms of four variables: Yt, Ct, Kt, and Kt-i : YQnYt - InYt) - C{\nCt - \nCt) - K{\nKt - \nKt) + (1 - 5)Kt-i{\nKt-i - \nKt-i) = 0. Now, we make the substitutions Y for Yt, C for Ct, K for Kt, and K/K for Kt-i, and collect the constant terms at the end of the equation, YlnYt - ClnCt - K\nKt + (1 - 5)K/K \nKt-i - [Y\nY - C\nC - K\nK + (1 - 5)K/K \n(K/K)] = 0. (11c) In eq. (Id) ■■■ (lid) In eq. (le) ■■■ (lie) We are done. As we show in Appendix A, the above equations, (11a)-(lle) are equivalent to equations (6a)-(6e) derived in section 4, and can be used to form a system like (7) ready for rational-expectations. IRIS Toolbox knowledge base article 2: Unit-root models, Part I 16 6 How is it done in IRIS? References Benes, J. (2011). Efficient triangular solution to rational-expectations models and its forward expansion. IRIS Toolbox Knowledge Base Article 1. Klein, P. (2000). Using the Generalized Schur Form to Solve a Multivariate Linear Rational Expectations Model. Journal of Economic Dynamics and Control, 24(10):1405-23. A Equivalence In this appendix, we show that the system of equations (lla)-(lle) obtained by the first-order expansion of the original model around a BGP point is equivalent to the system of equations (6a)-(6e) obtained by the first-order expansion of the stationarised model around a stationary steady-state with the original levels brought back subsequently. Although the equivalence might seem coincidental to some at first sight, being just a special case in our particular model, it is in fact something rather universal in a broad class of macroeconomic models. Key to the equivalence is the concept of linear homogeneity in the basic macroeconomic relationships (such as preferences and technology), at least in steady state or on BGP (when, for instance, various rigidities and adjustment costs disappear). In eq. (11a), we multiply the entire expansion by —C, make use of the fact that J3R/C = 1, and expand the logarithm in the last term: InCt + InRt - InCt+i - [lnC + InR - (InC + In(7)] =0 Because In R — In C = In R — In a = — In (3, we get In Ct + In Rt- In Ct+i + In /3 = 0, (12a) an equation identical to (6a). In eq. (lib) (12b) IRIS Toolbox knowledge base article 2: Unit-root models, Part I 17 In eq. (11c), we first divide the entire expansion by A and re-use the lower-case notation introduced in section, and, at the same time, substitute a = K, expanding also the logarithm in the last term: ylnYt - clnCt - k\nKt + (1 - S)k/a ]n.Kt-i - [ylnY - clnC -klnK + (1 - 5)k/a(lnK - lna)] =0. Last, we add and subtract In A within the brackets containing the constant terms, and making use of the fact that y — c — k + (1 — 5)k/a = 0, we re-arrange the RHS into ylnYt ~ clnCt - k\nKt + (1 - S)k/a \n.Kt-i — [y \ny — cine — k In k + (1 — 5)k/a (In k — lna)] =0, (12c) which is the same as (6c). In eq. (lid) ■■■ (12d) In eq. (He) ■■■ (12e) B Numerical example of non-stochastic steady state C Algebraic system matrices for the stationarised model D Numerical recursive-form solution of the unit-root model