Contact: socampod@uwo.ca; brobin63@uwo.ca
This repository contains code that implements the histogram iteration method for computing longidudinal moments in heterogeneous agent models.
The paper describing the method is located in the main folder or by clicking here.
A short description of the method is presented below.
The method is implemented in Julia (v1.7).
We take as given the model's solution in the form of policy functions for agents that, together with the stochastic processes of exogenous states, implies an evolution for the agents in the economy.
This evolution is captured by a Markov kernel,
,
that maps the transition of agents from a current state
into a future state
in the state space
.
The stationary distribution,
,
is the solution to
We describe how to use
and
to directly compute cross-sectional and longitudinal moments, focusing on the distribution of agents rather than a simulated sample of them.
These moments involve taking expectations over some variable of interest (x) for some sub-population characterized by states ,
where
is the marginal distribution of the sub-population in S, with
and indicator variable for whether or not
.
The equation above applies to a wide range of moments. For example, the moments of the wealth distribution (an endogenous state) for the whole population or a subgroup (say among the top income earners), or to define percentiles or other descriptors of the distribution. It also applies to moments that depend on both endogenous and exogenous states, for example by making x total income.
As is well understood, these moments can be computed immediately from the solution of the model's stationary distribution
Consider an outcome of interest
that depends on the initial and final state of an agent.
This outcome could be any function of the initial, final, or intervening states of the agent.
For example, it could be an indicator function for whether the agent satisfies some condition in the future as being a top earner or having a certain occupation, or the agent's income.
The expectation of interest depends on whether we focus on the behavior of the group of agents (as in transition rates) or of individual agents (as in the auto-correlation of income).
In the first case, we must follow the group as a whole and compute
where is the future distribution of agents conditional on the initial distribution . In the second case, we must follow the possible paths of each individual and compute
where
is the future distribution of the mass of agents that starts in state
(i.e., given an initial distribution
).
The difficulty in evaluating the expectations needed for longitudinal moments resides in obtaining the future distributions and because this requires accounting for the variation in individual paths between the initial and final period.
We directly compute the future distributions by iterating forward the initial distribution of agents using the Markov kernel ,
Performing this iteration is relatively costless, as similar iterations are involved in finding the stationary distribution and the number of iterations required to compute the required future distributions are finite (and known). Once the future distributions are obtained, the moments can be computed directly from them.
We implement the method in two versions of the baseline heterogeneous agent model. The first has infinitely lived agents, and the second one an overlapping generations demographic structure. We provide separate code for each model in the Julia_Code folder.
The code is managed from Main_Solve_InfHor_Model.jl and Main_Solve_OLG_Model.jl. All other files are called by these Main files. The parameter and model structures use the Parameters Package. Other packages are indicated in the Main files.