feds · June 30, 2014

OccBin: A Toolkit for Solving Dynamic Models With Occasionally Binding Constraints Easily

Abstract

We describe how to adapt a first-order perturbation approach and apply it in a piecewise fashion to handle occasionally binding constraints in dynamic models. Our examples include a real business cycle model with a constraint on the level of investment and a New Keynesian model subject to the zero lower bound on nominal interest rates. We compare the piecewise linear perturbation solution with a high-quality numerical solution that can be taken to be virtually exact. The piecewise linear perturbation method can adequately capture key properties of the models we consider. A key advantage of this method is its applicability to models with a large number of state variables.

Finance and Economics Discussion Series Divisions of Research & Statistics and Monetary Affairs Federal Reserve Board, Washington, D.C. OccBin: A Toolkit for Solving Dynamic Models With Occasionally Binding Constraints Easily Luca Guerrieri and Matteo Iacoviello 2014-47 NOTE: Staff working papers in the Finance and Economics Discussion Series (FEDS) are preliminary materials circulated to stimulate discussion and critical comment. The analysis and conclusions set forth are those of the authors and do not indicate concurrence by other members of the research staff or the Board of Governors. References in publications to the Finance and Economics Discussion Series (other than acknowledgement) should be cleared with the author(s) to protect the tentative character of these papers.

OccBin: A Toolkit for Solving Dynamic Models With Occasionally Binding Constraints Easily∗ Luca Guerrieri† Matteo Iacoviello‡ Federal Reserve Board Federal Reserve Board July 7, 2014 Abstract Wedescribehowtoadaptafirst-orderperturbationapproachandapplyitinapiecewisefashion to handleoccasionallybinding constraintsindynamicmodels. Ourexamplesinclude a realbusiness cycle model with a constrainton the levelof investmentand a New Keynesianmodel subject to the zero lower bound on nominal interest rates. We compare the piecewise linear perturbation solution with a high-quality numericalsolution that can be taken to be virtually exact. The piecewise linear perturbation method can adequately capture key properties of the models we consider. A key advantage of this method is its applicability to models with a large number of state variables. KEYWORDS: occasionally binding constraints, DSGE models, regime shifts, first-order perturbation. JEL CLASSIFICATION: C61, C63 ∗Theviewsexpressedinthispaperaresolelytheresponsibilityoftheauthorsandshouldnotbeinterpretedasreflecting the views of the Board of Governors of the Federal Reserve System or of any other person associated with the Federal ReserveSystem. Thelibraryofroutinesthataccompaniesthispaperaswellasadditionaldocumentationareavailableat thefollowing website: http://www2.bc.edu/matteo-iacoviello/research.htm. †Luca Guerrieri, Office of Financial Stability, Federal Reserve Board, 20th and C St. NW, Washington, DC 20551. Email: luca.guerrieri@frb.gov. ‡Matteo Iacoviello, Division of International Finance, Federal Reserve Board, 20th and C St. NW, Washington, DC 20551. Email: matteo.iacoviello@frb.gov.

1. Introduction Inequality constraints that bind occasionally arise in a wide array of economic applications. We describe how to adapt a first-order perturbation approach and apply it in a piecewise fashion to handle occasionally binding constraints. To showcase the applicability of our approach, we solve two popular dynamicstochastic models. ThefirstmodelisanRBCmodelwithlimitations onthemobilityoffactors of production. The second model is a canonical New Keynesian model subject to the zero lower bound on nominal interest rates. As is typical for dynamic models, the models we consider do not have a closed-form analytical solution. In each case, we compare the piecewise linear perturbation solution with a high-quality numerical solution that can be taken to be virtually exact.1 Our contribution is twofold. First, we outline an algorithm to obtain a piecewise linear solution. While the individual elements of the algorithm are not original, our recombination simplifies the application of this type of solution to a general class of models.2 We offer a library of numerical routines, OccBin, that implements thealgorithm and is compatible with Dynare, aconvenient andpopularmodeling environment (Adjemian et al. 2011). Second, we present a systematic assessment of the quality of the piecewise linear perturbation method relative to a virtually exact solution, which has not been attempted byothers. Because standardperturbationmethodsonlyprovidealocal approximation, they cannot capture occasionally binding constraints without adaptation. Our analysis builds on an insight that has been used extensively in the literature on the effects of attaining the zero-lower bound on nominal interest rates.3 That insight is that occasionally binding constraints can be handled as different regimes of the same model. Under one regime, the occasionally binding constraint is slack. Under the other regime, the same constraint is binding. The piecewise linear solution method involves linking the first-order approximation of the model around the same point under each regime. Importantly, the solution thatthe algorithm producesis notjustlinear –with two different sets of coefficients depending 1The virtually exact solution is obtained either by dynamic programming on a very fine lattice for the state variables ofthemodelorbyspectralmethods,followingChristiano and Fisher (2000). InadditiontotheRBCandNewKeynesian models,anonlineappendixevaluatesoursolutionforamodelofconsumptionchoicesubjecttoaconstraintonborrowing. 2Ourapproach,includingthetitleofthispaper,isinspiredbytheworkbyUhlig (1995)whodevelopedanearlytoolkit to analyze nonlinear dynamic discrete-time stochastic models without occasionally binding constraints. 3Recent examples of the use of this technique include Jung, Teranishi, and Watanabe(2005), Eggertsson and Woodford (2003), Christiano, Eichenbaum,and Rebelo (2011). 2

on whether the occasionally binding constraint is binding or not – but rather, it can be highly nonlinear. The dynamics in one of the two regimes may crucially depend on how long one expects to be in that regime. In turn, how long one expects to be in that regime depends on the state vector. This interaction produces the high nonlinearity. Our assessment focuses on several aspects of the solution. Following Christiano and Fisher (2000), we compare moments of key variables by reporting mean, standard deviation, and skewness. Following Taylor and Uhlig (1990), we compare plots of stochastic simulations. In addition, we assess the accuracy of the piecewise linear approximation by computing two bounded rationality metrics. The first metric is the Euler equation residual, following Judd (1992). The Euler equation residual quantifies the error in the intertemporal allocation problem using units of consumption. The second metric relies on the broader evaluation of expected utility. Intuitively, the closest approximation to the solution of the model will lead to the highest utility level. The difference in utility implied by two solution methods can also be expressed as a compensating variation in consumption that a utility-maximizing agent would have to be offered in order to continue using the less accurate method. On the basis of these comparisons and assessments, we find that the piecewise linear perturbation method can capture adequately key properties of the models we consider. We also highlight some limitations of the piecewise linear solution. Namely, just like any linear solution, it discards all information regarding the realization of future shocks. Accordingly, our piecewise linear approach is not able to capture precautionary behavior linked to the possibility that a constraint may become binding in the future, as a result of shocks yet unrealized. However, the piecewise method also inherits some of the key advantages of a first-order perturbation approach. It is computationally fast and applicable to models with a large number of state variables even when the curse of dimensionality renders other higher-quality methods inapplicable.4 Moreover, our library of numerical routines accepts a model written in a natural way with no meaningful syntax restrictions. Accordingly, application of our algorithm to different models requires only minimal programming. 4The library of routines that accompanies this paper contains additional examples of models that can be solved with a piecewise linear algorithm. One of the examples is the celebrated Smetsand Wouters(2007) model, extended to incorporate the zero lower bound on the policy interest rate. As an illustration of the speed of the piecewise linear algorithm, our toolkit solves that model in a fraction of a second. 3

Section 2 outlines the piecewise linear solution algorithm. Section 3 relates our approach to the literature. Section 4 considers a real business cycle model with a constraint on investment. Section 5 considers a New Keynesian model subject to the zero lower bound on nominal interest rates. Section 6 concludes. 2. The Solution Algorithm For clarity of exposition, we confine our attention to a model with only one occasionally binding constraint. Extensions to multiple occasionally binding constraints are implemented in the library of routines. A model with an occasionally binding constraint is equivalent to one with two regimes. Under one regime, the occasionally binding constraint is slack. Under the other regime, the constraint binds. We linearizethemodelundereachregimearoundthenon-stochasticsteadystate, althoughadifferentpoint could be chosen. We dub the regime that applies at the point of linearization the “reference” regime, or (M1). We dub the other regime “alternative”, or (M2). It is immaterial whether the occasionally binding constraint is slack at the reference regime or at the alternative regime. There are two important requirements for the application of our algorithm. 1. The conditions for existence of a rational expectations solution in Blanchard and Kahn (1980) hold at the reference regime. 2. If shocks move the model away from the reference regime to the alternative regime, the model will return to the reference regime in finite time under the assumption that agents expect that no future shocks will occur.5 Definition of a piecewise Linear Solution. Without loss of generality, when the occasionally binding constraint g(E t X t+1,X t ,X t−1) ≤ 0 is slack, the linearized system of necessary conditions for 5This restriction might appear draconian, butit isroutinely imposed when solving DSGEmodels with standard firstorder perturbation methods. In fact, the linear approximation to the solution could be equivalently characterized as implementing either therational expectations restrictions or perfect foresight. 4

an equilibrium under the reference regime can be expressed as: AE t X t+1 +BX t +CX t−1 +Eǫ t = 0, (M1) where X is a vector of size n that collects all the endogenous variables; E is the expectation operator, t conditional on information available at time t; A, B, and C are n×n matrices of structural parameters for the model’s linearized equations that are conformable with X; ǫ is a vector of zero mean, i.i.d. exogenous innovations of size m and E is an n×m matrix of structural parameters. When the constraint binds, then h(E t X t+1,X t ,X t−1) > 0. The analogous system of necessary conditions for an equilibrium under the alternative regime, linearized again around the non-stochastic steady state, can be expressed as: A∗E t X t+1 +B∗X t +C∗X t−1+D∗+E∗ǫ t = 0. (M2) The matrices A∗, B∗, C∗ are again n×n matrices of structural parameters. In addition, under (M2) there is a column vector of parameters D∗ whose size is n. The presence of D∗ arises from the fact that the linearization is carried out around a point (the steady state by our choice) in which regime (M1) applies. FinallyE∗ isanothern×mmatrixofstructuralparameters. Notice thattheconditionsimplied by the functions g and h above are assumed to be mutually exclusive and collectively exhaustive. We are now in a position to define a solution for our model. Definition 1. A solution for a model with an occasionally binding constraint is a function f : X t−1× ǫ → X such that the conditions under system (M1) or the system (M2) hold, depending on the t t evaluation of the occasionally binding constraint, governed by g and h. Analternative way ofcharacterizing thefunctionf reliesonmatrixexpressionswhichclosely mirror the familiar decision rules of a linearized dynamic model. Accordingly, given initial conditions X0 and the realization of a shock ǫ1, the function f can be expressed as a set of matrices P t , a set of matrices 5

