My mod file failed to run with error message ‘The steady state contains NaN or Inf’. Does this mean there are somewhere wrong in my model and I have to recalculate the equations? Are there any other reasons which can also lead to this error message? The mod file is attached below.

Warning: Some of the parameters have no value (mu, C_ss, D_ss, H_ss, w_ss, Pi_ss, Y_ss, rB_ss, xi_ss, K_ss, I_ss,
B_ss, L_ss, N_ss, gama_ss) when using steady. If these parameters are not initialized in a steadystate file or a
steady_state_model-block, Dynare may not be able to solve the model…

The reason is that your parameter definitions do not work, because mu=mu; % CMR(2010)=0.94 CMR(2014)=0.21
cannot work as mu was not set.

Thank you so much for your help. I am pretty sorry for having taken up your time for such a careless fault.

Now I rewrite parts of my mod file and get into another trouble for the steady state calculation. Since this is my first try to build a model myself, so I need a little experience. In my example, with dynare 4.4.3, ‘resid(1);’ command shows there are 7 of 25 equations have residuals unequal to zero, yet all are not too far from zero. And with dynare 4.5.1, this number of equations is 4. I wonder how you will treat this situation in your experience. Is it more likely to be a calculation error in some steady state value, or is it more likely that my model itself is wrong? How you think about it?

I know this question is a little too elementary. Of course I will try to work it out myself. But I also need your advice. Looking forward to hear from you and thanks in advance.

Focus on the equations with the biggest residuals, in particular equation 7. Given that you are providing analytical steady state values, there should be no residuals at all.

These days I struggled for choosing different calibration methods to solve the problem, but there is always one equation with residuals remaining. In fact, that equation is calibrated at very beginning, so it is strange to have residuals. When I calculate all the equations at steady state by hand, they are well matched (with some of them having residuals around 1e-15). Now the .mod file now can run but a lot of variables have no approximated theoretical moments results. I don’t quite understand how to deal with this and seek your help.

What you describe suggests that your steady state computations still do not match the entered model equations. You need to find the inconsistency.

Regarding the missing theoretical moments: there is a unit root in your model so that the unconditional second moments do not exist. You need to find out whether the unit root is a feature or a bug.

Thanks for your reply! Just like what you said, the steady state computation of one equation does not match the entered model equations. It is on account of variable accuracy. After changing it in to double floating point, the trouble has been fixed.

I learn DSGE myself all this time and it seems that I am not clear about some basic points. What I know is that generally a unit root comes from price level. Since my model only contains inflation instead of price, I don’t know where the unit root comes from. (And if possible, would you please recommend me some literature about this?)

Also, now some of the unconditional second moments do not exist. Does that mean this model is not available do welfare analysis next?

No, it’s not necessarily about nominal prices (although that is the most common case where a unit root is a feature of the model).

model_diagnostics(M_,options_,oo_) says:

MODEL_DIAGNOSTICS: The Jacobian of the static model is singular
MODEL_DIAGNOSTICS: there is 1 colinear relationships between the variables and the equations
Colinear variables:
C
D
H
w
Pi
rB
rK
xi
rKbar
K
I
B
L
omegabar
N
gama
Colinear equations
8 9 10

MODEL_DIAGNOSTICS: The singularity seems to be (partly) caused by the presence of a unit root
MODEL_DIAGNOSTICS: as the absolute value of one eigenvalue is in the range of ±1e-6 to 1.
MODEL_DIAGNOSTICS: If the model is actually supposed to feature unit root behavior, such a warning is expected,
MODEL_DIAGNOSTICS: but you should nevertheless check whether there is an additional singularity problem.
MODEL_DIAGNOSTICS: The presence of a singularity problem typically indicates that there is one
MODEL_DIAGNOSTICS: redundant equation entered in the model block, while another non-redundant equation
MODEL_DIAGNOSTICS: is missing. The problem often derives from Walras Law.

This suggests that there is a problem with the capital sector.

Thanks for your reply! Your words are always so helpful. Now I meet a trouble that IRFs look very strange and do not converge. I wonder there is somewhere wrong of the model structure. Would you please have a look at it?

I am kind of puzzled about the timing now: does 1+a=b and 1+a(+1)=b(+1) mean different to Dynare? I modified one equation like this and obtained different results just now.

Of course that is different. By convention, there is a conditional expectations around every equation. The second one therefore is equal to 1+E_t(a_{t+1})+E_t(b_{t+1})

Cloud you please help me to look at my codes once again? I rewrote some equations with timing trouble, yet some of the IRFs still look strange (although they are much better than before). It seems the shocks will have a long-term affection to some variables. I am not sure if it’s a feature or error, while it seems to be the latter. Thanks in advance!

Now you don’t have a unit root anymore, but a huge persistence as a couple of eigenvalues are very close to 1. That is most probably a matter of parameterization.

Do you mean some of the parameters or steady state values are calibrated to non-ideal numbers, and my task next is to find out them and modify the eigenvalues to reduce persistence of the model?