Code error

Dear Pfeifer,

My code can run and do the estimation, but when it almost comes to the end, it runs into the following error:

Estimation::compute_moments_varendo: I’m computing endogenous moments (this may take a while)… Subscript indices must either be real positive integers or logicals.

Error in kernel_density_estimate (line 82)
xi(indx+[1 2]) = xi(indx+[1 2]) + [1-temp,temp]’;

Error in posterior_moments (line 91)
[density(:,1),density(:,2)] = kernel_density_estimate(xx,number_of_grid_points,…

Error in covariance_mc_analysis (line 113)

Error in posterior_analysis>job (line 57)
oo_ = covariance_mc_analysis(SampleSize,‘posterior’,M_.dname,M_.fname,…

Error in posterior_analysis (line 38)
oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_,nvar,vartan);

Error in compute_moments_varendo (line 77)
oo_ = posterior_analysis(‘variance’,var_list_(i,:),var_list_(j,:),],options_,M_,oo_);

Error in dynare_estimation_1 (line 514)
oo_ = compute_moments_varendo(‘posterior’,options_,M_,oo_,var_list_);

Error in dynare_estimation (line 105)

Error in code (line 964)

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

Here attached the code and data. Please help me check where the problem is. Thank you in advance!

I am looking forward to your reply.
data100.xls (37 KB)
code.mod (9.89 KB)

Which Dynare version are you using?

Dear Peifer:

I am using the latest stable version, Dynare 4.5.

Thanks for reporting this bug. You can track the progress at

Dear Pfeifer,

Thanks for your help. Now the problem has been solved.