R t , and a matrix Q1, such that: X t = P t X t−1 +R t +Q1ǫ1, for t = 1 (1) X t = P t X t−1 +R t ∀t ∈ {2,∞}. (2) As equations 1 and 2 show, the solution from our piecewise algorithm need not be linear, even if the original system described by (M1) and (M2) is. At each point in time the matrices P , Q , R are t t t time varying, even if they are functions of X t−1 and ǫ1 only. The Solution Algorithm. Given the conditions for an equilibrium in M1 and M2, and given the occasionally bindingconstraintexpresseding andh,thefollowingalgorithmcharacterizes thepiecewise linear solution f, defined above. The output of the algorithm is a time varying decision rule whose general form is given in Equations (1) and (2). Accordingly, the algorithm shows how to compute the matrices P t , Q t , and R t given initial conditions X0 and given the realization of a shock ǫ1. The algorithm employs a guess-and-verify approach. First, we guess the periods in which each regime applies. Second, we proceed to verify and, if necessary, update the initial guess as follows: 1. Let T be the date when the current guess implies that the model will return to regime (M1). Then for any t ≥ T, using standard perturbation methods, one can characterize the linear approximation to the decision rule for X t , given X t−1, as: X t = PX t−1 +Qǫ t , (M1DR) where P and Q are n×n and n×m matrices of reduced-form parameters, respectively. Then, using the notation of Equation 2, for any t ≥T, P = P, R = 0. t t 2. Using X T = PX T−1 and Equation (M2), coupled with the assumption that agents expect no shocks beyond the first period, the solution in period T − 1 will satisfy the following matrix equation: A∗PX T−1+B∗X T−1+C∗X T−2+D∗ = 0. (3) 6

Solve the equation above for X T−1 to obtain the decision rule for X T−1, given X T−2: X T−1 = −(A∗P +B∗)−1 (C∗X T−2+D∗). (4) Accordingly, P T−1 = −(A∗P +B∗)−1 C∗ and R T−1 = −(A∗P +B∗)−1 D∗ 3. Using X T−1 = P T−1X T−2 +R T−1 and either (M1) or (M2), as implied by the current guess of regimes, solve for X T−2 given X T−3. 4. Iterate back in this fashion until X0 is reached, applying either (M1) or (M2) at each iteration, as implied by the current guess of regimes. 5. Dependingonwhetherregime(M1)or(M2)isguessedtoapplyinperiod1,Q1 = −(AP2+B)−1 E, or Q1 = −(A∗P2+B∗)−1 E∗. Trivially, in the special case in which regime (M1) is guessed to apply in all periods, one can see that Q1 = Q, consistent with equation (M1DR). 6. Using the guess for the solution obtained in steps 1 to 5, compute paths for X to verify the current guess of regimes. If the guess is verified, stop. Otherwise, update the guess for when regimes (M1) and (M2) apply and return to step 1. Given X0 and ǫ1, an expedient initial guess of regimes can be obtained by applying the standard first-order perturbation solution to (M1). In general, the guess will have to be updated, because a switch in regimes is associated with a change in the paths of the endogenous variables. A choice for the updating scheme in step 6 that we have found resilient in practice is to use the path for X from the previous iteration to infer a new guess of regimes. As an alternative, one may choose to dampen the iterations by shrinking (or expanding) the number of periods when a certain regime applies only gradually, in a fashion analogous to the Gauss-Jacobi algorithm. Computation of the solution requires a series of inversions for the matrix J ≡ (A∗P +B∗), for t t t = 2 to t = T. Contingent on a guess for a sequence of regimes, non-invertibility of the matrix J t implies the existence of multiple paths that lead back from the point X T to the point X0. In that case, the application of a pseudo-inverse, as suggested by Chen, Cu´rdia, and Ferrero (2012), arbitrarily 7

selects one of these paths. Notice that for multiple solutions to exist, non-invertibility of J is neither sufficient nor necessary. t It is not sufficient because one needs to also verify that the given guess of regimes is consistent with the occasionally binding constraint of interest after calculation of a full path for X. It is not necessary because distinct sequences of regimes may support multiple solutions. Implementation of the Algorithm. Thepaperiscomplemented byalibraryofnumericalroutines, OccBin, that implements the piecewise linear solution algorithm using the MATLAB programming language. Our routines are designed as an add-on to Dynare, a widely used set of programs for the solution and estimation of DSGE models. Dynare lets users specify a DSGE model using a readable syntax that imposes only trivial requirements intheway a modelis specified. Theprograms wedevised take as inputs two Dynare model files. One file specifies the model (M1) at the reference regime. The otherfilespecifiesthemodelatthealternativeregime(M2). Weusetheanalyticalderivativescomputed by Dynare to construct A,B,C,E,A∗,B∗, C∗,D∗, and E∗ in equations (M1) and (M2). We also use the routines in Dynare to construct the matrices P and Q in equation (M1DR). Characteristics of the Piecewise Linear Solution. A simple linear difference equation with an expectationaltermandacontroltermisanidealvehicletoillustratekeycharacteristicsofthepiece-wise linear solution, before moving to a broader assessment of its performance for richer models. Consider a variable q whose evolution is determined by the following schedule: q t = β(1−ρ)E t q t+1+ρq t−1−σr t +u t , (5) where E is the conditional expectation operator, and β = 0.99, ρ = 0.5, and σ = 5 are parameters. t The current realization of the variable, q , depends on its expectation for next period, and its value for t the previous period. The variable also depends on the control term, r , and an exogenous shock u , t t which follows an AR(1) process with the autoregression coefficient of 0.5 and a standard deviation of 8

the innovation equal to 0.05. In turn, the control variable follows a simple feedback rule: r = max(r,φq ), (6) t t where φ = 0.5 is a parameter. The max operator prevents r from falling below a certain lower bound t chosen as r = − 1 −1 . This system of difference equations has various economic interpretations.6 β (cid:16) (cid:17) For concreteness, we interpret q as an asset price and r as a net policy interest rate (in deviation from 1 its steady state of −1), subject to the zero lower bound. β The policy functions for q and r implied by the piecewise linear method are shown in Figure 1. t t Starting from steady state, for realizations of the shock u above a certain threshold, the decision rules t are simply linear (and by construction there is no difference with a linear solution). For realizations of u above the threshold, higher values of u lead to higher asset prices and, through the feedback rule, t t higher interest rates. When u falls below the threshold, the feedback rule for the interest rate hits the lower bound t constraint, and the piecewise linear solution implies a switch in regimes. At this point, the policy functions depend on the expected duration of the lower-bound regime. Negative realizations of u of t larger magnitude imply a longer duration of the zero bound regime. In turn, this mechanism leads to a deeper decline in asset prices because the feedback rule is temporarily switched off. The inset panel of Figure 1 highlights that the slope of the decision rule is a step function. The different steps (slopes of the policy function for the asset price) correspond to different expected durations of the regime in which the lower bound on the interest rate is enforced. To underscore the value of concatenating the conditions for an equilibrium under different regimes, as implied by the piecewise linear solution, it is useful to consider a “naive” piecewise linear solution scheme. Following this naive scheme, in order to enforce the lower bound in Equation (6), we simply splice the decision rules for two models. The first rule is for a model that excludes the lower bound at all times. The second rule is for a model that enforces the lower bound at all times. As Figure 1 makes clear, the naive solution matches a linear solution for positive shocks that inflate 6See, for instance Chapter 5 of Blanchard and Fischer (1989). 9

the asset price. However, whennegative shocks are large enough for the lower boundto bereached, the “naive” solution incorrectly implies that the constraint will be enforced (and expected to be enforced) forever,onlyforthoseexpectationstobedashed,evenintheabsenceoffurthershocks,oncetheinterest rate eventually rises. Accordingly, the asset price jumps, rising closer to what would be an implied higher steady state, under the mistaken assumption that the regime will last forever. By contrast, under the piecewise linear solution produced by OccBin, expectations reflect the duration of the lower bound regime, which avoids the large discontinuity in the policy function for asset prices. Accordingly, the policy functions retrieved by OccBin are much closer to the fully nonlinear policy functions from highly accurate projection methods.7 The fully nonlinear policy functions hug the policy functions obtained from our piecewise linear solution, but there are some small differences. Shocks that move the interest rate close to its lower bound also imply that reaching the lower bound will be more likely when additional shocks hit the asset pricing equation. This consideration is not incorporated in the policy functions for the piecewise linearsolution. Accordingly, theinterestrateandtheassetpriceareslightly lower forlarge deflationary shocks under the fully nonlinear solution than under the piecewise linear solution. Of course, just as this anticipation of future regime switches is absent from the piecewise linear solution, it is also absent from the linear solution and from the naive solution. Finally, a further prosaic difference between the piecewise linear solution and the naive splicing of two linear decision rules is the range of applicable models. The naive splicing can only be implemented when the Blanchard-Kahn conditions apply separately to all regimes of interest. By contrast, for the piecewise linear solution, those conditions need not hold for the alternative regime. 3. Related Approaches A recent review of solution algorithms that mitigate the curse of dimensionality, is provided by den Haan, Judd, and Juillard (2011) and references therein. Judd, Maliar, and Maliar (2012) extend that review by considering methods appropriate for the solution of models with occasionally binding 7Forthenonlinear solution we approximatedthedecision rulefor theexpectation of theasset pricewith aChebyshev polynomial of order 6 and parameterized it with a standard collocation procedure. We approximated the AR(1) process for the shock u t with a Markov process with 51 states. 10

constraints. They do not dwell on piece-wise linear solutions. We do not attempt to replicate a comprehensive review of the literature but focus on the connection between the piecewise linear algorithm presented above and alternative algorithms that ameliorate the curse of dimensionality. The idea of concatenating decision rules from multiple regimes and shooting back from the last period in which the reference regime is expected to apply in perpetuity can be traced back to Jung, Teranishi, and Watanabe (2005). Their focus is on an economy subject to the zero lower bound on nominal interest rates. Our formulation of the piecewise linear solution algorithm applies to any linear model under a general form for the specification of the occasionally binding constraints. Oneextension of thebasic piecewise linear solution inJung, Teranishi, and Watanabe (2005) is due toEggertsson and Woodford (2003). Theyconsideramodelwitha shockto thenaturalrate of interest subject to a Markov process with only two states. In one state, the natural rate is so low that the zero lower bound binds. Under this stark stochastic structure, they compute a rational expectation solution, instead of a perfect-foresight solution. However, in their model the expected duration of the alternative regime, i.e. the policy rate at the lower bound, is always fixed at a value determined by the Markov process. By contrast, in our setup the duration of the alternative regime is dependent on the realization of shocks. In turn, the expectation of how long a regime is expected to last affects the value of the endogenous variables contemporaneously. Building on the work of Las´een and Svensson (2009), Holden and Paetz (2012) provide a solution method that allows for occasionally bindingconstraints based on introducing anticipated shocks. With a first-order perturbation approach, their method would produce paths for the endogenous variables identical to the ones of our piece-wise approach.8 The choice of anticipated shocks that mimic occasionally binding constraints is specific to each model and is not amenable to a general specification, such as the one achieved for our algorithm. Uponlinearizationofthemodel,anextendedpathalgorithm,astheoneproposedbyFair and Taylor (1983) andfurtherdeveloped by Adjemian and Juillard (2011), would alsoyield thesamepathfor theendogenous variables as our piecewise linear algorithm. One advantage of the extended path algorithm is that 8An explanation for the equivalence of the two approaches and a discussion of their relative merits is provided in the appendices of Bodenstein, Guerrieri, and Erceg (2009) and of Bodenstein, Guerrieri, and Gust (2013). 11

