More feedback from HeteroAgentStationaryEqm

I think it would be useful if general equilibrium functions such as HeteroAgentStationaryEqm_InfHorz returned an output flag that tells the user if the GE converged or not.

Almost all of the routines used to find the GE (fminsearch, fzero, fsolve, etc) return a flag that gives some feedback on whether the algorithm stopped for max number of iterations reached, for true convergence etc.

For example, fminsearch returns exitflag as third output, see here: https://uk.mathworks.com/help/matlab/ref/fminsearch.html?requestedDomain=

Hmm, I guess the obvious way to do this would be to use variable number of outputs. First is ‘p_eqm’, second is ‘GECondn’ (these are currently what you get if you ask for one or two). I can put a third called ‘StationaryEqmsummary’ which is a structure and put all sorts of things like these in there.

I’ll think for a bit about it, hopefully implement early next week.

Any thoughts or suggestions, let me know.

1 Like

Sounds a good idea. What I had in mind was even simpler:

  1. fminsearch (or any other solver) returns three outputs: GE price vector, GE conditions, exitflag.
  2. The GE toolkit solver returns these three outputs.

The problem is that the GE toolkit solver has other features besides fminsearch-fsolve-fzero, like a grid search over a price grid, useful to check for multiple equilibria. This requires other outputs. So I don’t know what to suggest.