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.
Similar content being viewed by others
Notes
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.
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.
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.
We also provide code to solve the canonical RBC model with three conventional frictions—capital adjustment costs, variable utilization rates, and external habit persistence.
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.
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.
We obtain the initial least-squares estimates from the log-linear solution.
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.
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.
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.
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.
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.
Bi, H. (2012). Sovereign Default Risk Premia, Fiscal Limits and Fiscal Policy. European Economic Review, 56, 389–410.
Bi, H., Leeper, E. M., & Leith, C. (2013). Uncertain fiscal consolidations. Economic Journal, 123, 31–63.
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.
Chung, H., Davig, T., & Leeper, E. M. (2007). Monetary and fiscal policy switching. Journal of Money, Credit and Banking, 39, 809–842.
Coleman, W. J, I. I. (1991). Equilibrium in a production economy with an income tax. Econometrica, 59, 1091–1104.
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.
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.
Davig, T. (2004). Regime-switching debt and taxation. Journal of Monetary Economics, 51, 837–859.
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.
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.
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.
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.
Dixit, A. K., & Stiglitz, J. E. (1977). Monopolistic competition and optimum product diversity. American Economic Review, 67, 297–308.
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.
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.
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.
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.
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.
Ireland, P. N. (1997). A small, structural, quarterly model for monetary policy evaluation. Carnegie-Rochester Conference Series on Public Policy, 47, 83–108.
Judd, K. L. (1992). Projection methods for solving aggregate growth models. Journal of Economic Theory, 58, 410–452.
Judd, K. L. (1998). Numerical methods in economics. Cambridge, MA: The MIT Press.
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.
Judd, K. L., & Guu, S.-M. (1997). Asymptotic methods for aggregate growth models. Journal of Economic Dynamics and Control, 21, 1025–1042.
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.
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.
McCandless, G. (2008). The ABCs of RBCs: An introduction to dynamic macroeconomic models. Cambridge, MA: Harvard University Press.
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.
Richter, A. (2012). The fiscal limit and non-ricardian consumers. Auburn, AL: Auburn University.
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.
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.
Sims, C. A. (2002). Solving linear rational expectations models. Computational Economics, 20, 1–20.
Stroud, A. (1971). Approximate calculation of multiple integrals. Englewood Cliffs, NJ: Prentice Hall.
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.
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
Corresponding author
Electronic supplementary material
Below is the link to the electronic supplementary material.
Rights 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
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10614-013-9399-2
Keywords
- Policy function iteration
- Zero lower bound
- Epstein–Zin preferences
- Markov switching
- Chebyshev polynomials
- New Keynesian model