it can also handle nonlinear perfect-foresight models, avoiding linearization altogether. However, in practice, convergence of the algorithm may be difficult without a high-quality initial guess. An advantage of our piecewise linear method is that it greatly simplifies the search process. Instead of searching for the paths of all the endogenous variables, the piecewise linear algorithm only needs to search for a sequence of regimes. The extended path algorithm relies on derivative-based methods to search for a solution. This search is complicated by the fact that occasionally-binding constraints introduce a discontinuity in the derivatives of the conditions for an equilibrium. Substitution of the kink implied by the occasionally binding constraint with a smooth polynomial approximation may yield a reformulation of the model more easily amenable to derivative-based solution methods. Our attempts at pursuing this strategy revealed undesirable side effects. As we increased the order of the polynomial to get a better approximation to the kink implied by an occasionally binding constraint, the polynomial generated wild oscillations when moving away from the area immediately surrounding the kink. An alternative way of masking the discontinuity implied by occasionally binding constraints is offered by McGrattan (1996), Preston and Roca (2007), and Kim, Kollmann, and Kim (2010). The insight is to penalize agents’ utility when a particular constraint is hit. While this method has the advantage of converting a model with occasionally binding constraints into a model that is solvable by perturbation methods, it suffers from undesirable drawbacks. First, the solution will change with the size and the shape of the penalty (the barrier parameter). Moreover, any high-order perturbation method will generate a smooth solution that in some instances will violate the inequality constraint. The remarkable recent work of Judd, Maliar, and Maliar (2012) also provides a solution algorithm that can handle both a sizable number of state variables and occasionally binding constraints. Their innovation is to use a simulation-based approach to construct the approximation grid for projection methods, which ameliorates the curse of dimensionality. However, the computational burden of this method may remain too high for models oriented towards empirical realism. For instance, Judd, Maliar, and Maliar (2012) highlight that a simplified version of the Smets-Wouters model with an added zero lower bound constraint can be solved in 25 minutes (with serial processing in Matlab). 12

4. An RBC Model with a Constraint on Investment Foritssimplicity andwidespreaduse,theRBCmodelisastapleoftheliteraturethathascomparedthe performance of different solution techniques (see for instance, Taylor and Uhlig 1990). In our variant of this canonical model, the choice of investment is subject to an occasionally binding constraint. This constraint prevents investment from falling below an exogenously fixed lower bound in every period. This exogenous lower bound could be set to imply that investment cannot be negative. Accordingly, our model nests a model in which capital is irreversible. Model Overview. A central planner maximizes households’ utility ∞ 1−γ C −1 maxE0 βt t , 1−γ t=0 X subject to the constraints in Equations (7) to (9) below: C +I = A Kα , (7) t t t t−1 K t = (1−δ)K t−1+I t , (8) I ≥ φI . (9) t SS The planner chooses consumption, C , investment, I , and capital, K . Equation (7) is the resource t t t constraint and A Kα is the economy’s output in period t. Technology A evolves according to t t−1 t lnA t = ρlnA t−1+σǫ t , (10) where ρ and σ are parameters and ǫ is an exogenous innovation distributed as standard normal. t Equation (8) is the capital accumulation equation, with depreciation rate δ. Finally, Equation (9) is an occasionally binding constraint that prevents investment from falling below a fraction φ of investment in the non-stochastic steady state, denoted by I . When theparameter φ equals 0, this last constraint SS implies that capital is irreversible. In the numerical experiments below, we set φ at a value well above 13

zero which ensures that the constraint binds frequently. Denoting with λ the Lagrange multiplier on the investment constraint given by (9), the equat tions describing the necessary conditions for an equilibrium are (7), (8), and (10) together with the consumption Euler equation and the Kuhn-Tucker condition for the investment constraint: C t −γ −λ t = βE t C t − + γ 1 1−δ+αA t+1K t α−1 −(1−δ)λ t (11) (cid:16) (cid:17) (cid:0) (cid:1) λ (I −φI ) = 0. (12) t t SS These equations form a dynamic system of five equations in the five variables {C ,I ,K ,A ,λ }. t t t t t When mapping these conditions into the notation used in Section 2, (M1) and (M2) only differ because of one equation in this case. The complementary slackness condition for the optimization problem implies that λ = 0 when the constraint is slack. Conversely, when the constraint binds, t I = φI . The conditions in (M1) encompass λ = 0 and the function g captures I ≥ φI . The t SS t t SS conditions in (M2) encompass I = φI , and the function h captures λ > 0. t SS t Calibration and Policy Functions. Table 1 summarizes the calibration, which reflects a choice of yearly frequency. Most parameter choices are standard. The risk aversion parameter γ is set to 2: we discuss sensitivity to alternative choices below. We set φ = 0.975, which implies that the constraint binds about 40% of the time. We set α = 0.33, δ = 0.1, and β = 0.96. Finally, we set σ = 0.013 and ρ= 0.9, these parameter choices imply a standard deviation of log output around 4 percent. In the absence of an analytical closed-form solution for the model, we use projection methods and dynamic programming to characterize a high-quality, fully-nonlinear solution.9 The resulting investment function of the full nonlinear solution is shown in the top panel of Figure 2. Regardless of theinitiallevel of capital, low realizations of technology trigger investment (indeviation fromitssteady state)tohititslowerboundgivenby−(1−φ). Thebottompanelcomparesthenonlinearsolutiontothe piecewise solution obtained using our method. Given our benchmark calibration, investment is slightly lower under the piecewise solution when the irreversibility constraint does not bind. The higher level 9A detailed description of thealgorithms for the fully-nonlinear solution is given in AppendixA. 14

of investment in the nonlinear solution comes from the effect of uncertainty on precautionary saving. However, the policy functions are remarkably close. Assessing Performance: Impulse Responses and Moments. The transitional dynamics are illustrated in Figure 3, which shows responses of the model variables to two shocks to technology, the term ǫ in Equation (10). The sizes of the two shocks are symmetric around the steady state. The t first shock brings down the level of technology by 4 percent (close to a 3 standard deviation shock). The second shock pushes up the level of technology by 4 percent. For ease of comparison, responses to the first shock are shown on the left-hand side of the figure, and responses to the second shock on the right-hand side. In each column, the solid lines denote the piecewise linear solution, the dashed lines denotethedynamicprogrammingsolution,andthedash-dottedlinesdenotethefirst-orderperturbation solution. Thedeclineintechnology leadstoadeclineininvestmentlargeenoughfortheinvestmentconstraint to bind. Theresponsesobtained fromthepiecewise linear andthefullnonlinear solutions are strikingly close. As investment cannot fall more than 2.5 percent relative to its steady-state value, the drop in consumption is exacerbated relative to a model without an investment constraint. The first-order perturbation solution ignores the constraint altogether, and the responses from the first-order solution exhibit a markedly smaller contraction in consumption. When technology rises, the responsesfrom the three solution methods track each other closely. One difference is that the full-nonlinear solution implies a slightly higher accumulation of capital, in line with precautionary motives stemming from the concavity of the utility function. Neither the piecewise linear nor the linear method can capture such precautionary motives. Table2compareskey moments.10 Overall, themoments fromthepiecewiselinear andthenonlinear solution methods are strikingly close. The piecewise linear method captures first, second, and third moments of the distribution of key variables. In particular, it captures the skewness in the distribution of consumption and investment derived from the occasionally binding constraint, which is missed by the first-order perturbation method. Furthermore, the piecewise linear method matches closely the 10Santos and Peralta-Alva (2005) show that simulated momentsfrom numerical approximations to dynamicstochastic models convergeto their exact valuesas theapproximation errors of thesolutions converge to zero. 15

frequency with which the constraint binds. Both the piecewise linear and fully nonlinear solutions imply that the constraint on investment binds, on average, 41 out of every 100 periods. Assessing Performance: Euler Residuals. Besides a comparison of moments, it is possible to check the accuracy of the piecewise linear solution in economic terms, using the bounded rationality metric in Judd (1992). Moving from the Euler equation for consumption, we define the Euler equation error (expressed as a fraction of units of consumption) as: −1 −C t + λ t +E t β C t − + γ 1 (1−δ)+αA t+1K t α−1 −(1−δ)λ t+1 γ err = . (13) t n h (cid:0) C t (cid:1) io When sizing the errors for different solution methods, we use the decision rules for capital implied by each method, coupled with the full set of nonlinear constraints implied by Equations (7) to (9). Figure4showsEulerequationerrorsfordifferentlevelsoftechnologyanddifferentsolutionmethods. The top panel reports Euler residuals for the piecewise linear method. The middle panel relates to the linear method for the same model without the constraint on investment. The bottom panel returns to the model with with the constraint on investment and reports Euler residuals for the nonlinear solution.11 All panels report the absolute value of the Euler residuals expressed in logarithmic scale with base 10. Under that scale, the interpretation of a value of, say, −4 is that the Euler error is sized at $1 per $10,000 of consumption. The range in the abscissae was chosen to encompass most of the mass of the ergodic distribution for capital under the baseline calibration. For the levels of technology shown, the errors in the top panel stay uniformly below −3 and dip well below −4 for part of the range of capital. The Euler errors in the middle panel are consistent with results in Aruoba, Fernandez-Villaverde, and Rubio-Ramirez (2006), who also discuss the performance of the log-linear solution algorithm for the standard RBC model. Strikingly, the Euler residuals for the piecewise linear algorithm used for the top panel remain of a similar order of magnitude as for the first-order perturbation method used for the middle panel. In fact, in the case of “Low technology,” the piecewise linear algorithm even implies smaller solution errors. This finding is not too surprising, 11Anequivalentinterpretation ofthemiddlepanelof Figure4 isthat it relates tothepiecewise linear solution method for an alternative calibration of theparameter φ, so low as to make theconstraint on investment irrelevant 16

since for low values of capital and technology, the piecewise linear decision rule nearly coincides with the fully-nonlinear rule. The bottom panel of Figure 4 shows Euler residuals for a fully nonlinear collocation method. The figureconfirmsthatEulererrorsareofaneconomicnegligiblemagnitudeforthefullynonlinearsolution, consistent with results presented in Christiano and Fisher (2000). The contours shown stay well below −6, dropping to around −14 at the collocation nodes. Assessing Performance: Welfare. Intuitively, a superior approximation to the solution of the modelshouldyield ahigherlevel ofutility regardless oftheinitialconditions. Toexpressthedifferences in utility implied by the piecewise linear solution and by the fully nonlinear solution, we focus on the constant proportional increase in consumption, the subsidy rate, that would have to be promised in order to make the representative agent indifferent between using the inferior piecewise linear decision rule instead of the full nonlinear decision rule. Denoting with C and by C the consumption NL,t PL,t levels implied by the nonlinear decision rule and by the piecewise linear rule respectively, we size the accuracy of the piecewise linear decision rule by the subsidy rate τ, where τ is such that: ∞ C 1−γ −1 ∞ (C (1+τ)) 1−γ −1 E βt NL,t = E βt PL,t . (14) t t 1−γ 1−γ t=0 t=0 X X We compute the expected utility of the representative agent implied by the decision rules from the full nonlinear solution and from the piecewise linear solution. Both decision rules can be expressed in termsofcapitalandtheleveloftechnology. Then,fromthecapitalaccumulationequation,onecanback out the level of investment. After enforcing the occasionally-binding investment constraint in Equation (9),onecan computeconsumptionusingtheresourceconstraint. Weobtainthevaluefunctionfromthe decision rule using the Howard improvement algorithm as described in Ljungqvist and Sargent (2004). We find that the value of the subsidy for the baseline parameterization is $1 per about $14,500,000 of consumption. Such a small subsidy implies that the piecewise linear approximation works remarkably well. This statement can be putin context by contrasting our approximation with a clearly suboptimal rule that always sets the capital stock to its previous value, so that K t = K t−1. In that case, consump- 17

