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
Thank you for your reply！
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.
Thanks in advance.
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:
- After running your .mod file, use the “resid” command in MATLAB’s command window. This will show you which equations are problematic.
- 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
- 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
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.
stoch_simul to see the problematic equations. You will see that you forgot to initialize some variables that must not be 0, e.g.
Thank you for your reply, Professor
I changed the steady state values of s,v and mu,but there is a new error message as shown in the picture.And it has shown that “the initial values for the steady state of the following variables are complex” ,but I just let them equal to their steady state,Idon’t know why does this happen. The .mod file is attached below.
Thanks in advance!
Brexit.mod (3.9 KB)
Thank you for your reply,Professor Jpfeifer
aT is a shock,can I set its Initial value equal to 1？
aTis not the exogenous innovation, but the endogenous variable driven by this process.
- I told you above how to check for the reason for the complex values.