Model diagnostics command

Hi Johannes,

I modified my model since last time we talked and ran into a new problem with violated BK conditions. I do not know why they are violated, so I was hoping you could inform me how to check the diagnostics – I tried typing that command, but nothing came up – to find out what’s wrong. I attached my code and model equations; the equilibrium condition on energy is extremely nonlinear and big – to get it, I used an external matlab analytical derivative solver.

Thank you for your help!
benchmarkcb_dynamic.pdf (113 KB)
benchmarkcb.mod (8.37 KB)

Just wanted to post again so the question doesn’t get lost – I figure the answer to this is relatively simple, although it’s not in the documentation (?).

There is nothing obvious wrong here. That’s why model_diagnostics has no output.

My guess is a timing mistake. Is there only on predetermined variable, capital?

I am glad there’s nothing blatantly wrong, but peculiar indeed why it continues not to work. I will check the timing of variables again; those sorts of issues I tend to double check often already nonetheless. Programming is the most frustrating element of research…

Hey Johannes – I know that I am probably your most active “customer” here (!), so I fully understand if you prefer to delay looking at this problem. I wanted to follow up that I continued trying and the same problem persists.

I modified the model - made it simpler production so it’s Cobb Douglas - in hopes that I would resolve the problem; BK is still violated though. I did come across and resolve a separate problem; it seems that the analytical derivative Matlab took in a separate function file was wrong (at least relative to what I derived 10+ times over by hand).

If you get to it, curious to hear what you think about this new version (pdf attached with the equations and context). I was advised by two macro economists to solve it in Dynare before solving it with a projection method, but if the reason it’s not solving is Dynare related then I must go the other route.
benchmarkcb.mod (6.51 KB)
Dynare question.pdf (151 KB)

One of your exogenous processes is

z_k=rho_k*z_k(-1)+rho_e*z_e(-1)+eps_k; z_e=rho_e*z_e(-1)+rho_k*z_k(-1)+eps_e;
This is a VAR-process with coefficient matrix

[rho_k rho_e; rho_e rho_k]
With your parameter values, this matrix is

ans = 0.9800 0.9600 0.9600 0.9800]
Its eigenvalues are

0.0200 1.9400
As the one eigenvalue bigger than 1 shows, this process is not stable. If you set all autoregressive parameters to below 0.5, your model runs.

Sidenote: please upgrade Dynare and follow its advice, e.g.:


Wow, amazing find!! I spent so many hours searching and I never would have thought it was the shocks since they are zero in the steady state.

Did you use model diagnostics to find this (I tried, but nothing came up)? Why do you think making the shocks correlated was a problem? Although when I run it now it works, I get four different shocks for each endogenous variable, ie A_e_eps_k, A_e_eps_e, A_e_eps_u, and so on. A little odd?

Thank you again for looking at it and resolving it – I hope it didn’t take you too long! :slight_smile:

  1. No, I did not use model_diagnostics. The error message from check suggested that you have unstable root more than forward-looking variables. That implied that there was a problem with a “wrong” state variable. Either you something was declared as a state that was not predetermined or there was a problem in the parametrization. As capital was the only backward-looking variable, I looked at the exogenous processes and checked their autocorrelation
  2. Having correlated shocks per se is not a problem, but to make sure that Dynare correctly updates the covariance matrix during estimation, we now forbid users from using parameters inside of the shocks-block. This prevents a lot of bugs and mistake.
  3. Having correlated exogenous processes (as opposed to shocks) is also valid as long as they are jointly stationary. That was not the case in your mod-file because the correlated processes reinforced each other to become unstable.