tion moves in lockstep with movements in technology, and the welfare cost of not optimizing is orders of magnitude larger, $1 per about $3,000 of consumption. In robustness experiments (expanded on in Appendix A), we also consider sensitivity with respect to the choice of the value for two key parameters, the discount factor β and the risk aversion coefficient γ. The welfare cost of using the piecewise method increases as the discount factor rises, from $1 per about $14,500,000 of consumption in the baseline to $1 per about $3,000,000 when β=0.98. We conjecture that in the plain vanilla RBC model the nonlinearities become more pronounced as the risk free rate becomes lower, thus penalizing linearization in general over a fully nonlinear solution algorithm. Moreover, the welfare cost of using our piecewise solution method is a non-monotonic function of risk aversion. In Appendix A we discuss further the intuition for this result, highlighting the subtle, model-specific differences between our solution method and the fully nonlinear one. 5. A New Keynesian Model with the Zero Lower Bound We consider a textbook version of the New Keynesian model, such as the one described in Gal´ı (2008). For ease of comparison, the notation and calibration hew closely to the version presented in Ferna´ndez-Villaverde et al. (2012), who also consider the consequences of attaining the zero lower bound on nominal interest rates using fully nonlinear solution techniques. In the model, a representative household provides labor (the only input in production) to intermediate firms and consumes. A continuum of intermediate firms that produce differentiated products subject to monopolistic competition adjust their prices according to Calvo-type contracts. The intermediate products are repackaged by competitive final firms. A government sector consumes part of the final good and sets monetary policy according to a Taylor rule subject to the zero lower bound. Model Overview. A representative household chooses consumption and labor streams C , L , and t t government bonds B to maximize: t ∞ t L 1+ϑ Ct m ,L a t, x Bt E0 t=0 i=0 β i ! logC t −ψ 1+ t ϑ ! , X Y 18

where the discount factor β follows the process t lnβ =(1−ρ)logβ +ρlogβ +σǫ . (15) t t−1 t Theterm ǫ is an exogenous innovation distributedas standardnormal, andσ is thestandarddeviation t of the innovation. The budget constraint is given by: C t +B t /P t = w t L t +R t−1B t−1/P t +T t +F t . (16) For simplicity, we do not describe the full set of Arrow-Debreu securities available to households in addition to the non-state contingent government bond B , which pays the nominal gross interest rate t R . The price level is P . The terms T and F represent lump–sum taxes and an aliquot share of the t t t t profits/losses of intermediate firms. Competitive final firms repackage intermediate goods Y to produce a final good Y according it t ǫ to Y = 1 Y ǫ− ǫ 1 ǫ−1 . Profit maximization yields the demand schedule Y = Pit −ǫ Y for each t 0 it it Pt t (cid:18) (cid:19) (cid:16) (cid:17) R intermediate variety, where P is the price of variety i. Taking the demand from final firms as given, it intermediate firms choose their price to maximize profits, subject to Calvo-type restrictions. Each period, a fraction 1−θ of firms is selected to re-optimize its price (while all other firms keep the old price). The firms selected solve: ∞ τ −ǫ maxE t θτ λ t+τ P it −mc t+τ P it Y t , (17) Pit τ=0 i=0 ! λ t (cid:18) P t+τ (cid:19)(cid:18) P t (cid:19) X Y where λ is the Lagrangian multiplier on the household’s budget constraint for period t and mc is the t t real marginal cost of production. Given that the production technology is Y = L , the term mc it it t equals the wage rate w . t Thegovernment budgetisbalancedeveryperiod(B = 0 ∀t),andspendingisfinancedbylumpsum t taxes T . Government spending is a constant share of aggregate output, given by G = s Y . Monetary t t g t 19

policy is implemented as follows: φ φ Π π Y y t t Z = R (18) t Π Y (cid:18) (cid:19) (cid:18) (cid:19) R = max(Z ,1) (19) t t where Z is the notional policy rate and R is the actual policy rate, both expressed in gross terms. t t The term Π is defined as Pt . Equation (18) is a Taylor-type rule for setting the interest rate Z . t Pt−1 t Equation(19)istheoccasionally bindingconstraintstatingthattheactualpolicyratecannotfallbelow 1. Above, Π is the steady-state target level of inflation, R is the steady-state nominal gross return of bonds (equal to Π divided by β), and Y is steady-state output. For reasons of space, we only emphasize key conditions for an equilibrium. In particular, the conditionsthatinvolveintertemporaltermsareofspecialinterestbecausethefullynonlinearcollocation solutionisobtainedbyparameterizingtheexpectationsoffuturevariables. Forcompleteness, Appendix B lists all the necessary conditions for an equilibrium and describes the collocation method used to obtain the fully nonlinear solution. Following Yun (2005), aggregate supply Y can be shown to be equal to: t Y =L /v (20) t t t where v is a measure of price dispersion for intermediate producers equal to v = 1 Pit −ǫ di. In t t 0 Pt (cid:16) (cid:17) R turn, the evolution of dispersion is a state variable given by: v t = θΠǫ t v t−1+(1−θ)(Π∗ t )ǫ. (21) The term Π∗ is defined as P t ∗ , where P∗ is the price selected by firms that can re-optimize in period t. t Pt t The remaining intertemporal conditions involve expectations: the Euler equation for consumption 1 1 R t = E β ; (22) C t t tC t+1Π t+1 (cid:18) (cid:19) 20

and two additional equations that are obtained from the profit maximization problem for intermediate firms and that involve two auxiliary variables x1t and x2t x1t = mc t Y t /C t +θE t β t Πǫ t+1 x1t+1; (23) x2t = Π∗ t Y t /C t +θE t β t Π t ǫ + − 1 1 Π∗ t x2t+1/Π∗ t+1 . (24) To map the conditions for an equilibrium into the notation used in Section 2, one only needs to recognize that, again, (M1) and (M2) only differ because of one equation to capture the max operator in Equation (19). The set of conditions under (M1) encompasses R = Z , implying that the actual t t and notional interest rates coincide. The set of conditions under (M2) encompasses R = 1, implying t a gap between the actual and notional interest rates. The function h(·) is defined as −R +1; hence, t when the system under (M1) implies that R < 1, the set of conditions under (M2) applies, ensuring t the actual gross interest rate cannot fall below 1. Furthermore, the function g(·) is defined as −Z +1; t hence, when Z ≥ 1 the set of conditions under (M1) applies, implying that actual and notional rates t coincide only when the gross notional rate is at or above 1. Calibration. The calibration is summarized in Table 3. The parameters reflect a choice of quarterly frequency. We follow closely the standard choices in Ferna´ndez-Villaverde et al. (2012), but we adapt them to reflect that we simplified the stochastic structure of the model. They consider an array of shocks, while we focus only on shocks to the discount factor β , which are often used t to bring the model to the zero lower bound in stylized New Keynesian settings, see for instance Christiano, Eichenbaum, and Rebelo (2011). We increase σ, the standard deviation for this shock, from 0.0025 to 0.005 and choose its persistence ρ to be 0.8. The steady state discount factor β is 0.994. With an annual inflation rate of 2 percent (Π = 1.005), the steady-state yearly nominal interest rate is 4.4%. With this choice and the larger discount factor shock, the model attains the zero lower bound with an empirically realistic frequency in the 5 to 10 percent range. Another departure from the calibration in Ferna´ndez-Villaverde et al. (2012) pertains θ, the probability that an intermediate firm will have to keep its price unchanged. To curb the volatility of inflation with a nod to empirical 21

realism, we push this parameter from 0.75 to 0.9. This change, in conjunction with an interest rate rule that responds aggressively to inflation, with a coefficient φ set at 2.5, prevents large disinflations π from occurring at the zero lower bound, in line with recent U.S. experience. Assessing Performance: Impulse Responses, Moments, and Euler Residuals. Figure 5 shows the responses to two unexpected shocks to the discount factor, ǫ in Equation (15). The sizes t of the two innovations considered are symmetric around the steady state. The left-hand-side column shows responses to a shock that brings β up to 1.019 (a positive innovation to the shock process equal to 4 standard deviations). The right-hand-side column shows responses to a shock that brings β down to 0.969. The figure compares the response of the model as implied by three solution methods, the piecewise linear method implemented with OccBin, a fully nonlinear collocation solution, and a first order perturbationthat disregards the zero lower bound. The responsesimplied by the piecewise linear and the nonlinear solution lie close to each other, especially for the shock that reduces the discount factor. The differences are more pronounced for the shock that pushes β up. In response to this first shock, the nonlinear solution implies a spell at the zero lower bound lasting 4 periods; the path of the policy rate implied by the piecewise linear solution lifts off one quarter early. The contraction in output and inflation implied by the nonlinear solution when the zero lower bound is attained are both a tad larger relative to the paths for the piecewise linear solution. By contrast the differences relative to the linear solution that ignores the lower bound are dramatic. The trough of the output response is close to -4% for the linear solution and -6% for the piecewise linear and the nonlinear solutions, in other words, the output responses differ by almost 50% for the shock considered. The differences highlighted in Figure 5 are also reflected in the comparison of moments in Table 4. Overall, the key moments obtained with the full nonlinear solution method line up well with those from the piecewise linear solution, both at the ZLB and away from it. One notable difference is that, under the collocation solution, the ZLB hits more frequently on average (7 against 4 percent) and the volatility of output is slightly larger. There are two main forces shaping the differences between the solution produced by OccBin and the nonlinear solution: an uncertainty effect, and a price dispersion effect. These effects can reinforce 22

or offset each other in ways that depend on the calibration, on the size of the shock considered, and on the linearization point. The uncertainty effect implies that negative shocks at the ZLB produce larger contractions than away fromit, sincemonetarypolicyisunabletooffsetthem. Inturn,theexpectation ofnegative shocks when already at the ZLB further reduces prices and output, since agents expect that monetary policy will be unable to accommodate these shocks. As a consequence, when uncertainty is explicitly taken into account, the ZLB hits more frequently, policy is more accommodative, and output is more skewed to the left. The uncertainty effects imply larger responses at the ZLB than captured by the piecewise linear solution method, which ignores uncertainty. This effect has been highlighted by Nakata (2013), among others. Even whenuncertainty is ruledout, thepiecewise solution may overstate orunderstatetheresponse of price dispersion due to nonlinearities. These nonlinearities can be important especially for large shocksthattakeoutputclosetotheZLB,ashighlightedbyBraun and Waki (2010). Inourapplication, the size and direction of the misses are a function of the size of the shock, since price dispersion is a U-shapedfunctionofinflation.12 Asimplied byEquation (20), aggregate supplyisnegatively related to dispersion,ashighdispersionimpliesthatafewfirms,stuckwithlowerprices,areinefficientlycapturing a disproportionate fraction of aggregate demand. In the example of Figure 5, price dispersion drops more in the nonlinear solution, temporarily reducingthe inefficiency and cushioningthe drop in output relative to the piecewise linear solution. This effect partly offsets the miss related to the uncertainty effect.13 Given that the uncertainty and price dispersion effects may offset or reinforce each other, it is especially important to assess the performance of the piecewise linear method for different calibrations, as well as across a wide range of values for dispersion and for different values of the shock process β . t Figure 6 shows Euler equation errors for the baseline calibration, expressed as a share of consumption 12For the linear and piecewise linear solutions considered, we linearize around a non-zero inflation rate. Perturbation solutions around a zero inflation point would imply that price dispersion is constant. In that special case, dispersion entirelydropsoutofthelinearized setofconditionsforanequilibrium. ForadiscussionofdispersioninaNewKeynesian model see Schmitt-Grohe and Uribe(2007). See also Figures A and B of AppendixB. 13Inageneralequilibriumsetting,theresponseofdispersionisalsoinfluencedbyprecautionarymotives. Weconfirmed thatthepiecewise linear solution understatesthedecreasein dispersion inresponse totheincrease in thediscount factor shown in Figure 5 by checkinga nonlinear solution underperfect foresight. 23

