Error:The steady state contains NaN or Inf

Dear all,
my mod file failed with the error:the steady state contains NaN or Inf.
I checked for lots of times, but I don’ know why.
The mod file is attached below.
Thank you very much.
Christinefiscal.mod (367 Bytes)

You did not provide an initval for c, so 0 is taken, which is infeasible. You also did not set/define tau_c and tau_k.

thank you very much! It worked. But I got the another error: Blanchard Kahn conditions are not satisfied: indeterminacy. I’m not sure if it is related to the time. And, how can I simulate the model for 100 periods and plot the results.
Thank you very much!

The Blanchard-Kahn condition is not satisfied because you use the wrong timing convention for the capital stock. Since the capital stock used to produce today is actually decided yesterday, k(-1) should enter the production function. You should similarly adapt the other side of the resource constraint, by shifting time indices.

Alternatively, you can keep your existing timing convention, but add predetermined_variables k; at the beginning of your mod-file.

For the simulation, if you want the IRFs corresponding to the different shocks, you must declare their variance/standard deviation (using the shocks block), and give the irf=100 option to stoch_simul. If you want a more elaborate scenario, combining different shocks, you’ll have to use the simult_ function (search the forum).

1 Like

thank you so much! it worked finally!! And how how can I define a time into my code like at t=0 and t=10? thank you again

I don’t understand your last question, please be more explicit about what you are trying to achieve.

I got a question that once-and-for-all increase in g at t=10 from 0.2 to 0.4. I don’t know if I should solve like to set a loop in my code.

This type of exercise cannot be satisfactorily performed using the so-called stochastic simulations. Those assume that you are solving the model in the vicinity of the (initial) steady state and that shocks are transitory. Moreover, in such a setup, Dynare assumes a steady state of zero for exogenous variables (so your g=0.2 is not actually honored).

If you are ready to abandon rational anticipations and to embrace perfect foresight, you can simulate a permanent shock using the perfect_foresight_solver command of Dynare. See my slides on deterministic models for more details.

it worked again. The information is really useful. And I still want to know how can I plot the equilibrium path and the steady state into one graph.
Thank you very much.

You can either use the rplot-command or use Matlab’s plotting tools to visualize the contents of oo_.endo_simul.

thank you very much! And I also wrote anther one that does’t work well. It seems that there no steady state, I don’t know how to solve it . Thank you again.twocou.mod (914 Bytes)