Hi! I am trying to run this model in dynare, and I encountered the error message below.

Residuals of the static equations:

Equation number 1 : NaN
Equation number 2 : NaN
Equation number 3 : NaN
Equation number 4 : 0
Equation number 5 : NaN
Equation number 6 : 0
Equation number 7 : 0
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : NaN
Equation number 12 : 0
Equation number 13 : NaN
Equation number 14 : 0
Equation number 15 : 0
Equation number 16 : 0
Equation number 17 : 0
Equation number 18 : NaN
Equation number 19 : -0.11
Equation number 20 : 0
Equation number 21 : NaN
Equation number 22 : 0
Equation number 23 : NaN
Equation number 24 : 0
Equation number 25 : -1
Equation number 26 : 0
Equation number 27 : NaN

myfile.rar (2.9 KB)

Could anybody help me for this? Thanks a lot!

As the warning/error indicates, your steady state file is not returning a steady state. Inspection of the file reveals that fzero is returning an exitflag of -5. Matlab documentation for the function says this indicates “Algorithm might have converged to a singular point.”. The subsequent if statement says to return to the main file if exitflag < 1. Any variables which did not get values in the steady state file (i.e. everything after line 31) will be set to zero. Matlab returns NaN for expressions which do not evaluate to a number such as “Inf/Inf” and “0/0” and “Inf-Inf”.

This is why for example equation one has a residual of NaN: with c=0 and lamba=0 the equation

1/(c-hc)-betah/(c-hc)-lamda = 1/0 - betah/0 - 0 = Inf - Inf - 0 = NaN

tl;dr: Try to figure out why fzero is returning a flag of -5 when you try to solve for rao_1. That is the current chokepoint.

Also, adjust your steady state file to use the error code of the optimizer to govern the `check`-flag of that file. That way, you get a better error message.

Thanks a lot!

OK. Thanks!

Professor, I encountered a new priblem. I modified the original steady state file and found that it can only be reduced to a binary nonlinear equations about pi and rao_1. Therefore, I have to solve this system of nonlinear equations before solving the entire steady-state system. I tried to use the resolve function, but failed. Is there any other way to solve this problem? Thanks again (3.1 KB)

Try graphing the equations in the (pi,rao_1) space. That should help you see what is going on and provide suitable starting values.

Sorry, but I cannot access the attachment