-
Notifications
You must be signed in to change notification settings - Fork 83
Krusell Smith Algorithm
Working notes for an ongoing project to implement a fast and accurate algorithm for solving Krusell-Smith type economic models with heterogenous agents.
Start by reading Krusell and Smith (2006). Wouter den Haan's introductory slides on heterogenous agent models are another good resource. There is also a handbook chapter on solving and simulating models with heterogeneous agents by Algan et al (2010).
The place to start is definitely Wouter den Haan's website, specifically his slides on the original Krusell-Smith algorithm: the KS algorithm specifies a law of motion for these moments and then finds the approximating function to this law of motion using a simulation procedure. Specifically, for a given set of individual policy rules (which can be solved for via value function iterations, etc.), a time series of cross-sectional moments is generated and new laws of motion for the aggregate moments are estimated using this simulated data.
Skim read Den Haan (2010), a survey article on the current state of the art solution methods to Krusell-Smith. Paper also has a nice, concise description of Krusell and Smith (1998) model. Here is the abstract for Den Haan (2010):
This paper compares numerical solutions to the model of Krusell and Smith [1998.*Income and wealth heterogeneity in the macroeconomy. Journal of Political Economy* 106, 867–896] generated by different algorithms. The algorithms have very similar implications for the correlations between different variables. Larger differences are observed for (i) the unconditional means and standard deviations of individual variables, (ii) the behavior of individual agents during particularly bad times, (iii) the volatility of the per capita capital stock, and (iv) the behavior of the higher-order moments of the cross-sectional distribution. For example, the two algorithms that differ the most from each other generate individual consumption series that have an average (maximum) difference of 1.63% (11.4%).
The above paper suggests that implementation details matter and can substantially impact the accuracy of solution for this class of models. Wouter den Haan provides code for JECD comparison project. Maybe start by implementing the den Haan and Rendahl (2009) algorithm in Python? Followed by Reiter (2009). Given that different algorithms can arrive at different solutions, checking the accuracy of a given solution method against alternatives is important. Slides on the checking accuracy of the above algorithms.
Various solution algorithms: Key difficulty in solving Krusell-Smith type models is to find a way to summarize the cross-sectional distribution of capital and employment status (a potentially infinite dimensional object) with a limited set of its moments.
Other Krusell-Smith related links:
- Anthony Smith's original Fortran implementation of Krusell-Smith. Code looks completely impenetrable! Not much in the way of comments or documentation. Probably not worth working out how the code works.
- Sergei Mailar's MatLab code for Krusell-Smith (Mailar provides code for other interesting projects as well!).
- Fortran code for Krusell and Smith (2009).
- Wouter den Haan's slides on additional applications of the Krusell-Smith approach (includes monetary models with consumer heterogeneity, models with entrepreneurs, turning KS into a matching model, portfolio problem).
- Tutorial on writing fast FORTRAN routines for Python.