# Problems of intival value

When using the model simulation of de trend, are variables, parameters, input parameter values, input steady state, input model and input shock defined in normal order? There is no linearization of the model here. Do you have to enter the initial value of the variable?

I’m not sure I can understand your question. What specifically do you mean by “normal order”?

Sorry. When the model I use is not linearized but de trended, is the writing order of dynare code the same as before: define variables and parameters, input steady-state expressions, input de trended model equations, and do I need to input steady-state initial values after the model equations?

The sequence of Dynare commands is always the same.

Dear Professor J.Pfeifer
When I run my code,I have the error message that “The steady state contains NaN or Inf”! I can’t find what’s wrong with my code .The parameters in the .mod file are all defined. are there other reason lead to this error? The mod file is attached below.

Best!
WhjBrexit.txt (3.8 KB)

There are many posts on the forums involving this problem, and looking through some of them will probably be useful to see the mistakes others made and compare against your own. See for example the recent post What are common dynare errors? for an explanation of the technical reason why NaN or Inf appears in your steady state.

A few general ideas for troubleshooting:

1. After running your .mod file, use the “resid” command in MATLAB’s command window. This will show you which equations are problematic.
2. The steady state values being used to produce the residuals of the static equations are found in “oo_.steady_state” in declaration order. Have a look at these steady state values and make sure they look reasonable
3. A very typical reason for undefined steady states on this forum seems to be taking the log of zero. Certainly your code is trying to do that: you specify the steady state values of v, s, and mu to be zero; the final three equations of your model block then try to take the natural log of 0, which evaluates to -Inf and the static equations are then of the form ln(0) - \rho*ln(0)= -Inf - (-Inf)=NaN

Good luck.

Check your parameter definitions by execute the computations before the model block using F9 in Matlab. E.g. the rNs variable is negative, resulting in a complex value for the associated capital stock.
Also, put resid; before stoch_simul to see the problematic equations. You will see that you forgot to initialize some variables that must not be 0, e.g. aT

1 Like

1. aT is not the exogenous innovation, but the endogenous variable driven by this process.