Debugging deterministic simulations

Dear Musketeers,

I wonder if Dynare has tools to debug, or trace the source of problems, failed deterministic simulations? It seems that important non-linearities are often difficult for the solution algorithm. Therefore, “manual” homotopy often helps.

Is there a neat way to study, for example, the singularity of Jacobian (eg, figuring out the eigenvector corresponding zero eigenvalue)?

Best,

Antti

Dear Antti,

I don’t think, but I may be wrong, that we have this kind of tools for nicely reporting the eigenvectors associated to 0 eigenvalues. Actually I often do that manually in other context (singularity in the Kalman filter), and we should definitely add (or improve) this.

But I don’t really see how it would help in the context of the perfect foresight simulations of highly nonlinear models. If you can solve these models with manual homotopies (it’s true that the automatic homotopy in dynare is not very smart) it means that you do not have such problems (I mean true singularity issues not related to the scaling of the variables). Also eigenvector/eigenvalue analysis is local (around the steady state), and the singularity issue you have while simulating the model may pop up along search for the solution path far from the steady state… So it’s not necessarily very informative.

Best,
Stéphane.

Thank you Stéphane!

Is there a way to investigate the residuals of the failed attempt to solve the model? Or any other useful objects that might give a hint of the source of the failure?

Cheers,

Antti

I am afraid I don’t have a satisfactory answer… When I am in trouble with deterministic simulations, once I have discarded obvious problems (like structural singularity, BK conditions not satisfied around the terminal steady state, or scaling issues if the model is simulated along a BGP) I simply debug (using matlab’s debugger) the solver and look at the residuals after each iteration of the nonlinear solver to identify the culprits (problematic equations). This requires a minimum knowledge of dynare and matlab, and is really not user-friendly. We should implement a debug mode where this kind of information is saved on each iteration, this would certainly help (actually for some of the algorithms we have a debug mode, but we definitely do not store enough information). I do not use this approach often, but if you use the bytecode/block options (and associated solvers) the solvers return informations about the origin of the failure (if possible)… So this may help.

Best,
Stéphane.

Thanks again. These are very useful tips!