This is a collection of codes that solve a number of heterogeneous agent models in continuous time using finite difference methods

**1. Huggett Model (from Achdou et al., 2014):**

**Explanation of Algorithm**

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**

HJB equation with diffusion, implicit method (section 4.1):

**HJB_diffusion_implicit.m**

KFE Equation (Section 4.2, using HJB matrix):

**huggett_diffusion_partialeq.m**

Transition Dynamics (Section 5):

**huggett_transition.m**,

**huggett_initial.m**,

**huggett_terminal.m**

**2. Aiyagari Model (from Achdou et al., 2014):**

**Explanation of Algorithm**

Stationary Equilibrium (courtesy of Galo Nuno Barrau):

**aiyagari_diffusion_equilibrium.m**

Julia version of code:

**aiyagari_diffusion_equilibrium.jl**(download Julia Studio for nice GUI)

C++ version of code:

**aiyagari_diffusion_equilibrium.cpp**(instructions for Mac users, makefile)

Transition Dynamics:

**aiyagari_diffusion_transition.m**

Make movie of evolution of wealth distribution:

**make_movie.m**

**3. Model with Entrepreneurship and Financial Frictions:**

**Description of Model and Algorithm**

Stationary Equilibrium:

**entrepreneurs.m**

**4. Liquid and Illiquid Assets with Fixed Adjustment Costs:**

**Description of Model and Algorithm**

Partial Equilibrium:

**liquid_illiquid.m**

**5. 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 (Section 2):

**HJB_NGM.m**

**Old codes for Huggett Model without using Matlab's sparse matrix routines (slower):**

**HJB_stateconstraint_implicit_old.m**

**huggett_partialeq_old.m**

**huggett_asset_supply_old.m**

**huggett_equilibrium_iterate_old.m**

**HJB_diffusion_implicit_old.m**

**huggett_diffusion_partialeq_old.m**

**aiyagari_diffusion_equilibrium_old.m**