as for the previous model considered. The figure shows errors for three shock sizes: “Median Beta” corresponding to β = 0.994; “Low Beta” corresponding to β = 0.965; “High Beta” corresponding t t to β = 1.023.14 We find it remarkable that, at worst, the Euler errors stay close to $1 per $1000 of t consumption for extreme values of dispersion even when the zero lower bound binds. As shown in the middle panel of the figure, this magnitude is similar to the misses for first-order perturbation solution of a model that disregards the zero lower bound. The bottom panel confirms that the Euler errors are of an economically negligible magnitude for the fully nonlinear solution. Additional robustness checks can be found in Table B in the Appendix, where we compare key moments for different calibrations of the model that focus on varying the monetary policy rule and steady-state inflation. We find that the piecewise linear model continues to perform adequately: if anything, across experiments, it tends to always underestimate the frequency of ZLB episodes and the volatility of output. We conclude our discussion of the New Keynesian model with a word of caution: while the range of parameter values for which we can solve and find a unique solution for the piecewise linear model is extensive, our numerical routines for the fully nonlinear solution encountered convergence problems for very persistent shocks, for low values of the price rigidity, and for monetary policy rules with a small inflation response. We conjecture – as many others have already done – that the New Keynesian model might be afflicted by several pathologies near the zero lower bound that can make the identification of global solutions especially challenging. These issues have been analyzed and discussed by, among others, Benhabib, Schmitt-Grohe, and Uribe (2001), Braun and Waki (2010), and Aruoba and Schorfheide (2013). These pathologies seem to afflict the New Keynesian model in particular and are not a general feature of all models with occasionally binding constraints. 6. Conclusion Wepresentedasimplepiecewiselinearsolutionmethodthatallowsonetosolvemodelswithoccasionally binding constraints easily. This solution method has three principal advantages: 1) It is applicable to 14For this model, there are threeintertemporal errors associated with equations (22),(23), and (24),respectively. The errorsfor(23)and(24)havemagnitudeandpatternssimilartothoseoftheEulerequationerrors,asisshowninAppendix B available online. 24

models with a large number of state variables; 2) It is a general-purposealgorithm whosedeployment is standardized across models and requires only modest additional programming; 3) The computational burden is small, resulting in a short solution time. As documented, the deterioration in the solution quality from the adoption of the piecewise linear algorithm may vary model by model. For instance, the piecewise linear algorithm may be ill-suited if precautionary considerations are a crucial element of the model to be solved. We considered two different workhorse models to showcase the applicability of the piecewise linear solution. In the RBC model with a constraint on the mobility of capital, the deterioration in the solution quality from disregarding precautionary motives turned out to be negligible. Precautionary motives at the zero lower bound on nominal interest rates caused the piecewise linear solution to slightly underpredict the frequency at which the lower bound is attained. For simple models for which more accurate solution methods are viable, the piecewise linear algorithm can provide an initial guess and a useful “sanity check.” The deployment costs of our algorithm are minimal, since it can be implemented generally once and for all. We demonstrated a general implementation in the accompanying library of routines. In our experience, we have found general-purpose algorithms especially useful at the experimentation phase of research, when the model of interest can undergo radical changes requiring, otherwise, costly dedicated programming. For larger models, the inclusion of empirically-realistic features into a model can quickly strain the performance and applicability of other solution methods that handle occasionally binding constraints. Under those circumstances, our algorithm provides an alternative to swallowing unpalatable simplifications to the model of interest. References Abel, A. B. and J. C. Eberly (1999). The effects of irreversibility and uncertainty on capital accumulation. Journal of Monetary Economics 44, 339–377. [38] Adjemian, S., H. Bastani, F. Karam, M. Juillard, J. Maih, F. Mihoubi, G. Perendia, M. Ratto, and S.Villemot(2011).Dynare: Referencemanualversion4.DynareWorkingPapers1,CEPREMAP. [2] Adjemian, S. and M. Juillard (2011). Accuracy of the extended path simulation method in a new 25

keynesian model with zero lower bound on the nominal interest rate. Unpublished manuscript. [11] Aruoba, S. B., J. Fernandez-Villaverde, and J. F. Rubio-Ramirez (2006). Comparing solution methods for dynamic equilibrium economies. Journal of Economic Dynamics and Control 30(12), 2477–2508. [16] Aruoba, S. B. and F. Schorfheide (2013, July). Macroeconomic dynamics near the zlb: A tale of two equilibria. NBER Working Papers 19248, National Bureau of Economic Research, Inc. [24] Benhabib,J.,S.Schmitt-Grohe, andM.Uribe(2001). Theperilsoftaylor rules.Journal of Economic Theory 96(1-2), 40–69. [24] Blanchard, J. O. and S. Fischer (1989). Lectures on Macroeconomics. Boston, Massachusetts: MIT Press. [9] Blanchard, O. and C. Kahn (1980). The solution of linear difference models under rational expectations. Econometrica 48(5), 1305. [4] Bodenstein, M., L. Guerrieri, and C. Erceg (2009). The effects of foreign shocks when interest rates are at zero. International Finance Discussion Paper Series 983, Federal Reserve Board. [11] Bodenstein, M., L. Guerrieri, and C.Gust (2013). Oil shocks and thezero boundon nominal interest rates. Journal of International Money and Finance 32, 941–967. [11] Braun, A. and Y. Waki (2010). On the size of the fiscal multiplier when the nominal interest rate is zero. Mimeo, Federal Reserve Bank of Atlanta. [23, 24] Chen, H., V. Cu´rdia, and A. Ferrero (2012). The macroeconomic effects of large-scale asset purchase programmes. Economic Journal 122(564), F289–F315. [7] Christiano, L., M. Eichenbaum, and S. Rebelo (2011). When is the government spending multiplier large? Journal of Political Economy 119(1), 78 – 121. [2, 21] Christiano,L.J.andJ.D.M.Fisher(2000).Algorithmsforsolvingdynamicmodelswithoccasionally binding constraints. Journal of Economic Dynamics and Control 24(8), 1179–1232. [2, 3, 17, 38] Deaton, A. (1992). Understanding consumption. Oxford University Press. [40] den Haan, W. J., K. L. Judd, and M. Juillard (2011). Computational suite of models with heterogenous agents ii: Multi-country real business cycle models. Journal of Economic Dynamics and Control 35, 175–177. [10] den Haan, W. J. and A. Marcet (1990). Solving the stochastic growth model by parameterizing expectations. Journal of Business & Economic Statistics 8(1), 31–34. [38] Eggertsson, G. B. and M. Woodford (2003). The zero bound on interest rates and optimal monetary policy. Brookings Papers on Economic Activity 34(1), 139–235. [2, 11] Fair,R.C.andJ.B.Taylor(1983).Solutionandmaximumlikelihoodestimationofdynamicnonlinear rational expectations models. Econometrica 51(4), 1169–85. [11] 26

Ferna´ndez-Villaverde, J., G. Gordon, P. A. Guerr´on-Quintana, and J. Rubio-Ram´ırez (2012, May). Nonlinear adventures at the zero lower bound. NBER Working Papers 18058, National Bureau of Economic Research, Inc. [18, 21, 39] Gal´ı, J. (2008). Monetary Policy, Inflation, and the Business Cycle: An Introduction to the New Keynesian Framework. Princeton, NJ: Princeton University Press. [18] Holden, T. and M. Paetz (2012). Efficient simulation of dsge models with inequality constraints. Working paper, University of Surrey. [11] Judd, K. L. (1992). Projection methods for solving aggregate growth models. Journal of Economic Theory 58, 410–452. [3, 16] Judd, K. L. (1998). Numerical Methods in Economics. Cambridge, MA: MIT Press. [37] Judd, K. L., L. Maliar, and S. Maliar (2012). Merging simulation and projection approaches to solve high-dimensional problems. Technical report. NBER working paper No. 18501. [10, 12] Jung, T., Y. Teranishi, and T. Watanabe (2005). Optimal monetary policy at the zero-interest-rate bound. Journal of Money, Credit and Banking 37(5), 813–35. [2, 11] Kim, S. H., R. Kollmann, and J. Kim (2010). Solving the incomplete market model with aggregate uncertainty using a perturbation method. Journal of Economic Dynamics and Control 34(1), 50–58. [12] Las´een, S. and L. E. O. Svensson (2009). Anticipated alternative instrument-rate paths in policy simulations. Technical report, National Bureau of Economic Research, Inc. NBER working paper No. 14902. [11] Ljungqvist, L. and T. J. Sargent (2004). Recursive Macroeconomic Theory, 2nd Edition. Cambridge, MA: MIT Press. [17, 37] McGrattan, E. R.(1996). Solving the stochastic growth modelwith a finiteelement method.Journal of Economic Dynamics and Control 20(1-3), 19–42. [12] Nakata, T. (2013). Uncertainty at the zero lower bound. Finance and Economics Discussion Papers 2013-09, Board of Governors of the Federal Reserve System (U.S.). [23] Preston, B. and M. Roca (2007). Incomplete markets, heterogeneity and macroeconomic dynamics. Technical report. [12] Santos, M.S.andA.Peralta-Alva (2005, November). Accuracy of simulations forstochastic dynamic models. Econometrica 73(6), 1939–1976. [15] Schmitt-Grohe, S. and M. Uribe (2007). Optimal inflation stabilization in a medium-scale macroeconomic model. In K. Schmidt-Hebbel and R. Mishkin (Eds.), Monetary Policy Under Inflation Targeting, pp. 125–186. Santiago, Chile. [23] Smets, F. and R. Wouters (2007). Shocks and frictions in us business cycles: A bayesian dsge approach. American Economic Review 97(3), 586–606. [3] 27

Tauchen, G. (1986). Finite state markov-chain approximation to univariate and vector autoregressions. Economics Letters, 177–181. [37, 38, 39] Taylor, J. B. and H. Uhlig (1990). Solving nonlinear stochastic growth models: A comparison of alternative solution methods. Journal of Business & Economic Statistics 8(1), 1–17. [3, 13] Uhlig, H. (1995). A toolkit for analyzing nonlinear dynamic stochastic models easily. In Computational Methods for the Study of Dynamic Economies, pp. 30–61. Oxford University Press. [2] Yun, T. (2005). Optimal monetary policy with relative price distortions. American Economic Review 95(1), 89–109. [20] Zeldes, S. P. (1989). Consumption and liquidity constraints: An empirical investigation. Journal of Political Economy 97(2), 305–46. [40] 28

