Running time

[This article was first published on Gianluca Baio's blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Marta and I are doing some re-analysis of our Eurovision contest (some context here and here). We have slightly modified our original model (mostly, I have navigated the mess in Marta’s notation $-$ it’s OK: I’m not at risk of her mighty wrath, as I’ve already joked about this with her!). Also, we’ve included the latest data (in fact, we’re doing a little prediction as well, pretending that all the covariates are known, but the actual results aren’t).

Last time around, Marta ran the model using parallelisation (through the R package snowfall) in WinBUGS on her Windows desktop, at work. The model is relatively complex (see here for a working description), but thanks to parallelisation the running time was not too bad (as I recall, about 3 hours to run 11000 iterations with a burn-in of 1000 and thinning of 20).

This time, I decided I would get my hands dirty on my Linux machine(s). To start with, I thought I’d give it a go using R2jags and its new(-ish) function jags.parallel, which is supposed to run multiple instances of the MCMC process at once. Unfortunately, that didn’t work. I searched on line for some clue and found people sharing their common experiences. I don’t really know what’s failing, but JAGS complains that a node (which I’m actually passing as data) is not found.

So, thinking that running software natively rather than via emulation would be most efficient, I decided to install OpenBUGS and run the model using snowfall and R2OpenBUGS. This was better: I was able to check the model and load the data. But when it came to compiling the model, OpenBUGS took for ever $-$ I think for some reasons it was getting stuck with something. It was a bit surprising, as I thought that this would be a very robust and reliable alternative.

So, I decided to try and see how WinBUGS would do. I installed WINE and ran the model using R2WinBUGS and again through snowfall $-$ effectively replicating the exact procedure that Marta used last year. To my surprise, things have worked out quite OK and I shaved about an hour from Marta’s previous attempt (mainly through blocking of some of the parameters). 

To leave a comment for the author, please follow the link and comment on their blog: Gianluca Baio's blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)