Skip to main content
Log in

Accuracy, Speed and Robustness of Policy Function Iteration

  • Published:
Computational Economics Aims and scope Submit manuscript

Abstract

Policy function iteration methods for solving and analyzing dynamic stochastic general equilibrium models are powerful from a theoretical and computational perspective. Despite obvious theoretical appeal, significant startup costs and a reliance on grid-based methods have limited the use of policy function iteration as a solution algorithm. We reduce these costs by providing a user-friendly suite of MATLAB functions that introduce multi-core processing and Fortran via MATLAB’s executable function. Within the class of policy function iteration methods, we advocate using time iteration with linear interpolation. We examine a canonical real business cycle model and a new Keynesian model that features regime switching in policy parameters, Epstein–Zin preferences, and monetary policy that occasionally hits the zero-lower bound on the nominal interest rate to highlight the attractiveness of our methodology. We compare our advocated approach to other familiar iteration and approximation methods, highlighting the tradeoffs between accuracy, speed and robustness.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9

Similar content being viewed by others

Notes

  1. See Basu and Bundick (2012); Bi (2012); Bi et al. (2013); Davig and Leeper (2006); Chung et al. (2007); Davig and Leeper (2008); Davig et al. (2010, 2011); Kumhof and Ranciere (2010); Mertens and Ravn (2013); Basu and Bundick (2012); Gavin et al. (2013); Richter (2012).

  2. Richter and Throckmorton (2012) provide the Fortran and MATLAB source code, as well as the compiled 32- and 64-bit MEX functions, for each of the examples discussed in the paper.

  3. This is not true for all models. For example, if the model contains discrete variables, such as state dependent parameters, then the conditional linear solution may poorly approximate the global solution. In this case, one can obtain a linear solution for each realization of the parameter(s). A linear combination of those solutions typically provides a good initial conjecture for the state-dependent nonlinear model.

  4. Other methods include Uhlig’s (1997) toolkit and Klein’s (2000) algorithm.

  5. Alternatively, Chebyshev polynomials or cubic splines could be used for interpolation/extrapolation. We advocate for linear interpolation since it is faster and more stable, but we consider alternative methods in Sect. 4.

  6. We also provide code to solve the canonical RBC model with three conventional frictions—capital adjustment costs, variable utilization rates, and external habit persistence.

  7. By default, MEX only interprets fixed-format (f77) Fortran code. Since our fortran code is written in the free-format (f90), MATLAB batch files need to be modified. Navigate to the mexopts folder in the MATLAB directory (e.g., ...\MATLAB\R2010a\bin\win64\mexopts), and open the batch file corresponding to the installed version of Intel Visual Fortran (IVF) in a text editor. Delete the ‘/fixed’ flag and save the batch file. Then use mex -setup to select IVF as the compiler in MATLAB. MATLAB must be restarted anytime the batch file is changed.

  8. Solution times are not directly comparable across models because the speed of convergence may differ. For example, the NK model is larger in terms of the number of policy functions and the size of the state space, but the solution time is similar to the RBC model since the RBC model takes four times as many iterations to converge.

  9. We obtain the initial least-squares estimates from the log-linear solution.

  10. Alternative state variables do not impact the ordering of the Euler equation errors. We decided not to average across the linear state to obtain a better comparison between the linear and nonlinear solution techniques.

  11. We only provide the consumption Euler equation errors, since the firm pricing and bond Euler equation errors imply the same qualitative results. The other errrors are available from the authors upon request.

  12. Recent papers that solve the nonlinear model include Fernández-Villaverde et al. (2012); Aruoba and Schorfheide (2013); Gust et al. (2012); Judd et al. (2011); Mertens and Ravn (2013); Gavin et al. (2013); Basu and Bundick (2012).

  13. For a more detailed discussion on how productivity and discount factor shocks impact the model solutions and dynamics in models with and without capital (see Gavin et al. 2013).