Table 1: Baseline Calibration of RBC Model with a Constraint on Investment Parameter Value Parameter Value β, Discount Factor 0.96 γ, Relative Risk Aversion 2 δ, Depreciation Rate 0.10 α, Capital Share 0.33 ρ, Persistence of Tech. Shock 0.90 σ, St. Dev. of Tech. Innovation 0.013 φ, Threshold for Investment Constraint 0.975 Table 2: A Comparison of Key Moments: RBC Model with a Constraint on Investment Log Investment Solution Method Mean St. dev. Skewness Nonlinear -1.015 6.2% 1.18 Piecewise Linear -1.015 6.3% 1.33 First-Order Perturbation -1.045 9.7% 0.00 Log Consumption Solution Method Mean St. dev. Skewness Nonlinear 1.152 4.7% -0.22 Piecewise Linear 1.152 4.7% -0.23 First-Order Perturbation 1.149 4.5% 0.03 Correlation between Log Investment and Log Consumption Solution Method Correlation Nonlinear 0.81 Piecewise Linear 0.80 First-Order Perturbation 0.89 Frequency of Hitting the Constraint (%) Solution Method Nonlinear 41 Piecewise Linear 41 First-Order Perturbation 0 29

Table 3: Baseline Calibration of New Keynesian Model Subject to the Zero Lower Bound Parameter Value Parameter Value β, Discount Factor 0.994 ε, Elasticity of Substitution Across Goods 6 θ, Calvo Parameter 0.90 g, Steady-State Ratio of G/Y 0.20 φ , Response to Output, Mon. Pol. Rule 0.25 Π, Steady State Inflation 1.005 y φ , Response to Inflation, Mon. Pol. Rule 2.5 φ, Labor Supply Elasticity 1 π ρ, Persistence of Discount Rate Shock 0.80 σ, St. Dev. of Discount Rate Shock 0.005 Table 4: A Comparison of Key Moments: New Keynesian Model Subject to the Zero Lower Bound Piecewise Linear Nonlinear Linear Frequency of Hitting ZLB 4.2% 7.13% Means Interest Rate (AR) 4.43% 4.16% 4.39% Inflation (AR) 1.99% 1.77% 1.99% Log Output 0.0125 0.0144 0.0126 Shock Innovation 0.00% 0.00% 0.00% Standard Deviations Interest Rate (AR) 2.44% 2.51% 2.52% Inflation (AR) 0.45% 0.52% 0.45% Log Output 1.44% 1.54% 1.41% Log Price Dispersion 0.33% 0.31% 0.32% Skewness Log Output -0.22 -0.49 -0.04 Interest Rate 0.16 0.17 -0.02 Moments, conditional on ZLB Mean Inflation (AR) 1.03% 0.69% Mean Log Output -0.0206 -0.0189 Mean, shock innovation 1.15% 0.99% St.dev., Inflation (AR) 0.19% 0.29% St.dev. Log Output 0.85% 1.05% Note: “AR” stands for “Annualized Rate.” 30

Figure 1: Comparing the Piecewise Linear Solution and a “Naive” Piecewise Approach for a Simple Asset Pricing Model. Policy Function for Interest Rate − Level 3.5 3 2.5 2 1.5 1 0.5 0 −0.5 −1 −1.5 −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2 tnecreP Piecewise Linear Linear Naive Piecewise Linear Nonlinear Policy Function for Asset Price − Percent Dev. from Steady State 70 60 50 40 30 20 10 0 −10 −20 −30 −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2 tnecreP Slope of Policy Function for Asset Price for the Piecewise Linear Solution 2.5 2 1.5 1 0.5 −0.2 0 0.2 Shock Note: The values on the abscissae denote shock sizes (for q t−1 = 0). The “Naive” solution is obtained by splicing two linearized decision rules obtained under the assumption that each regime applies indefinitely. 31

Figure 2: Policy Function for Investment, RBC Model with Constraint on Investment. 4 3 2 1 0 −1 −2 −3 −3 −2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5 Technology, % from ss ss morf % ,tnemtsevnI Investment function I(K,A), nonlinear solution, for different initial values of K K = 1.1 K SS K = K SS K = 0.975 K SS φ−1 4 3 2 1 0 −1 −2 −3 −3 −2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5 Technology, % from ss ss morf % ,tnemtsevnI Investment function, nonlinear vs piecewise solution Nonlinear (K=K ) SS Piecewise (OccBin) φ−1 32

Figure 3: RBC Model with Constraint on Investment: An Unexpected Decrease in Technology (left column) and an Unexpected Increase in Technology (right column) 0 −2 −4 −6 −8 −10 10 20 30 40 50 etats ydaets morf .ved tnecreP A 4% Decrease in Technology: A 4% Increase in Technology: Investment Investment 10 8 6 Piecewise Linear Full nonlinear 4 Linear 2 0 10 20 30 40 50 etats ydaets morf .ved tnecreP Consumption 0 −1 −2 −3 −4 −5 10 20 30 40 50 etats ydaets morf .ved tnecreP Consumption 5 4 3 2 1 0 10 20 30 40 50 etats ydaets morf .ved tnecreP Capital 0 −1 −2 −3 −4 10 20 30 40 50 etats ydaets morf .ved tnecreP Capital 4 3 2 1 0 10 20 30 40 50 etats ydaets morf .ved tnecreP Note: Units on the abscissae denote years. The left-hand-side column shows responses to shock that pushes technology down by4% (apositiveinnovation totheshockprocess equaltoapproximately 3 standarddeviations). Theright-handside column shows responses to a shock that pushestechnology up by 4%.). 33

Figure 4: RBC Model with Constraint on Investment: Comparison of Euler Equation Residuals Across Solution Methods (residuals expressed as a percent of consumption) −6 −8 −10 −12 −14 −16 −5 0 5 10 15 Capital, Percent Deviation from Non−Stochastic Steady State elacS 01 goL −2.5 −3 −3.5 −4 −4.5 −5 −5.5 −5 0 5 10 15 RBC Model with Investment Constraint, Consumption Euler Errors of Full Nonlinear Solution elacS 01 goL RBC Model with Investment Constraint, Consumption Euler Errors of Piecewise Linear Solution Median Technology Low Technology High Technology RBC Model without Investment Constraint, Consumption Euler Errors of Linear Solution −2.5 −3 −3.5 −4 −4.5 −5 −5.5 −5 0 5 10 15 elacS 01 goL Note: “Median technology” corresponds to A t = 1. “Low technology” corresponds to A t = 0.96. “High technology” corresponds to A t =1.04. An open circle indicates that theinvestment constraint is binding. 34

Figure 5: New Keynesian Model Subject to the Zero Lower Bound: An Unexpected Increase in the Discount Factor (left column) and Unexpected Decrease in the Discount Factor (right column) 2 0 −2 2 4 6 8 10 tnecreP ,leveL An Increase in the Discount Factor: A Decrease in the Discount Factor: Interest Rate, (annualized) Interest Rate, (annualized) 12 10 8 Piecewise Linear Nonlinear Linear 6 2 4 6 8 10 tnecreP ,leveL Dispersion, v 1.015 1.01 1.005 2 4 6 8 10 leveL Dispersion, v 1.015 1.01 1.005 2 4 6 8 10 leveL Inflation, (annualized) 0 −0.5 −1 −1.5 −2 2 4 6 8 10 etats ydaets morf .ved .tp .creP Inflation, (annualized) 2 1.5 1 0.5 0 2 4 6 8 10 etats ydaets morf .ved .tp .creP Output 0 −2 −4 −6 2 4 6 8 10 etats ydaets morf .ved tnecreP Output 6 4 2 0 2 4 6 8 10 etats ydaets morf .ved tnecreP Note:Unitsontheabscissaedenotequarters. Theleft-hand-sidecolumnshowsresponsestoashockthatoccursinperiod 6andbringsβupto1.019(apositiveinnovationtotheshockprocessequalto4standarddeviations). Theright-hand-side column shows responses to a shock that brings β down to 0.969 (a negative innovation to the shock process equal to 4 standard deviations). 35

Figure 6: New Keynesian Model Subject to the Zero Lower Bound: Comparison of Euler Equation Residuals Across Solution Methods (residuals expressed as a percent of consumption) Model with ZLB, Consumption Euler Error of Piecewise Linear Solution (consumption share) −2 −2.5 −3 −3.5 −4 1 1.005 1.01 1.015 1.02 1.025 1.03 1.035 1.04 elacs 01 goL Model without ZLB, Consumption Euler Error of Linear Solution (consumption share) −2 −2.5 −3 −3.5 −4 1 1.005 1.01 1.015 1.02 1.025 1.03 1.035 1.04 elacs 01 goL Low Beta Median Beta High Beta Model with ZLB, Consumption Euler Error of Full Nonlinear Solution (consumption share) −4 −5 −6 −7 −8 −9 −10 1 1.005 1.01 1.015 1.02 1.025 1.03 1.035 1.04 elacs 01 goL Price Dispersion (v), Level t Note: “Median Beta” corresponds to β = 0.994. “Low Beta” corresponds to β = 0.965. “High Beta” corresponds to t t β =1.023. An open circle indicates that thezero lower bound on thenominal interest rate is binding. t 36

Appendix For Online Publication A. RBC model with a Constraint on Investment: Nonlinear Solution and Robustness Analysis We use two alternative approaches to finding a full nonlinear solution, dynamic programming and projection methods. We verified that the differences in the two approaches are negligible relative to the differences highlighted with the piecewise linear solution.15 We present details of both algorithms before covering robustness analysis relative to alternative parametric assumptions. Dynamic Programming Solution. The capital stock K is the only state variable in the model. t We seek a rule that will map the current state variable K t−1 and the realization of the stochastic process A into a choice of K . We discretize and put boundaries on the support of the decision rule t t that we seek. We consider a uniformly spaced set of points for K t−1 and K t . We discretize the support of both K t−1 and A t . The lower boundary for K t−1 is 5 percent below the non-stochastic steady state for capital. The upper boundary is 40 percent above the non-stochastic steady state for capital. We experimented with different grids with little change in the results. We constrain A to lie within three standard deviations of its process, i.e. |lnA | ≤ 3 σ2 ,. We follow Tauchen (1986) in computing t 1−ρ2 a finite state Markov-chain approximation for lnAq. The finest discretization we considered involved t 75,000 points for capital and 201 points for the stochastic process. Use of shape-preserving splines, allowed us to reduce the number of points in the grid for capital without compromising the quality of the solution. The dynamic programming algorithm that we use follows closely Chapter 12 of Judd (1998) and Chapter 3 of Ljungqvist and Sargent (2004). The initial choice for the decision rule in the dynamic program is taken to bethe linear approximation to thedecision ruleobtained by standardmethods. To accelerate the convergence of the dynamic programming algorithm, we use the Howard improvement algorithm. Projection Solution. We restate the optimization problem in the model in Lagrangian form as: ∞ 1−γ C −1 max E0 βt t {Ct,Kt+1,µ t ,λt}∞ t=0 t=0 1−γ X + βtµ t −C t −K t +(1−δ)K t−1+A t K t α −1 + βtλ t ((cid:0)−K t +(1−δ)K t−1−φI) (cid:1) From standard manipulation of the first-order conditions for the Lagrangian problem, one obtains: C t −γ −λ t −E t βC t − + γ 1 (1−δ)+αA t+1K t α−1 −β(1−δ)λ t+1 = 0 (A.1) h i (cid:0) (cid:1) 15For instance, the compensating variation for the use of thedynamic programming solution relative to the projection solution is in the order of $1 in $100,000,000 for thebaseline calibration for the coarsest grid used. 37

