Steady state contains NAN or Inf

Hi,

I am on my first project with dynare. I have modified the Smets and Wouters (2007) model (SW07) with endogenous growth. My code seemed to work fine but now I want to add a variable to measure persistent effects on output and end up getting the Error: “The steady state contains NaN or Inf.” when trying to go for stoch_simul. I could narrow down the problem to two lines of code:

dy=y-y(-1)+gamma(-1)+ctrend;
YL =  y-y(-1) + YL(-1); //+gamma(-1);

The dy is the measurement equation from SW07 for later estimation. The YL is the persistent effect I want to measure. Later I would add gamma(-1) to measure the cumulative effect in from gamma. But to make sure it is not the errors cause I commented it out and leave only the first part which should just equal YL = y in a complicated way. When I leave either line out the code works. If both lines are in I get the error.
I put in resid(1) to check and the dy-equation was not zero but equalled ctrend, which never was a problem before.
Why do these two lines interfere? Thanx for any help.

P.S.:
When making YL a trending variable with a deflator very close to one the problem disappears.

trend_var (growth_factor = cgamma^0.001) TFP;
var (deflator=TFP) YL;

cgamma = 1.0043
US_SW07_EndG.mod (9.99 KB)

Someone else was already able to help me. Setting initival Values did the job, though I still dont really know why.

initval;
dy=ctrend;
end;

As ctrend is trend-growth in this model and thus the intercept of the otherwise stationary variable dy.

Unless you provide initial values in the initval block, Dynare takes them to be 0. But dy does not have a steady state of 0, but of the steady state growth rate ctrend. Hence, you should provide this value as the initial value.