I'm estimating a model using the metropolis algorithm, and I only want to do one block, so in my estimation call I have the parameter mh_nblocks=1.
When I run this the metropolis algorithm runs but then after it runs I get an error in line 711 in the metroplis.m file, which is:
trun = cumulated_number_of_simulations_per_file(nfile+1);
The error is because nfile is equal to -1, and so it is therefore trying to access entry 0 of cumulated_number_of_simulations_per_file, which doesn't exist.
I think that this is happening back on line 345 of metropolis.m.
Line 344 is:
files = eval(['dir(''' fname_ '_mh*.mat'');']);
When I run this with one block there is only ONE file in my directory matching that name. It is: mymodel_mh0.mat. Line 345 is:
nfile = size(files,1)-2;
So since files just has one file, then nfile is getting set to -1.
Why are we subtracting 2 from the size of files? It seems to me this will always cause the same problem. is this a bug? When I change the -2 to a -1 then nfile gets set to 0 and everything runs hunky dory. I'm just worried if that will screw up things in possibly other models in the future.
Hope someone can help or at least let me know if that's a known bug.
Thanks!
AS