−γ We seek a solution in the form of a function g(K t−1,A t ) that approximates C t −λ t subject to the complementary slackness condition, λ t (−K t +(1−δ)K t−1−φI) = 0following the method of parameterized expectations described by den Haan and Marcet (1990) and Christiano and Fisher (2000). We approximate g(K t−1,A t ) with a Chebyshev polynomial of order 6 and approximate the process for lnA with a Markov process, following Tauchen (1986). A Markov process with 10 states usually provides an adequate approximation to the underlying process. In an abundance of caution, we use 51 states. We constrain lnA to lie within three standard deviations of its process, i.e. |lnA | ≤ 3 σ2 . t 1−ρ2 We solve for the parameters of the Chebyshev polynomial function using orthogonqal collocation. Given K t and A t , we guess λ t = 0. Consistent with that guess, C t = g(K t−1,A t )−γ and we can back out K t from the resource constraint. We then check whether K t −(1−δ)K t−1 ≥ φI. If so, the original guess for λ was correct. If not, for the complementary slackness condition to hold, it must be that t −γ K t = (1−δ)K t−1+φI. C t is then given by the resource constraint and λ t = g(K t−1,A t )−C t . Robustness Analysis. Table A reports the subsidy (as a percent of steady-state consumption) that would compensate the agent for the use of the piecewise linear algorithm over a fully nonlinear method with initial conditions set at the non-stochastic steady state. The welfare cost of using our piecewise solution method is a non-monotonic function of risk aversion; it is “high” when risk aversion is around 1, “low” when risk aversion is at 2, and increasing with risk aversion for values of γ around 3 or higher. Thishappensbecause–underthefullnonlinearsolution–theirreversibilityconstrainthastwoopposing effects on the equilibrium average level of capital. The first effect – an illiquid capital effect – works to reduce average capital: when capital is irreversible, it is less useful in smoothing consumption when technology is low. The second effect – a precautionary capital effect – works to increase average capital through a precautionary saving effect: as capital is irreversible, consumption is more volatile, and more capital is held even if it is less useful in bad states of the world. These two opposing effects – captured by the fully nonlinear solution but not by the piecewise linear method – explain the non-monotonicity. Underthebaselinecalibration (γ = 2), theilliquidcapital andprecautionary capital effectalmost offset each other, and the stochastic fixed point for capital16 happens to be close to its non-stochastic steady state, which does not dependon uncertainty and irreversibility. Theprecautionary effect dominates for higher values of γ, whereas the illiquidity effect dominates for low risk aversion.17 These differences in the demand for capital under different parameterizations of the model influence the performance of the piecewise linear solution method. In particular, for high levels of risk aversion, the linear component of the solution cannot capture the increase in demand for capital stemming from precautionary motives, and the performance of the solution algorithm deteriorates, with a the welfare cost of $1 in about $100,000 when γ = 5. Similarly, the linear component of the piecewise linear solution is not able to capture the drop in capital demand when risk aversion is low, and the performance of the piecewise linear solution also deteriorates. Table A also considers sensitivity with respect to the choice of the value for the discount factor β. 16The stochastic fixed point for capital is thelevel attained by capital with all innovations totechnology set to 0, 17In a partial equilibrium setting, Abel and Eberly (1999) also find that the introduction of capital irreversibility has an ambiguous effect on the long-run level of the capital stock. 38

The welfare cost of using the piecewise method increases as the discount factor rises. We conjecture that in the plain vanilla RBC model the nonlinearities become more pronounced as the risk free rate becomes lower, thus penalizing linearization in general over a fully nonlinear solution algorithm. B. New Keynesian Model Subject to the Zero Lower Bound: Nonlinear Solution and Robustness Analysis The necessary conditions for an equilibrium are: 1 C = (A.2) t β E Rt t t Ct+1 Π t+1 mc = w (cid:16) (cid:17) (A.3) t t w = ψLϑC (A.4) t t t εx1t = (ε−1)x2t (A.5) 1 x1t = C mc t Y t +θE t β t Πǫ t+1 x1t+1 (A.6) t Y Πε−1 x2t = Π∗ t C t +θβ t E t Π t ∗ +1 x2t+1 (A.7) t t+1 ! φ φ Π p Y y t t Z = R (A.8) t Π Y " # (cid:18) (cid:19) (cid:18) (cid:19) R = max(Z ,1) (A.9) t t G = s Y (A.10) t g t 1 = θΠε−1 +(1−θ)(Π∗) 1−ε (A.11) t t v t = θΠε t v t−1+(1−θ)(Π∗ t )−ε (A.12) Y = C +G (A.13) t t t L t Y = (A.14) t v t lnβ = (1−ρ)logβ+ρlogβ +σǫ . (A.15) t t−1 t Given the balanced budget, B = 0. The model variables in the system above are C, R, Π, Π∗, mc, t w,L,x1,x2,Z,G,Y,v,andβ.Weseekasolutionintheformofthreefunctionsg1(v t−1,β t ),g2(v t−1,β t ) and g3(v t−1,β t ) that approximate, respectively Ctβ 1 t Rt , (cid:16) x1t− C θ 1 β t t mctYt (cid:17) and (cid:18) x Π 2 ∗ t t θβ − t C Yt t(cid:19) subject to R t = max(Z t ,1). We approximate g1, g2, and g3 with Chebyshev polynomials of order 6 and approximate the process for β with a Markov process, following Tauchen (1986) and using 51 states. We constrain t lnβ −lnβ to lie within 3.5 standard deviations of its process. We also constrain v to lie in the interval t t bounded by 1 and 1.04. We solve for the parameters of the Chebyshev polynomial functions using orthogonal collocation. Given these choices, we follow the same guess-and-verify approach described in the appendix of Ferna´ndez-Villaverde et al. (2012). Figure A shows the absolute values of the residuals for the three intertemporal equations, equations (A.2), (A.6), and (A.7). The residuals were normalized respectively by C t , x1t , and x2t . The maximum 39

residual is in the order of 10−5. Figure B shows the residuals for the intertemporal equations for the piecewise linear solution and for a linear solution that disregards the zero lower bound. The residuals for the piecewise linear solution for the model with the ZLB enforced stay close to the residuals for the linear solution for a model that disregards the ZLB. Finally, Table B provides some robustness analysis relative to alternative parametric assumptions. C. A Further Example: A Model of Consumption Choice with a Borrowing Constraint To showcase applicability of our toolbox to a wide array of problems, we provide one further example. Occasionally binding borrowing constraints arise in a wide variety of models where households can “self-insure” by holding and managing an asset, up to some borrowing limit, that can be used to buffer consumption against adverse shocks. In these models, one can distinguish situations when a household is not constrained in the current period, and the traditional Euler equation for consumption holds; and situations when the household is credit constrained, current consumption is too low relative to next period, and the Euler equation for consumption does not hold. This behavioral asymmetry introduced by borrowing constraints, made popular by Zeldes (1989) and Deaton (1992), can be studied using our solution method. Model Overview. A consumer maximizes ∞ 1−γ C −1 maxE0 βt t 1−γ t=0 X subject to the budget constraint, and to an (occasionally binding) constraint stating that borrowing B cannot exceed a fraction m of income Y : t t C t +RB t−1 = Y t +B t , (A.16) B ≤ mY . (A.17) t t Above, R denotes the gross interest rate. The discount factor β is assumed to satisfy the restriction that βR < 1, so that in the deterministic steady state the borrowing constraint is binding. Given initial conditions, the impatient household prefers a consumption path that is falling over time, and attains this path by borrowingtoday. If income is constant, thehousehold will eventually beborrowing constrained and will roll its debt over forever, and consumption will settle at a level given by income less the steady state debt service. The log of income follows an AR(1) stochastic process of the form lnY t = ρlnY t−1+σǫ t (A.18) where ǫ is an exogenous innovation distributed as standard normal, and σ its standard deviation. t Denoting withλ theLagrangemultiplier ontheborrowingconstraint given byequation (A.17), the t set of equations describingthe system of necessary conditions for an equilibrium is given by a system of 40

four equations in the four unknowns {C ,B ,λ ,Y } which includes equation (A.16), equation (A.18), t t t t together with the consumption Euler equation and the Kuhn-Tucker conditions, given respectively by −γ −γ C = βRE C +λ (A.19) t t t+1 t (cid:16) (cid:17) λ (B −mY ) =0. (A.20) t t t The transitional dynamics of this model will depend in an important way on the gap between the discount rate and the interest rate, which can be measured as g = 1/β −R. In our setup, when the gap is small, the economy can be characterized as switching between two regimes. In the first regime, more likely to apply when income and assets are relatively low, the borrowing constraint binds. Then, borrowingmoves inlockstep withincome, andconsumptionis morevolatile than income. Inthesecond regime, more likely to apply when income and assets are relatively high, the borrowing constraint is slack, and current consumption can be high relative to future consumption even if borrowing is below the maximum amount allowed. We focus our attention on this case, since it presents an asymmetry that can be studied using our solution method.18 In the reference regime, the borrowing constraint binds, and the multiplier is greater than zero. In the alternative regime, the borrowing constraint is slack, and the multiplier is zero. Mapping these conditions into the notation used in Section 2, (M1) and (M2) differ because of one equation. The optimization problem implies that B = mY when the borrowing constraint binds. Conversely, when t t the constraint is slack, the complementary slackness condition implies that B ≤ mY and λ = 0. The t t t conditions in (M1) encompass B = mY , and the function g captures λ > 0. The conditions in (M2) t t t encompass λ = 0, and the function h captures B ≤ mY . t t t Calibration and Policy Functions. Table C summarizes the baseline calibration, which reflects a yearly frequency. We set γ = 1, so that utility is logarithmic in consumption. We set the maximum borrowingatoneyearofincome,sothatm = 1. Fortheincomeprocess,wesetρ= 0.90andσ = 0.0131, so that the standard deviation of lnY is 3 percent. Finally, we set R = 1.05 and β = 0.945. Under this calibration, the borrowing constraint, which binds in the reference regime, is slack about 30 percent of the time using the full nonlinear solution. We use dynamic programming to characterize a high-quality fully-nonlinear solution. We display the policy functions in terms of the optimal consumption chosen by the agent as a function of income and debt, the two state variables of the problem. The top panel of Figure C shows that for lowerthan-average realizations of income (and high initial debt) the agent hits the borrowing constraint, the consumption function is relatively steep, and consumption is very sensitive to changes in income. For higher-than-average income, consumption is sufficiently high today relative to the future that it pays off to save for the future: the borrowing constraint becomes temporarily slack, and consumption 18Depending on the calibration, other types of solutions may arise. If the discount rate is high and the gap g is large, theborrowingconstraintmaybindalways. Moreover,ifthevarianceoftheincomeprocessissufficientlyhighandthegap approaches zero, consumption may not converge to any finite limit. Even when consumption converges, the stochastic steady statemaybedrastically differentfrom thedeterministic onebecause thehousehold can accumulateenough assets so that theborrowing constraint is nevera concern. Ourcalibration rules these possibilities out. 41

