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

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.

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

Postby Grant » Tue Jun 13, 2017 8:43 am

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.
Attachments
data100.xls
(16.71 KiB) Downloaded 64 times
code.mod
(9.99 KiB) Downloaded 56 times
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

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

Postby jpfeifer » Wed Jun 14, 2017 4:38 pm

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.
------------
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: code works well with some data but can't work one data s

Postby Grant » Thu Jun 29, 2017 10:44 am

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.
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

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

Postby jpfeifer » Thu Jun 29, 2017 11:30 am

The variable c in your data set cannot be demeaned, because it is always positive.
------------
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: code works well with some data but can't work one data s

Postby Grant » Fri Jun 30, 2017 10:42 am

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.
Attachments
data100.xls
(36.5 KiB) Downloaded 63 times
code.mod
(9.93 KiB) Downloaded 58 times
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

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

Postby jpfeifer » Tue Jul 04, 2017 12:42 pm

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.
------------
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


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 5 guests