Page 1 of 1

code works well with some data but can't work one data set

PostPosted: Tue Jun 13, 2017 8:43 am
by Grant
Dear Prof. Pfeifer,

My code works with some countries's macro data. However, when I transfer to use China data, I encountered the following error:

Log data density [Laplace approximation] is NaN.

Error using chol
Matrix must be positive definite with real diagonal.

Error in posterior_sampler_initialization (line 84)
d = chol(vv);

Error in posterior_sampler (line 60)
posterior_sampler_initialization(TargetFun, xparam1, vv, mh_bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);

Error in dynare_estimation_1 (line 447)
posterior_sampler(objective_function,posterior_sampler_options.proposal_distribution,xparam1,posterior_sampler_options,bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);

Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);

Error in code (line 965)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 223)
evalin('base',fname) ;

Is it due to the poor measurement of China data? How can I fix the problem?

Your help is highly appreciated. I am looking forward to your reply. The code and data are attached here.

Re: code works well with some data but can't work one data s

PostPosted: Wed Jun 14, 2017 4:38 pm
by jpfeifer
Your observation equations are wrong. The model variables are mean 0, but the data is not, suggesting there is still a problem. Please read Pfeifer(2013): "A Guide to Specifying Observation Equations for the Estimation of DSGE Models" https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf.

Re: code works well with some data but can't work one data s

PostPosted: Thu Jun 29, 2017 10:44 am
by Grant
Dear Pfeifer:

Thanks for your reply. I have studied your guidance paper. Here is how I deal with the dataļ¼šfirst, I make sure all the data series are seasonally adjusted. Then, I log-difference all the data. Finally, I demeaned the data series. Since the model is written in log-linearized in the code, I think the way I deal with the data is correct. Is it right? Or anything else that I overlooked?

I am looking forward to your reply.

Re: code works well with some data but can't work one data s

PostPosted: Thu Jun 29, 2017 11:30 am
by jpfeifer
The variable c in your data set cannot be demeaned, because it is always positive.

Re: code works well with some data but can't work one data s

PostPosted: Fri Jun 30, 2017 10:42 am
by Grant
Dear Pfeifer:

Sorry about uploading the wrong data set. Now I have re-uploaded the code and data set, but it still cannot work out. Could you please help me check what the problem is?

I am looking forward to your reply. Thanks in advance.

Re: code works well with some data but can't work one data s

PostPosted: Tue Jul 04, 2017 12:42 pm
by jpfeifer
1. Have a look at your data. Why does pi_d1 have fluctuations of more than 150 percent?
2. Look at the mode_check plots. Most estimates are not at the mode.