becomes less sensitive to changes in income. The bottom panel compares the policy function obtained via dynamic programming with that obtained using our piecewise approach. The two policy functions are very similar. The only slightly difference is that – for given level of initial debt – the anticipation of future shocks leads the agent to save more (consume less) at all income levels. Assessing Performance: Impulse Responses, Moments and Welfare. Figure D shows the responses to two shocks, starting from a nonstochastic steady state where income is one and the ratio of debt to income is m = 1, the maximum limit. The first shock, in period 2, brings up income by 3 percent (a 2 standard deviations shock). The second shock, in period 21, pushes down income by 3 percent. The solid and dashed lines denote the piecewise linear solution and the dynamic programming solution respectively. The dash-dotted lines denote the first-order perturbation solution, which incorrectly assumes that the borrowing constraint always binds. As the figure shows, the piecewise linear algorithm well captures the asymmetric responses of consumption, debt, and debt-to-income ratio following income shocks. A positive income shock makes the borrowing constraint slack; borrowing rises less than income, and consumption rises less than it would were the constraint binding in all states of the world. Conversely, when income drops, the borrowing constraint binds, borrowing falls in proportion with income, and consumption reacts more than under a positive shock. Table D shows that the moments computed from the piecewise linear and the nonlinear solution method are again strikingly close. The OccBin can capture first, second, and third moments of the distribution of consumption. In particular, it captures the skewness in consumption derived from the occasionally bindingconstraint,whichismissedbythefirst-orderperturbationmethod.19 Furthermore, the piecewise linear method comes close to replicating the frequency with which the constraint binds. Under the piecewise linear solution, the borrowing constraint binds 84 percent of the time. Under the fully nonlinear solution, the constraint binds slightly less frequently, 73 times out of 100 periods. The difference reflects the precautionary behavior induced by the anticipation of future shocks which implies higher average saving under the full nonlinear solution. The differences between the piecewise linear and the full nonlinear solution for this model again highlightaspectsoftheeconomicproblemthatthepiecewisemethodcannotcapture. Forthisparticular model,higherincomeuncertainty,reducedattitudestowardborrowing(causedbyhigherdiscountfactor or higher risk aversion), and a looser borrowing limit can magnify the differences between the piecewise solution and the global solution. However, in all these cases the piecewise linear solution still performs uniformly better than the solution where the borrowing constraint is assumed to be always binding. Relative to the full nonlinear solution, the utility cost of using the piecewise linear method is positive, but small as shown in Table E. For the baseline calibration, the household suffers a utility cost of $1 every $150,000 of consumption. The cost would be five times larger using a policy function basedonfirst–orderperturbation,assumingthattheconstraintisalways binding. Inother experiments reported, we find that the utility cost becomes slightly larger with a higher maximum debt-to-income ratio; with higher risk aversion; with higher uncertainty; and with lower impatience. In all these 19The linearized model exhibits some small amount of skewness in consumption simply because we write the model in linearized form, butthe income shocks are log-linear. 42

cases, precautionary considerations become somewhat more important, and ignoring them magnifies the differences between the piecewise method and global nonlinear solution. However, even in these cases the improvements afforded by the piecewise method are substantial: compared to the global solution, the welfare cost of using the piecewise method is between five and six times smaller than the cost of using the linearized solution. 43

Table A: Utility Cost of the Solution Method: RBC Model with Constraint on Investment. Model Solution Method Solution Method Piecewise linear $ 1 every Constant capital $ 1 every γ =2,β = 0.96 (Baseline) 0.000007% $ 14,556,184 0.04% $ 2,842 γ =1 0.000036% $ 2,793,317 0.02% $ 4,653 γ =3 0.000113% $ 881,804 0.05% $ 1,980 γ =4 0.000413% $ 242,411 0.07% $ 1,481 γ =5 0.000958% $ 104,424 0.09% $ 1,157 β = 0.98 0.000028% $ 3,557,192 0.05% $ 1,938 β = 0.94 0.000003% $ 29,844,218 0.03% $ 3,838 γ = 2, φ = 0 0.000014% $7,194,352 0.05% $ 2,041 Note: The “Piecewise Linear” column indicates the subsidy rate (as a percent of steady-state consumption) that would compensate an agent for the use of the piecewise linear algorithm over a fully nonlinear method with initial conditions set at the non-stochastic steady state. The “Constant Capital” column indicates the subsidy when the agent uses a suboptimal decision rule setting thecapital stock to its previousvalue. Table B: Robustness Analysis of Model with ZLB Solution Method Piecewise linear Nonlinear % at ZLB log output % at ZLB log output Model St.dev. Skewness St.dev. Skewness Baseline 4.2 1.44% -0.22 7.13 1.54% -0.49 π = 1, β = 0.9891 6.7 1.35% -0.38 9.35 1.51% -0.76 φ = 5, φ = 0 6.7 0.86% -0.66 9.35 0.94% -1.20 π y φ = 10 2.91 1.69% -0.13 4.41 1.72% -0.14 π 44

Table C: Baseline Calibration of Model with Borrowing Constraint Parameter Value Parameter Value β, Discount Factor 0.945 γ, Relative Risk Aversion 1 R, Interest Rate 1.05 m, Borrowing Limit 1 ρ, Persistence of Income Shock 0.90 σ, St. Dev. Income Shock 0.0131 Table D: A Comparison of Key Moments: Model with Borrowing Constraint. Log Consumption Solution Method Mean St. dev. Skewness Nonlinear -0.0512 3.40% -0.24 Piecewise Linear -0.0513 3.46% -0.22 First-Order Perturbation -0.0516 3.60% -0.04 Log Income Mean St. dev. Skewness Nonlinear 0.0000 3% 0.00 Piecewise Linear 0.0000 3% 0.00 First-Order Perturbation 0.0000 3% 0.00 Correlations lnY,lnC lnY,lnB Nonlinear 0.96 0.96 Piecewise Linear 0.95 0.98 First-Order Perturbation 0.92 1 Frequency of Hitting the Borrowing Constraint (%) Nonlinear 73 Piecewise Linear 84 First-order Perturbation 100 Table E: Utility Cost of the Solution Method: Model with Borrowing Constraint. Model Solution Method Solution Method Piecewise linear $ 1 every First-order Perturbation $ 1 every (Always Constrained) Baseline 0.0007% $ 149,280 0.0033% $ 30,731 High debt limit, m = 2 0.0013% $ 77,444 0.0071% $ 14,082 High risk aversion, γ = 2 0.0023% $ 44,140 0.0131% $ 7,657 High uncertainty, σ = 0.0196 0.0024% $ 41,233 0.0116% $ 8,650 Low impatience, β = 0.948 0.001% $ 102,989 0.0056% $ 17,812 45

Figure A: New Keynesian Model Subject to the Zero Lower Bound: Intertemporal Errors of the Collocation Solution Fully Nonlinear Solution, Consumption Euler Error (consumption share) −4 −5 −6 −7 −8 −9 −10 1 1.005 1.01 1.015 1.02 1.025 1.03 1.035 1.04 elacS 01 goL Fully Nonlinear Solution, X1 Intertemporal Condition Error (X1 share) −5 −6 −7 −8 −9 −10 −11 1 1.005 1.01 1.015 1.02 1.025 1.03 1.035 1.04 elacS 01 goL −6 −7 −8 −9 −10 −11 1 1.005 1.01 1.015 1.02 1.025 1.03 1.035 1.04 elacS 01 goL Low Beta Median Beta High Beta Fully Nonlinear Solution, X2 Intertemporal Condition Error (X2 share) Level of Price Dispersion, v Note: “Median Beta” corresponds to β = 0.994. “Low Beta” corresponds to β = 0.965. “High Beta” corresponds to t t β =1.023. An open circle indicates that thezero lower bound on thenominal interest rate is binding. t 46

Figure B: New Keynesian Model: Intertemporal Errors for the Piecewise Linear Solution (with ZLB enforced) and for the Linear Solution (with ZLB disregarded) Model with ZLB Consumption Euler Error (consumption share) −2.5 −3 −3.5 −4 1 1.01 1.02 1.03 1.04 elacs 01 goL −2 −3 −4 −5 −6 −7 1 1.01 1.02 1.03 1.04 elacs 01 goL Model with ZLB X1 Intertemporal Condition Error (X1 share) −2 −3 −4 −5 −6 1 1.01 1.02 1.03 1.04 elacs 01 goL Model without ZLB Consumption Euler Error (consumption share) −2.5 −3 −3.5 −4 1 1.01 1.02 1.03 1.04 Model with ZLB X2 Intertemporal Condition Error (X2 share) Level of Price Dispersion, v elacs 01 goL −2 −3 −4 −5 −6 −7 1 1.01 1.02 1.03 1.04 elacs 01 goL Model without ZLB X1 Intertemporal Condition Error (X1 share) −2 −3 −4 −5 −6 1 1.01 1.02 1.03 1.04 elacs 01 goL Model without ZLB X2 Intertemporal Condition Error (X2 share) Level of Price Dispersion, v Low Beta Median Beta High Beta Note: “Median Beta” corresponds to β = 0.994. “Low Beta” corresponds to β = 0.965. “High Beta” corresponds to t t β =1.023. An open circle indicates that thezero lower bound on thenominal interest rate is binding. t 47

Figure C: Consumption Function, Model with Borrowing Constraint. 10 5 0 −5 −10 −15 −6 −4 −2 0 2 4 6 Income, % from ss ss morf % ,noitpmusnoC Consumption function C(B,Y), nonlinear solution, for different initial values of B B = 0.9 M B = 0.95 M B = M 10 5 0 −5 −10 −15 −6 −4 −2 0 2 4 6 Income, % from ss ss morf % ,noitpmusnoC Consumption function, nonlinear vs piecewise solution Piecewise Linear Nonlinear (B=M) 48

Figure D: Model with Borrowing Constraint: An Unexpected Increase in Income, Followed by a Decrease 10 5 0 −5 −10 0 10 20 30 40 etatS ydaetS morf noitaiveD % Consumption Borrowing 4 Full Nonlinear Piecewise Linear Linear 2 0 −2 −4 0 10 20 30 40 etatS ydaetS morf noitaiveD % Borrowing/Income 1.02 1 0.98 0.96 0.94 0 10 20 30 40 oitaR Income 4 2 0 −2 −4 0 10 20 30 40 etatS ydaetS morf noitaiveD % Units on the abscissae denote years. 49

Cite this document
APA
Luca Guerrieri and Matteo Iacoviello (2014). OccBin: A Toolkit for Solving Dynamic Models With Occasionally Binding Constraints Easily (FEDS 2014-47). Board of Governors of the Federal Reserve System, Finance and Economics Discussion Series. https://whenthefedspeaks.com/doc/feds_2014-47
BibTeX
@techreport{wtfs_feds_2014_47,
  author = {Luca Guerrieri and Matteo Iacoviello},
  title = {OccBin: A Toolkit for Solving Dynamic Models With Occasionally Binding Constraints Easily},
  type = {Finance and Economics Discussion Series},
  number = {2014-47},
  institution = {Board of Governors of the Federal Reserve System},
  year = {2014},
  url = {https://whenthefedspeaks.com/doc/feds_2014-47},
  abstract = {We describe how to adapt a first-order perturbation approach and apply it in a piecewise fashion to handle occasionally binding constraints in dynamic models. Our examples include a real business cycle model with a constraint on the level of investment and a New Keynesian model subject to the zero lower bound on nominal interest rates. We compare the piecewise linear perturbation solution with a high-quality numerical solution that can be taken to be virtually exact. The piecewise linear perturbation method can adequately capture key properties of the models we consider. A key advantage of this method is its applicability to models with a large number of state variables.},
}