References

  • Aruoba, S., & Schorfheide, F. (2013). Macroeconomic dynamics near the ZLB: A tale of two equilibria. Manuscript, University of Pennsylvania, Philadelphia, PA.

  • Aruoba, S. B., Fernandez-Villaverde, J., & Rubio-Ramirez, J. F. (2006). Comparing solution methods for dynamic equilibrium economies. Journal of Economic Dynamics and Control, 30, 2477–2508.

    Article  Google Scholar 

  • Basu, S., & Bundick, B. (2012). Uncertainty Shocks in a Model of Effective Demand, NBER Working Paper 18420.

  • Baxter, M. (1991). Approximating suboptimal dynamic equilibria: An euler equation approach. Journal of Monetary Economics, 28, 173–200.

    Article  Google Scholar 

  • Baxter, M., Crucini, M., & Rouwenhorst, K. (1990). Solving the stochastic growth model by a discrete-state-space, Euler-equation approach. Journal of Business and Economic Statistics, 8, 19–21.

    Google Scholar 

  • Bi, H. (2012). Sovereign Default Risk Premia, Fiscal Limits and Fiscal Policy. European Economic Review, 56, 389–410.

    Article  Google Scholar 

  • Bi, H., Leeper, E. M., & Leith, C. (2013). Uncertain fiscal consolidations. Economic Journal, 123, 31–63.

    Article  Google Scholar 

  • Braun, R. A., Körber, L. M., & Waki, Y. (2012). Some unpleasant properties of log-linearized solutions when the nominal rate is zero, FRB Atlanta Working Paper 2012–5a.

  • Caldara, D., Fernandez-Villaverde, J., Rubio-Ramirez, J., & Yao, W. (2012). Computing DSGE models with recursive preferences and stochastic volatility. Review of Economic Dynamics, 15, 188–206.

    Article  Google Scholar 

  • Chung, H., Davig, T., & Leeper, E. M. (2007). Monetary and fiscal policy switching. Journal of Money, Credit and Banking, 39, 809–842.

    Article  Google Scholar 

  • Coleman, W. J, I. I. (1991). Equilibrium in a production economy with an income tax. Econometrica, 59, 1091–1104.

    Article  Google Scholar 

  • Datta, M., Mirman, L., Morand, O., & Reffett, K. (2005). Markovian equilibrium in infinite horizon economies with incomplete markets and public policy. Journal of Mathematical Economics, 41, 505–544.

    Article  Google Scholar 

  • Datta, M., Mirman, L., & Reffett, K. (2002). Existence and uniqueness of equilibrium in distorted dynamic economies with capital and labor. Journal of Economic Theory, 103, 377–410.

    Article  Google Scholar 

  • Davig, T. (2004). Regime-switching debt and taxation. Journal of Monetary Economics, 51, 837–859.

    Article  Google Scholar 

  • Davig, T., & Leeper, E. M. (2006). Fluctuating macro policies and the fiscal theory. In D. Acemoglu, K. Rogoff, & M. Woodford (Eds.), NBER macroeconomics annual 2006 (Vol. 21, pp. 247–298). Cambridge, MA: MIT Press.

    Google Scholar 

  • Davig, T., & Leeper, E. M. (2008). Endogenous monetary policy regime change. In L. Reichlin & K. D. West (Eds.), NBER international seminar on macroeconomics 2006 (pp. 345–391). Cambridge, MA: MIT Press.

    Google Scholar 

  • Davig, T., Leeper, E. M., & Walker, T. B. (2010). Unfunded liabilities’ and uncertain fiscal financing. Journal of Monetary Economics, Carnegie-Rochester Conference Series on Public Policy, 57, 600–619.

    Google Scholar 

  • Davig, T., Leeper, E. M., & Walker, T. B. (2011). Inflation and the Fiscal Limit. European Economic Review, Special Issue on Monetary and Fiscal Interactions in Times of Economic Stress, 55, 31–47.

    Google Scholar 

  • Dixit, A. K., & Stiglitz, J. E. (1977). Monopolistic competition and optimum product diversity. American Economic Review, 67, 297–308.

    Google Scholar 

  • Epstein, L. G., & Zin, S. E. (1989). Substitution, risk aversion, and the temporal behavior of consumption and asset returns: A theoretical framework. Econometrica, 57, 69–937.

    Article  Google Scholar 

  • Epstein, L. G., & Zin, S. E. (1991). Substitution, risk aversion, and the temporal behavior of consumption and asset returns: An empirical analysis. Journal of Political Economy, 99, 86–263.

    Article  Google Scholar 

  • Fernández-Villaverde, J., Gordon, G., Guerrón-Quintana, P. A., Rubio-Ramírez, J. (2012). Nonlinear adventures at the zero lower bound, NBER Working Paper 18058.

  • Gaspar, J., & Judd, K. (1997). Solving large-scale rational-expectations models. Macroeconomic Dynamics, 1, 45–75.

    Article  Google Scholar 

  • Gavin, W. T., Keen, B. D., Richter, A. W., & Throckmorton, N. A. (2013). Global dynamics at the zero lower bound, FRB of St. Louis Working Paper 2013–007B.

  • Giovannini, A., & Weil, P. (1989). Risk aversion and intertemporal substitution in the capital asset pricing model, NBER Working Paper 2824.

  • Greenwood, J., & Huffman, G. W. (1995). On the existence of nonoptimal equilibria in dynamic stochastic economies. Journal of Economic Theory, 65, 611–623.

    Article  Google Scholar 

  • Gust, C., López-Salido, D., & Smith, M. E. (2012). The empirical implications of the interest-rate lower bound, CEPR Discussion Paper 9214.

  • Heer, B., & Maussner, A. (2005). Dynamic general equilibrium modelling: Computational methods and applications. Berlin: Springer.

    Google Scholar 

  • Ireland, P. N. (1997). A small, structural, quarterly model for monetary policy evaluation. Carnegie-Rochester Conference Series on Public Policy, 47, 83–108.

    Article  Google Scholar 

  • Judd, K. L. (1992). Projection methods for solving aggregate growth models. Journal of Economic Theory, 58, 410–452.

    Article  Google Scholar 

  • Judd, K. L. (1998). Numerical methods in economics. Cambridge, MA: The MIT Press.

    Google Scholar 

  • Judd, K. L., & Guu, S.-M. (1993). Perturbation solution methods for economic growth models. In H. R. Varian (Ed.), Economic and financial modeling with mathematica (pp. 80–103). New York: Springer.

    Chapter  Google Scholar 

  • Judd, K. L., & Guu, S.-M. (1997). Asymptotic methods for aggregate growth models. Journal of Economic Dynamics and Control, 21, 1025–1042.

    Article  Google Scholar 

  • Judd, K. L., Maliar, L., & Maliar, S. (2011). A cluster-grid algorithm: Solving problems with high dimensionality. Manuscript, Stanford University, Stanford, CA.

  • Klein, P. (2000). Using the generalized schur form to solve a multivariate linear rational expectations model. Journal of Economic Dynamics and Control, 24, 1405–1423.

    Article  Google Scholar 

  • Kumhof, M., & Ranciere, R. (2010). Inequality, leverage and crises, IMF Working Paper 10–268.

  • Leeper, E. M. (1991). Equilibria under ‘active’ and ‘passive’ monetary and fiscal policies. Journal of Monetary Economics, 27, 129–147.

    Article  Google Scholar 

  • McCandless, G. (2008). The ABCs of RBCs: An introduction to dynamic macroeconomic models. Cambridge, MA: Harvard University Press.

    Google Scholar 

  • Mertens, K., & Ravn, M. O. (2013). Fiscal policy in an expectations driven liquidity trap. Manuscript, Cornell university, Ithaca, NY.

  • Mirman, L., Morand, O., & Reffett, K. (2008). A qualitative approach to markovian equilibrium in infinite horizon economies with capital. Journal of Economic Theory, 139, 75–98.

    Article  Google Scholar 

  • Richter, A. (2012). The fiscal limit and non-ricardian consumers. Auburn, AL: Auburn University.

    Google Scholar 

  • Richter, A., & Throckmorton, N. (2012). MATLAB/MEX/Fortran Toolbox. http://auburn.edu/awr0007/AWR_files/MatlabMEXtoolbox.zip.

  • Richter, A. W., & Throckmorton, N. A. (2013). The zero lower bound: Frequency, duration, and determinacy. Manuscript, Auburn University, Auburn, AL.

  • Rotemberg, J. J. (1982). Sticky prices in the United States. Journal of Political Economy, 90, 1187–1211.

    Article  Google Scholar 

  • Schmitt-Grohe, S., & Uribe, M. (2004). Solving dynamic general equilibrium models using a second-order approximation to the policy function. Journal of Economic Dynamics and Control, 28, 755–775.

    Article  Google Scholar 

  • Sims, C. A. (2002). Solving linear rational expectations models. Computational Economics, 20, 1–20.

    Article  Google Scholar 

  • Stroud, A. (1971). Approximate calculation of multiple integrals. Englewood Cliffs, NJ: Prentice Hall.

    Google Scholar 

  • Uhlig, H. (1997). A Toolkit for analyzing nonlinear dynamic stochastic models easily. Manuscript, Center for Economic Research.

  • Walsh, C. E. (2010). Monetary theory and policy (3rd ed.). Cambridge, MA: The MIT Press.

    Google Scholar 

Download references

Acknowledgments

We thank Troy Davig for many helpful discussions and Bulent Guler and a referee for helpful comments. Walker acknowledges support from the National Science Foundation under Grant SES 096221

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Todd B. Walker.

Electronic supplementary material

Below is the link to the electronic supplementary material.

Supplementary material 1 (PDF87 KB)

Rights and permissions

Reprints and permissions

About this article

Cite this article

Richter, A.W., Throckmorton, N.A. & Walker, T.B. Accuracy, Speed and Robustness of Policy Function Iteration. Comput Econ 44, 445–476 (2014). https://doi.org/10.1007/s10614-013-9399-2

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10614-013-9399-2

Keywords

JEL Classification

Navigation