# Moments\_varendo problem

**URL:** <https://forum.dynare.org/t/moments-varendo-problem/5288>\
**Category:** Dynare help (legacy posts)\
**Created:** [24 February 2016 07:26 UTC](https://forum.dynare.org/t/moments-varendo-problem/5288 "2016-02-24T07:26:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![econ86](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/d9b06d/32.png) [@econ86](https://forum.dynare.org/u/econ86)\
**Post date:** [24 February 2016 07:26 UTC](https://forum.dynare.org/t/moments-varendo-problem/5288/1 "2016-02-24T07:26:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [24 February 2016 09:03 UTC](https://forum.dynare.org/t/moments-varendo-problem/5288/2 "2016-02-24T09:03:42Z")

</div>

The crash itself seems to be a bug. Have you tried the unstable version?
