Error from MCMC R script

announcements (new versions, changes, bugs, installation problems...) related to program MARK

Error from MCMC R script

Postby Morten Frederiksen » Mon Jun 24, 2013 7:12 am

I've tried to use the R script provided in the MARK help file for processing the MCMC.bin file. However, something doesn't work. I get the following error:

> mcmcdata=create.mark.mcmc(filename,ncovs,nmeans,ndesigns,nsigmas,nrhos,nlogit,include=F);
Error in if (max(xmcmc[, 1]) != min(xmcmc[, 1])) { :
missing value where TRUE/FALSE needed
In addition: Warning message:
In matrix(whatread, ncol = nvals, byrow = T) :
data length [30000] is not a sub-multiple or multiple of the number of rows [70]

Any ideas on what the problem might be? The script doesn't seem to read the MCMC.bin file properly. The file is ~100 MB (3 chains), might that be an issue? I'm using MARK 6.2 and R 3.01.

Any help would be much appreciated!

Morten
Morten Frederiksen
 
Posts: 42
Joined: Thu May 29, 2003 4:53 am
Location: Roskilde, Denmark

Re: Error from MCMC R script

Postby cooch » Mon Jun 24, 2013 9:31 am

Morten Frederiksen wrote:I've tried to use the R script provided in the MARK help file for processing the MCMC.bin file. However, something doesn't work. I get the following error:

> mcmcdata=create.mark.mcmc(filename,ncovs,nmeans,ndesigns,nsigmas,nrhos,nlogit,include=F);
Error in if (max(xmcmc[, 1]) != min(xmcmc[, 1])) { :
missing value where TRUE/FALSE needed
In addition: Warning message:
In matrix(whatread, ncol = nvals, byrow = T) :
data length [30000] is not a sub-multiple or multiple of the number of rows [70]

Any ideas on what the problem might be? The script doesn't seem to read the MCMC.bin file properly. The file is ~100 MB (3 chains), might that be an issue? I'm using MARK 6.2 and R 3.01.

Any help would be much appreciated!

Morten



Error suggest problem involves handling multiple chains. To confirm, could you test with a single-chain only? If it works with a single chain, then...multiple chains is the issue.
cooch
 
Posts: 1628
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Error from MCMC R script

Postby Morten Frederiksen » Tue Jun 25, 2013 2:57 am

I tried with a much simpler example - smaller data set, simpler model. In this case, the script worked fine for both single and multiple chains (except I got an error trying to do the Gelman-Rubin test on multiple chains). But for the original example, where the model is more complex and the mcmc.bin file much larger, it still doesn't work.

Morten
Morten Frederiksen
 
Posts: 42
Joined: Thu May 29, 2003 4:53 am
Location: Roskilde, Denmark

Re: Error from MCMC R script

Postby jlaake » Tue Jun 25, 2013 1:54 pm

Morten-

The place where it is failing is the test whether there are multiple chains but based on the warning there was an error on the read prior to that step which caused the problem. This is really hard for me to debug because it is a binary file and I can't look at it easily and I didn't write the code that outputs the file. You can help by typing

debug(create.mark.mcmc)

then run the code and step through it and look at the results in each step to see if you can work it out. You can contact me offlist to see if we can figure it out. About the best I can do. Sorry.

What operating system are you using?

--jeff
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Error from MCMC R script

Postby Morten Frederiksen » Wed Jun 26, 2013 3:23 am

Thanks for advice Jeff. I've tried debugging as you suggest. Superficially, everything seems to run fine up to the step where the error message comes. However, I tried out some bits of the code during the while loop immediately preceding the point where the error message appears. The if statement which should test for multiple chains evaluates max(xmcmc[,1]) and min(xmcmc[,1]). In my case these come out as respectively 3.905714e+307 and -4.071529e+307 - that doesn't make much sense.

So it seems there's something wrong with the mcmc.bin file in this particular case. MARK didn't report any problems, and the text file spawned on completion looked fine. The only issue I can think of is that the MCMC run was on a different computer from where I'm running R (same operating system though - Windows 7).

All very mysterious - I may have to try and run the MCMC analysis again. That'll take a while, though!
Morten Frederiksen
 
Posts: 42
Joined: Thu May 29, 2003 4:53 am
Location: Roskilde, Denmark

Re: Error from MCMC R script

Postby jlaake » Wed Jun 26, 2013 11:01 am

Could one of the machines be 64 bit and the other 32 bit CPUs? With the values you are getting it looks like a mismatch on the binary file structure. Have you tried running the script on the machine that constructed the MCMC.bin file.

--jeff
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Error from MCMC R script

Postby Morten Frederiksen » Thu Jun 27, 2013 4:48 am

That's not it - they both run WIndows 7 64-bit. But I seem to have located the problem now: I get the error (consistently) when the MCMC analysis is run in MARK 6.2, but not in 6.1. Admittedly on two different machines, but with the same operating system and R version.

This may be one for Gary ...

Morten
Morten Frederiksen
 
Posts: 42
Joined: Thu May 29, 2003 4:53 am
Location: Roskilde, Denmark

Re: Error from MCMC R script

Postby jlaake » Mon Jul 01, 2013 11:02 am

To provide some closure to this, Morten said that it was limited to one machine although he has not ascertained the exact problem. You do need to be careful mixing 32 and 64 bit versions of MARK and R. Both come with 32 and 64 bit versions. If you mix them (32 mark with 64 R), then problems with binary files could occur.

If you are using RMark, it will use the version of markxx.exe (xx=32 or 64) that matches the version of R that you are using. However, if have renamed one of the versions to mark.exe that will over-ride that selection, so be careful.

--jeff
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA


Return to software problems/news

Who is online

Users browsing this forum: No registered users and 7 guests