Benjamin Moll Heterogeneous Agent Modelsin Continuous Time This is a collection of codes that solve a number of heterogeneous agent models in continuous time using finite difference methods. Huggett Model Explanation of Algorithm Online Appendix of Achdou et al (2017) HJB equation, explicit method (Section 1.1) HJB_stateconstraint_explicit.m HJB equation, implicit method (Section 1.2) HJB_stateconstraint_implicit.m KFE Equation (Section 2, using matrix from HJB implicit method) huggett_partialeq.m Plotting the asset supply function (Section 3.1) huggett_asset_supply.m Finding the equilibrium interest rate (Section 3.2) huggett_equilibrium_iterate.m Transition Dynamics (Section 4) All of (4a)-(4c) need inputs huggett_initial.m, huggett_terminal.m (4a) simple updating rule huggett_transition.m (4b) Newton method huggett_newton.mhuggett_subroutine.m (4c) Newton method using @myAD huggett_newton_myAD.mhuggett_subroutine_myAD.m HJB equation with diffusion, implicit method (section 5.1) HJB_diffusion_implicit.m KFE Equation (Section 5.2, using HJB matrix) huggett_diffusion_partialeq.m Credit Crunch (courtesy of Gustavo Mellior) Explanation of Algorithmhuggett_transition_cc.m plus huggett_initial_cc.m, huggett_terminal_cc.m and gifmaker.m Consumption-Saving Problem with Endogenous Labor Supply Explanation of AlgorithmHJB_labor_supply.m, lab_solve.m Aiyagari Model Explanation of Algorithm Online Appendix of Achdou et al (2017) Stationary Equilibrium with Poisson Process aiyagari_poisson_steadystate.m Steady State Asset Supply Function with Poisson Process aiyagari_poisson_asset_supply.m Python version (Jupyter notebook) aiyagari_continuous_time.ipynbshould be compared with QuantEcon’s discrete-time version of the Aiyagari model “MIT Shock” with Poisson Income Process aiyagari_poisson_MITshock.m Stationary Eq. with Diffusion (Section 6.1, courtesy of Galo Nuno) aiyagari_diffusion_equilibrium.mJulia version of code: aiyagari_diffusion_equilibrium.jl (download Juno for nice GUI) C++ version of code: aiyagari_diffusion_equilibrium.cpp (instructions for Mac users, makefile) Transition Dynamics with Diffusion (Section 6.2) aiyagari_diffusion_transition.m Julia code for MIT Shock with Diffusion (courtesy of Matthieu Gomez): aiyagari_diffusion_MITshock.jl Make movie of evolution of wealth distribution (Section 6.4) make_movie.m Aiyagari Model with Fat-tailed Wealth Distribution (Section 8) fat_tail_partialeq.m, uses non-uniform grid as explained in Section 7 Lifecycle Model Description of Model and Algorithm Partial Equilibrium lifecycle.m Investment under Uncertainty by Heterogeneous Firms Description of Model and Algorithm Partial Equilibrium firm.m Model with Two Assets and Kinked Adjustment Costs Description of Model and Algorithm Partial Equilibrium two_asset_kinked.m Subroutines two_asset_kinked_cost.m,two_asset_kinked_FOC.m Handling Non-Convexities I Neoclassical Growth Model with Convex-Concave Production Function (Skiba, 1978) Description of Model and Algorithm Finding the “Skiba point” HJB_NGM_skiba.m Handling Non-Convexities II Entrepreneurship and Financial Frictions Description of Model and Algorithm Stationary Equilibrium entrepreneurs.m MIT Shock entrepreneurs_MIT_shock.m Handling Non-Convexities III Indivisible Housing and Mortgages Description of Model: see Section 4.3 of Achdou et al. (2017) Partial Equilibrium housing.m Stopping Time Problem I Exercising an Option Description of Model and Algorithm Solve as Linear Complementarity Problem (LCP) option_simple_LCP.m plus LCP.m (LCP solver) Stopping Time Problem II Firm Entry and Exit (Hopenhayn, 1992) Description of Model and Algorithm Solve as Linear Complementarity Problem (LCP) hopenhayn.m plus LCP.m (LCP solver) Stopping Time Problem III An Indivisible Durable Description of Model and Algorithm Solve as Linear Complementarity Problem (LCP) car.m plus LCP.m (LCP solver) Stopping Time Problem IV Liquid and Illiquid Assets and Fixed Adjustment Costs Description of Model and Algorithm Solve as Linear Complementarity Problem (LCP) liquid_illiquid_LCP.m plus LCP.m (LCP solver) and lininterp1.m (interpolation routine) Stopping Time Problem V Consumption and Saving with Default (courtesy of Gustavo Mellior and Katsuyuki Shibayama) Description of Model and Algorithm Solve as LCP default.m plus LCP.m (LCP solver) and cTsolver.m (subroutine) Consumption, Saving and Wealth Distribution with Hansen-Sargent Robustness Concerns Description of Model and Algorithm with Edouard Djeutem Code robust.m Labor-Market Matching with Precautionary Savings Description of Model and Algorithm courtesy of Bence Bardoczy Codes kms.zip Additional Codes Explanation of Algorithm No uncertainty, explicit method (Section 1.1) HJB_simple.m, HJB_no_uncertainty_explicit.m No uncertainty, implicit method (Section 1.2) HJB_no_uncertainty_implicit.m Neoclassical Growth Model, explicit method (Section 2.1) HJB_NGM.m Neoclassical Growth Model, implicit method (Section 2.2) HJB_NGM_implicit.m RBC Model with diffusion for TFP, implicit method HJB_diffusion_implicit_RBC.m Matthieu Gomez's GitHub Repository Matthieu Gomez’s GitHub Repository with great Julia codes, incl. the Bansal-Yaron (2004) Long-Run Risk Model Perturbation methods for heterogeneous agent models with aggregate shocks PaperCodesExample 1: using the toolbox to solve Krusell-Smith model, Example 2: using the toolbox to solve a one-asset HANK model Codes for Nuno and Moll (2017) “Social Optima in Economies with Heterogeneous Agents” SOHA_codes.zip Old codes for Huggett Model without using Matlab's sparse matrix routines (slower) HJB_stateconstraint_implicit_old.mhuggett_partialeq_old.mhuggett_asset_supply_old.m huggett_equilibrium_iterate_old.mHJB_diffusion_implicit_old.mhuggett_diffusion_partialeq_old.maiyagari_diffusion_equilibrium_old.m