An error after the MCMC

Dear all,

I recently encountered an everytime when I run the MCMC. I used the Dynare unstable version 2014-10-11. The error message is as follows. I have also attached the code for replicating the problem. It seems that when I set mh_replic as a small number, such as 2000, there is no problem. When mh_replic is relatively large, such as 20000, the problem arises. I changed to other unstable versions and the problem is still there. I am not sure if this is a bug in Dynare or something else.

Estimation::marginal density: I’m computing the posterior mean and covariance… Undefined function or variable “m1”.
Error in recursive_moments (line 50)
mu = m1;
Error in compute_mh_covariance_matrix (line 71)
[posterior_mean,posterior_covariance,offset] = recursive_moments(posterior_mean,posterior_covariance,x2(first_line:end,:),offset);
Error in marginal_density (line 53)
[posterior_mean,posterior_covariance,posterior_mode,posterior_kernel_at_the_mode] = compute_mh_covariance_matrix();
Error in dynare_estimation_1 (line 767)
[marginal,oo_] = marginal_density(M_, options_, estim_params_, …
Error in dynare_estimation (line 89)
Error in US_small_110_modefile (line 349)
Error in dynare (line 185)
evalin(‘base’,fname) ;
Error in RunDynare_US_small_824to082_110_modefile (line 14)
dynare US_small_110_modefile.mod

Thanks a lot!
Question in Dynare.rar (37.9 KB)

Thanks for reporting this bug. Replace your the file CutSample.m in the Dynare matlab-folder with the attached one and it should run.
CutSample.m (2.99 KB)

Dear Johannes,

It works now. Thank you for providing the bug-fixing file.