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

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)

Error in dynare_estimation (line 105)

Error in code (line 965)

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.
data100.xls (16.7 KB)
code.mod (9.99 KB)

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”

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.

The variable c in your data set cannot be demeaned, because it is always positive.

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.
data100.xls (36.5 KB)
code.mod (9.93 KB)

  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.