Page 1 of 1

Model diagnostics command

PostPosted: Fri Feb 28, 2014 6:56 pm
by macroresearch123
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!

Re: Model diagnostics command

PostPosted: Wed Mar 05, 2014 2:56 pm
by macroresearch123
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 (?).

Re: Model diagnostics command

PostPosted: Wed Mar 05, 2014 3:29 pm
by jpfeifer
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?

Re: Model diagnostics command

PostPosted: Thu Mar 06, 2014 12:05 am
by macroresearch123
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...

Re: Model diagnostics command

PostPosted: Tue Mar 18, 2014 4:55 am
by macroresearch123
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.

Re: Model diagnostics command

PostPosted: Tue Mar 18, 2014 12:10 pm
by jpfeifer
One of your exogenous processes is
Code: Select all
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
Code: Select all
[rho_k rho_e;
rho_e rho_k]

With your parameter values, this matrix is
Code: Select all
ans =
[ 0.9800    0.9600
  0.9600    0.9800]

Its eigenvalues are
Code: Select all
 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.:
WARNING: some exogenous (tau_c, tau_h) are declared but not used in the model. This may lead to crashes or unexpected behaviour.

and
ERROR: some estimated parameters (rho_corr) also appear in the expressions defining the variance/covariance matrix of shocks; this is not allowed.

Re: Model diagnostics command

PostPosted: Tue Mar 18, 2014 2:10 pm
by macroresearch123
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! :)

Re: Model diagnostics command

PostPosted: Tue Mar 18, 2014 7:30 pm
by jpfeifer
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.