Page 2 of 2
Re: The steady state contains NaN or Inf
Posted:
Fri Jun 16, 2017 8:55 am
by jpfeifer
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)
Re: The steady state contains NaN or Inf
Posted:
Fri Jun 16, 2017 9:12 pm
by qianq_1625
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
Re: The steady state contains NaN or Inf
Posted:
Sat Jun 17, 2017 3:16 pm
by jpfeifer
I keep repeating myself: what do the mode_check plots say?
Re: The steady state contains NaN or Inf
Posted:
Sat Jun 17, 2017 5:39 pm
by qianq_1625
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
Re: The steady state contains NaN or Inf
Posted:
Sun Jun 18, 2017 10:51 am
by jpfeifer
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
Re: The steady state contains NaN or Inf
Posted:
Tue Jun 20, 2017 5:17 pm
by qianq_1625
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
Re: The steady state contains NaN or Inf
Posted:
Wed Jun 21, 2017 9:15 pm
by jpfeifer
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.
Re: The steady state contains NaN or Inf
Posted:
Thu Jun 22, 2017 1:53 am
by qianq_1625
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
Re: The steady state contains NaN or Inf
Posted:
Thu Jun 22, 2017 8:08 am
by jpfeifer
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.
Re: The steady state contains NaN or Inf
Posted:
Fri Jun 23, 2017 5:54 pm
by qianq_1625
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
Re: The steady state contains NaN or Inf
Posted:
Fri Jun 23, 2017 6:02 pm
by jpfeifer
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.