The steady state has NaNs or Inf - 2 goods model

Dear All,

I attach to this message the mod file that I am using to simulate a New Keynesian model. In the model there are households consuming a basket of two goods G and D which are produced by two heterogenous firms G and D (with different TFP). Monetary authorities only target inflation.

The model in the .mod file is already log-linearized. The values indicated as parameter with the subscribt “_SS” are the steady state values that I obtained by solving the non-linear steady state equations model (I have log-linearized around a zero inflation steady state with pai_aggregate=pai_g=pai_d=1).

When I run this code I get “The steady state has NaNs or Inf” and residuals are all NaN.

Can someone help me with this?

Thank you!

code_v0.mod (8.4 KB)

to see that various equations feature constant terms. Thus, your linearization must be wrong/inconsistent.

1 Like

Dear jpfeifer, thank you for your reply.

In addition to the point you mentioned, can this be linked to the fact that I am plugging in equations in nominal rather than real terms (for example the budget constraint)?

I think the two should not be linked as I have understood that even if I am plugging in the right equations in nominal terms, Dynare should be able to simulate the model but I would see a unit root in the IRF.


The most important part are the constant terms. Nominal or real should not matter in a linearized model due to the steady states of all variables being 0.

1 Like

Thank you again for your reply!

As I would like to further investigate the points that you mentioned, I want to check again if my original derivations are correct (I refer to the non-linear model) and the try again to log-linearize.

When I write my non-linear model in Dynare, how should I optimally specify the initial conditions? Should I analytically solve for the steady-state values of the model and plug them in as initial value after having specified the steady-state model, right?

If you specified a steady_state_model-block, you don’t need initial values.

Dear jpfeifer, thank you again for your reply.

I have written the model in non-linear terms and I have specified the initial values condition of the model which I obtained through an external f_solve script.
Now I am able to find the steady-state values that look reasonable.

The problem is now related to the check command, where I have the error
“The generalized Schur (QZ) decomposition failed. For more information, see the documentation for Lapack function dgges: info=30, n=10. You can also run model_diagnostics to get more information on what may cause this problem”.

If I run model_diagnostics it says that “No obvious problems with this mod-file were detected”.

What can be the cause of such an issue? I attach here the new mod file.

Thank you in advance!

upload.mod (7.5 KB)

Most often, it’s a timing issue or a fundamental problem in the model setup. I can only give you the generic advice to try and simplify the model to see where the problem comes from.

Thank you jpfeifer for your advice.
Do you have any reference for any basic 2-sector NK model in the literature (better if already implemented in Dynare)?
Following your advice, the idea is to simulate first a classic 2-sector NK model in Dynare (where the two sector differ only in productivity level) and then add the environmental framework (that I have already tested in a 1-sector NK model and works well).

Maybe the issue is in the two-sector framework that I am currently using.

Dear jpfeifer,

I followed your advice and I modified the structure of my model.
Now I have HH consuming a good C, a final firm producing a good Y that is the aggregate of two intermediate products Y_G and Y_D. I solved the problem linked to the steady state values, but now I have I problem with the BK conditions as only 5 out of 6 eigenvalues are larger than 1 in module.

Do you have any suggestions for this? (the model works properly if I set Monetary Policy Response to inflation G parameter equal to 100, which makes no sense).

I attach here the console_upload.m file to find SS and create parameters matrix and the mod file to run the model.

I really appreciate any help you can provide, thank you.

console_upload.m (4.3 KB)
find_steady_upload.m (1.2 KB)
upload.mod (6.9 KB)

Unfortunately, I don’t have good ideas. If it’s not the parameterization, there must still be a more fundamental issue.

I think the two should not be linked as I have understood that even if I am plugging in the right equations in nominal terms, Dynare should be able to simulate the model but I would see a unit root in the IRF.