The steady state contains NaN or Inf

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Re: The steady state contains NaN or Inf

Postby jpfeifer » Fri Jun 16, 2017 8:55 am

1. I don't understand this point. If there is a singularity caused by a missing equation, it usually does not go away for other parameter sets.
2. To start the MCMC, you usually need a positive definite Hessian. A positive definite Hessian indicates that you are at a maximum of the objective function. If that is not the case, estimation will crash at this stage. That's why I said you should look at the
Code: Select all
mode_check

plots.
3. Yes, in steady state
Code: Select all
y_obs=g_bar

Thus, you should indicate this in the initval block (or even better, a steady_state_model-block)
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: The steady state contains NaN or Inf

Postby qianq_1625 » Fri Jun 16, 2017 9:12 pm

Hi Professor,

With current parameter initial values, I'm able to run stoch_simul code successfully. So based on your suggestion, I guess my model setup should be correct. I also closely look at the matlab error message. It mentions that the parameters have wrong initial values. So I'm wondering if the inappropriate parameter initial values could cause non-positive hessian matrix. Thank you very much!

Eric
qianq_1625
 
Posts: 14
Joined: Sun Jun 04, 2017 12:22 am

Re: The steady state contains NaN or Inf

Postby jpfeifer » Sat Jun 17, 2017 3:16 pm

I keep repeating myself: what do the mode_check plots say?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: The steady state contains NaN or Inf

Postby qianq_1625 » Sat Jun 17, 2017 5:39 pm

Hi Professor,

Do you mind taking a look at my code? I checked the mode_check. It mentioned some parameters have negative variance. I'm not sure this is due to my initial values or my model setup. Thanks a lot!

Eric
Attachments
model_code_v8.rar
(9.72 KiB) Downloaded 47 times
qianq_1625
 
Posts: 14
Joined: Sun Jun 04, 2017 12:22 am

Re: The steady state contains NaN or Inf

Postby jpfeifer » Sun Jun 18, 2017 10:51 am

Please use Dynare 4.5. It will tell you
Code: Select all
ERROR: If the model is declared linear the second derivatives must be equal to zero.
       The following equations had non-zero second derivatives:
       * Eq # 18

Please fix this
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: The steady state contains NaN or Inf

Postby qianq_1625 » Tue Jun 20, 2017 5:17 pm

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
qianq_1625
 
Posts: 14
Joined: Sun Jun 04, 2017 12:22 am

Re: The steady state contains NaN or Inf

Postby jpfeifer » Wed Jun 21, 2017 9:15 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: The steady state contains NaN or Inf

Postby qianq_1625 » Thu Jun 22, 2017 1:53 am

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
qianq_1625
 
Posts: 14
Joined: Sun Jun 04, 2017 12:22 am

Re: The steady state contains NaN or Inf

Postby jpfeifer » Thu Jun 22, 2017 8:08 am

In that case, you need to use the demeaned consumption share as your observable and then use
Code: Select all
c_y_hat=c_hat-y_hat

as your observation equation where
Code: Select all
c_y_hat

is the observed data.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: The steady state contains NaN or Inf

Postby qianq_1625 » Fri Jun 23, 2017 5:54 pm

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
qianq_1625
 
Posts: 14
Joined: Sun Jun 04, 2017 12:22 am

Re: The steady state contains NaN or Inf

Postby jpfeifer » Fri Jun 23, 2017 6:02 pm

If you loglinearized everything, the data should be
Code: Select all
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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Previous

Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 12 guests