The steady state contains NaN or Inf

Hi Professor,

Thanks a lot! The equation #18 is one of my observation equations. The observation data is one of the great ratios in my data: c(t)/y(t). I’m currently having difficulty to write this equation in linear way.

My plan is:
Since I know both c(t) and y(t) have positive values and positive steady states, I simply take log on the variable.
So ln[c(t)/y(t)]=ln[c(t)]-ln[y(t)]=ln[c(t)/c_bar]-ln[y(t)/y_bar]+ln[c_bar/y_bar].
Eventually, I can have c/y_obs=ln[c(t)/y(t)]=c(t)_hat-y(t)_hat+ln[c_bar/y_bar], where c(t)_hat=ln[c(t)/c_bar] and y(t)_hat=ln[y(t)/y_bar].
In dynare, I have c_y_obs=c-y+ln(c_bar/y_bar) as the new equation #18.

Is this the correct way to write observation equation? Also I concern that if I write this way, the standard deviation would be based on ln[c(t)/y(t)], instead of c(t)/y(t).

I read the your document, but couldn’t find appropriate example for this case. Do you mind giving me some suggestions on this case? If I keep this nonlinear equation in my model block, and take the option “linear” off, will dynare log linearize the equation automatically? Thank you very much for your great help!

Eric

You need to consistently (log)linearize your model. If the rest of your model is loglinearized, then a purely multiplicative equation like c_y=c/y simply becomes c_y_hat=c_hat-y_hat. The question is now what you observe in the data. Because in the model, there will be no trend.

Hi Professor,

This variable is consumption to output ratio in my data. It have already been stationary. Are you saying I need to log linearize this variable by ln[c/y(t)/mean(c/y)] as my observation variable?
Thank you very much!

Eric

In that case, you need to use the demeaned consumption share as your observable and then use

as your observation equation where

is the observed data.

1 Like

Sorry Professor,

I’m still confused. When you say demean the ratio, do you mean: c_y(t)-mean(c_y) or** ln(c_y(t))-mean(ln(c_y))**? The latter one would generate much bigger standard deviation which might not be reasonable.
Can you make it more specifically? Thank you very much!!

Eric

If you loglinearized everything, the data should be

ln(c_y(t))-mean(ln(c_y))

That will obviously have a bigger standard deviation, because it measures the percentage deviations of the c/y ratio from its mean which is smaller than 1.

Hello professor,

I am facing a similar problem with no much clues of how to solve it.
Wher I run the program it returns me the “NaN of Inf” error message, I had a look at this forum and at your paper but I still don’t know either if I need to change the variables initval or the parameter calibration.
I attach the two files just in case, thanking you in advance for any usefull tips.

Kind regards,
MarcodataReplication.m (5.1 KB)
Replication.mod (36.1 KB)

p.s.
It seems like dynare did not get my estimated parameters, is it true? If so, how can I fix this?

You have various variables that you did not initialize. It seems that the value of 0 that is the default in this case is not allowed. Thus, you get the NaN. Given the size of your model, getting this right will be complicated. I would recommend starting with a simplified version.

Unfortunately I can’t change my model now, any tips about where to start looking for solutions?

Make sure that all variables are properly initialized.

Dear pfeifer,
Please I am facing the same problem of “The steady state contains NaN or Inf”,
But I always looking for the steady state part and I think that in the mod file all variables were initialized so from where the problem comes
Thanks for your help

cn_JEDC_replicacodes (1).zip (28.7 KB)