In order to compute the posterior distribution of the theoretical moments of the endogenous variables, after estimation I run the following:

estimation(datafile=Data,mode_compute=0,mode_file=DSGE_mode,presample=0, prefilter=0, load_mh_file, mh_replic=0,moments_varendo);

but I get the following error message:

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 84)

[density(:,1),density(:,2)] = kernel_density_estimate(xx,number_of_grid_points,…

…

What is wrong?