How to solve a model with heterogeneous agents?

I was wondering if Dynare itself can solve a model with a distribution of heterogeneous agents, without the help of external files. If so, could you recommend an example to learn fro?

Say individual’s state variable includes their wealth, like asset or capital holdings. And every agent faces a probability of dying. So their assets evolve over time. And their decision rules depend on assets, maybe in a non-linear way. I notice there are some coded purely in dynare but focused on the aggregate variables. If I want to track individual’s behaviour, how can I do it? Sorry for an abstract description.

The general answer is: No. If there is heterogeneity, you need to become creative. You may want to take a look at the JEDC special issue at sciencedirect.com/science/journal/01651889/34/1. The Kim/Kollmann/Kim approach is easily implementable in Dynare.

I want to take a step back. How is heterogeneity defined? I am actually asking which aspect of heterogeneous agents makes it hard to solve the model. Except purely for tracking individuals’ paths, is it because discontinuity in policy functions and law of motion, e.g. default, that also makes solving aggregate variables complicated?

It’s about whether aggregation is possible or not. If you cannot easily aggregate up, you need to keep track of the distribution (typically the wealth distribution). Distributions are infinite dimensional objects (you need all moments from 1 to infinity to fully characterize a distribution). Dealing with this infinite dimensional object is what makes it so hard.
In many representative agent models, there is a continuum of agents, but their consumption and thus wealth is perfectly insured via Arrow-Debreu securities. In this case, every agent will always have the same wealth at the end of the period, even if there are idiosyncratic shocks that only hit some agents. Take away complete markets and some agents will have positive shocks while other will have negative ones. In this case, they will choose different assets at the end of the period. You would need to keep track of this. If you only assume two types, this is doable. If there are infinitely many, it quickly becomes intractable.

Hi all after these years,

I tried in the past with Dynare, but I am just a newcomer here. However, I think that once defined the aggregate variables, there should be a solution for the infinitely-dimension problem. In Bewley models, this could be solved by introducing an exogenous stochastic process of the kind used in the standard models. The decision rules would then be a function of this process, and aggregates are their “expectation” over the exogenous variables. The problem at hand is that on obtaining the decision rules we need some priors on future prices. So, at least Dynare is perhaps able to give this function F, which maps aggregates into themselves, as the output. The ultimate problem boils down to get a fixed point of F or more precisely, a grid of it.

PD Something like this