Graph for GE iteration

Hi Robert, when I calculate equilibrium prices for an OLG model, will the Toolkit store the equlibrium condition for each iteration? I’m thinking of plotting a graph that shows the sum of squares of the functions in GeneralEqmEqns converges to zero.

2 Likes

There is now :smiley: (seems like a handy feature, and was pretty trivial to implement)

Default setting is heteroagentoptions.pricehistory=0.

If you set heteroagentoptions.pricehistory=1, then change the outputs from the stationary general eqm command, e.g., HeteroAgentStationaryEqm_Case1() [same for FHorz, and/or PType versions] so that there is now one more output, e.g., [p_eqm,GeneralEqmConditions,PriceHistory]=.... So there is an extra output called PriceHistory which gets created because we set heteroagentoptions.pricehistory=1.

The PriceHistory will contain PriceHistory.itercount which is the number of iterations taken to find the general eqm. It contains the prices (e.g, PriceHistory.r will be a vector with length itercount), and the general eqm conditions (e.g., PriceHistory.capitalmarket will be a vector with length itercount). If you want to sum-of-squares those general eqm conditions you easily can.

2 Likes

Hi Robert, for 3-D graph (eg. age*asset*v), value function graph can be obtained from V matrix, and decision variables can be obtained from Policy matrix, is there any shortcuts to get consumption or other variables that defined in FnsToEvaluate?

‘ValuesOnGrid’ commands (e.g., ValuesOnGrid=EvalFnOnAgentDist_ValuesOnGrid_FHorz_Case1() ).

This gives you the value of the FnsToEvaluate at each point on grid. So, e.g., loosely speaking AllStats.earnings.Mean will contain the same answer as you can calculate with sum(ValuesOnGrid.earnings .* StationaryDist).

PS. There are also PolicyInd2Val commands, which let you do the same thing for just the policies themselves.

2 Likes