Error in metropolis with mh_nblocks=1

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Error in metropolis with mh_nblocks=1

Postby shwayder » Wed May 14, 2008 2:35 am

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
shwayder
 
Posts: 7
Joined: Wed May 14, 2008 2:28 am
Location: Northwestern University

Re: Error in metropolis with mh_nblocks=1

Postby StephaneAdjemian » Thu May 15, 2008 10:18 am

Hi,

This looks like a bug... I will correct it as soon as possible. You should try with dynare version 4 instead (I think there is no problem in this case).

Best,
Stéphane.
StephaneAdjemian
 
Posts: 429
Joined: Wed Jan 05, 2005 4:24 pm
Location: Paris, France.

Postby shwayder » Thu May 15, 2008 11:03 pm

Thanks. I'll try it.

BTW I think this is specific to the Linux/Mac version. I got the same error running it on a Mac and a Linux machine. I however didn't get the error with the windows version. My guess is that maybe case sensitivity is different on windows vs. mac/linux?

Cheers,
AS
shwayder
 
Posts: 7
Joined: Wed May 14, 2008 2:28 am
Location: Northwestern University

Postby StephaneAdjemian » Fri May 16, 2008 8:25 am

Yes, windows is not case sensitive... When I wrote this file I was working under windows...

Best, Stéphane.


shwayder wrote:Thanks. I'll try it.

BTW I think this is specific to the Linux/Mac version. I got the same error running it on a Mac and a Linux machine. I however didn't get the error with the windows version. My guess is that maybe case sensitivity is different on windows vs. mac/linux?

Cheers,
AS
StephaneAdjemian
 
Posts: 429
Joined: Wed Jan 05, 2005 4:24 pm
Location: Paris, France.


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 8 guests