Error with Random Walk Metropolis algorithm, MCMC

Dear all,
I am trying to estimate a DSGE model and I would like to generate posterior statisctics of parameters( mean and standard deviation) by using random walk metropolis in Dynare 4.5.7.But I got the folowing error message

Error using chol
Matrix must be positive definite.

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 448)
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 cn_amend_7obs (line 448)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 235)
evalin(‘base’,fname) ;

I am looking forward for your help! thank you in advance. Please find attached the .m files of errors messages
Cordially
cn_amend_7obs.m (19.3 KB) dynare.m (8.3 KB) dynare_estimation.m (7.6 KB) dynare_estimation_1.m (37.3 KB) posterior_sampler.m (8.7 KB) posterior_sampler_initialization.m (24.7 KB)

You need to provide the mod-file and the data file.

Dear jpfeifer,
Thank you for your reply, please find attached the mod file and the data file.
cn_amend_7obs.mod (10.3 KB) data_nfbsop_54q307q2.m (16.9 KB)

Hi,

your data file is wrong. Is it intended that you are using commas? The decimal separator in Matlab is a point.

Thank you for your reply, i am sorry i forgot to put a point as a separator in Matlab. But even with the decimal seperator a point , i got the same error message with the commas data file. I got last thing in the output : Log data density [Laplace approximation] is NaN.
what is the meaning of that? and how can i correct the errors please?
please find attached the data file (with the decimal separator a point).
bellow the error message
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 448)
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 cn_amend_7obs (line 448)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 235)
evalin(‘base’,fname) ;

data_nfbsop_54q307q2.m (16.9 KB)

Dear jpfeifer, I am looking forward for your help please. Thank you.
cordially

Your data scaling seems wrong and inconsistent (division by 100, annualization of interest rates). Please read
Pfeifer (2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models ”.

Dear jpfeifer,
I have removed the scale and the annualization of interest rates but i still have the same error message. How can i correct this please?
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 448)
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 cn_amend_7obs (line 448)
oo_recursive_=dynare_estimation(var_list_);
Error in dynare (line 235)
evalin(‘base’,fname) ;

please find attached the modified data file. Thank you
data_nfbsop_54q307q2.m (17.8 KB)

Your data treatment for inflation and the interest rate still look wrong. Their mean looks very different from the corresponding model objects.

thank you for your answer dear jpfeifer, i would like to know
1/ what do you mean exactly by the model objects , which part in the code mod.file you refer?
2/ who can i adjust the code to my data to avoid the error message please?
Thank you

Your steady state of ffrobs is for example very different from the mean of ffrobs in the data.