Lecture of error messages

I’m trying to replicate a DSGE from Gonzalez et all. After runing the mod file appears a long list of errors. I’dont know how to do a lecture of each error and what I have to do in order to fix the code.

Thank you

colombia bis.pdf (1.2 MB) variables_bis.xlsx (32.4 KB) bis_c.mod (7.7 KB)

Focus on the equations with NaN residuals first. For example,

Residuals of the static equations:

Equation number 1 : 0 : 1
Equation number 2 : NaN : 2

Equation 2 is


There are two issues here:

  1. You did not initialize c in initval. All variables that cannot be 0 must be explicitly set.
  2. Your process for

has it being mean 0, but it should probably be mean 1, i.e. there is a log missing.

Thank you for your answer. Is fsolve an option for me? What can I do if I don’t know de initial values?

  1. fsolve does not help as long as there are still mistakes in the model.
  2. Set initial values based on economic intuition. See Remark 15 (initval vs. steady_state_model vs. steadystate-file) in Pfeifer (2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models ”. The important part here is that the values need to be feasible.

Thank you for your help. I will use the steady_state block.

One more thing, before your answer I tried with initial values but no matter the value the resids did not change. What could be happening?
bis_c.mod (8.1 KB)


belong after initval

Thank you so much for your help

Hi professor Pfeifer

At this point I have no NaN nor Inf. I’ve been changing initial values to reduce residuals. However, I think that no matter how much I get close to 0 It will not find a solution. Are there any tool to verify if I have problematic equations?
bis_c_vnby.mod (7.2 KB)

you can always check the model and look for potentially troublesome variables/equations with:


You can just type it in the Matlab command window, it will check the results in the last .mod file you ran.

Thank you for your reply.

it shows me this:

DYNARE_SOLVE (solve_algo=2|4): solving block 2, of size 1
warning: division by zero
warning: called from
trust_region>dogleg at line 198 column 3
trust_region at line 115 column 7
dynare_solve at line 253 column 17
evaluate_steady_state at line 227 column 34
model_diagnostics at line 74 column 24
DYNARE_SOLVE (solve_algo=2|4): solving block 1, of size 41
MODEL_DIAGNOSTICS: The steady state cannot be computed

I don’t know how to read that message, where is the division by zero?

This will probably be of help: https://www.youtube.com/watch?v=GSWW7PsIgAE ( How to debug and report Dynare errors)

By following the video’s instructions you will be able to track that error from that Dynare reports, through the auxiliary files (built in in Dynare), to your code.

Thank you so much for your help

Given the size of your model and the potential for mistakes, I can only recommend computing the steady state analytically with pencil and paper. See

Yes I’m on that but I wanted to try with initial values. If there is a ss equation missing what happen with the values of the variables involved?

If there is an equation missing, you will not be able to compute the steady state because the system is underdetermined.