Error "Steady state contains NaN or Inf" when using external steady state file

Dear all,

I am learning Dynare to solve DSGE problems. Now I am trying to use external Matlab file to compute steady state, with the help of the example “NK_baseline_steadystate.m”.

I have try my best to linearized the .m file. But the mod file failed to run with error message"Error using print_info (line 90) The steady state contains NaN or Inf Error in steady (line 104) print_info(info,options_.noprint, options_); Error in DynareStudystochastic (line 147) steady; Error in dynare (line 235) evalin(‘base’,fname) ;".

However, when I try to use the equations to compute steady state by another .m file, it works.

I have no idea what’s wrong with my ‘DynareStudystochastic.m’ file.

Could anyone here help me with that?DynareStudystochastic_seadystate.m (1.5 KB)
DynareStudystochastic.mod (841 Bytes)

Thanks in advance!

Grace


The model I am using is attached. Thanks!

You have a typo in the naming of the steady state file. If you do not obey the naming convention, Dynare will not be able to detect it.

Thank you Prof. Pfeifer! :grinning:

This mistake is stupid. haha

sorry to bother, may I ask how you resolved it?

seadystate must be steadystate.

Thank you professor, I really appreciate your reply~ your memory is really good hahaha!
I would like to further inquire about the result of my code running,

dynare trans.mod
Starting Dynare (version 5.2).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
Found 30 equation(s).
Evaluating expressions…done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 1).
Processing outputs …
done
Preprocessing completed.

Randomize initial guess…

Residuals of the static equations:

Equation number 1 : NaN : c
Equation number 2 : NaN : 2
Equation number 3 : NaN : 3
Equation number 4 : NaN : k
Equation number 5 : NaN : zt
Equation number 6 : NaN : kt
Equation number 7 : NaN : ft
Equation number 8 : NaN : labt
Equation number 9 : NaN : mt
Equation number 10 : NaN : nt
Equation number 11 : NaN : wt
Equation number 12 : NaN : zg
Equation number 13 : NaN : kg
Equation number 14 : NaN : fg
Equation number 15 : NaN : labg
Equation number 16 : NaN : mg
Equation number 17 : NaN : ng
Equation number 18 : NaN : wg
Equation number 19 : NaN : 19
Equation number 20 : NaN : pt
Equation number 21 : NaN : m
Equation number 22 : NaN : n
Equation number 23 : NaN : w
Equation number 24 : NaN : ce
Equation number 25 : NaN : g
Equation number 26 : NaN : y
Equation number 27 : NaN : 27
Equation number 28 : NaN : 28
Equation number 29 : NaN : 29
Equation number 30 : NaN : 30

Error using print_info (line 32)
The steady state has NaNs or Inf.
Error in steady (line 102)
print_info(info,options_.noprint, options_);
Error in trans.driver (line 380)
steady;
Error in dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

——————
when this happens, what is the likely cause of the problem?

trans_0526.mod (2.6 KB)
this is my code~ thank you in advance!

For starters, you should initialize all variables.

Thanks for your reply, but I don’t quite understand. I assigned initial values to endogenous variables in the “initval” block. Do I need to assign initial values to all types of variables in the “initval” block?

You have 30 endogenous variables, but way fewer lines in initval.

What I think is that once the values of some endogenous variables are determined, the values of the remaining endogenous variables can be determined using the formula in the “model” block. I don’t know if this understanding is correct ?

No, Dynare takes initial values as the pure numbers you put in. It does not fill in the gaps from the model-block. After all, the model is a simultaneous equation system.

Thank you Professor. Based on the problem you pointed out, I have also assigned values to the remaining endogenous variables according to the equation in the “model” block. However, dynare is currently unable to calculate the steady-state value. Can you help me see where the problem lies?

trans_0526.mod (3.4 KB)

None of the solvers seems to be able to find the steady state. Are you sure there is a unique steady state that can be computed analytically? Have you tried computing the steady state analytically? Often that is the only way to properly debug the model.