Skip to content

Heterogeneous agents without aggregate uncertainty

Pablo Winant edited this page Feb 5, 2016 · 2 revisions

The goal is to have a proof of concept implementation of an heterogeneous agents model. It would be defined by:

  • a dtcscc model
  • distributions for the parameters of the individual decisions
  • aggregate clearing conditions which would depend on all states/controls/parameters. These aggregate conditions would be associated to a list of free parameters, which would be common to all agents

Here is a tentative yaml file describing the problem to solve: https://github.com/EconForge/heterogeneous_agents_workshop/blob/master/examples/consumption_savings_bewley.yaml . Look at this file as a kind of "challenge". I propose to address this challenge in two different phases:

Proof-of-concept phase (with a small number of agents)

  1. parse the yaml file (which consist in two documents) to produce:
    • a dtcscc model
    • a data-structure describing the heterogeneity (distribution of coeffs, etc.). Use a quick hack to deal with the symbolic expressions. (example below)#
  2. write a routine, which solves the individual model many times, taking parameters from the distribution. This can reuse the solution routines already in dolo
  3. simulate all solutions
  4. compute the residual of all aggregate clearing conditions
  5. redo 2-3-4 for various values of the free parameter to be adjusted until the residuals are 0. This outer loop can be done many ways. I suggest grid search for the first try so that we can plot the residuals.

More efficient phase (output can be compared with the former phase, which is still usefull for debugging anyway).

  1. solve the model for many parameters at once in a vectorized way
  2. simulate the solutions of many model values at once

In the process, some simple tasks which will increase happiness:

  • write routines to study the resulting distributions
  • write a __repr__/__html__ routine to represent the heterogeneous model in a beautiful way
  • propose ways to write the aggregate conditions in the yaml file (which will be considered when redesigning the language).
  • think about algorithmic improvements

Quick hacks:

  • for s = 'i -> i/n*0.1' one could do: fun = eval( 'lambda {}: {}'.format( *str.split(s,'->')) )
  • for: sum([i,j], m[i,j]-c[i,j]) one can redo the lambda trick or rewrite s = "sum(m-c)" and use numexpr.evaluate(s) which produces the desired answer when m and c are 2d matrices