Tuesday, July 26, 2011

BRugs for Linux users

[See also more recent post regarding JAGS versions of the programs.]

A colleague (who prefers to remain anonymous) provided the following very informative message, which I have posted here with his permission:

After your inspiring tutorial at CogSci 2011, I pushed a bit further on Linux compatability. Martyn Plummer, the author of the related project JAGS, confirmed that both OpenBUGS and BRugs have been upgraded to work on Linux. The source and packaged binaries of OpenBUGS 3.2.1 are available for several distributions from http://www.openbugs.info/w/Downloads  and the BRugs 0.7.1 tarball from http://www.openbugs.info/w/UserContributedCode.  I installed on 32-bit Ubuntu 11.04, using

    wajig force openbugs_3.2.1-1_i386.deb

to override the unneeded dependency on libc6-i386, a package for providing 32-bit support for libc6 on a 64-bit installation. From the commandline, I then issued

     R CMD INSTALL BRugs_0.7.1.tar.gz

It compiled and installed cleanly. Starting R, I issued

      windows <- x11

to remap the output and then ran a couple of your scripts for testing:

      source("TutorialBRugsTest.R")

ran perfectly;

      source("ANOVAtwowayBRugsSTZ.R")

generated some errors due to a couple of restatements of windows() in the script -- these appear to be unnecessary and can be removed, or one can add the "windows <- x11" remapping after each occurrence. A global replace also fixes the problem:

    sed -i -r 's/windows/x11/' *R

A residual error is generated by savePlot's type="eps" (output to file):

    Error in match.arg(type) :
    'arg' should be one of “png”, “jpeg”, “tiff”, “bmp”

I'm guessing this is because my setup doesn't support eps output by default, but haven't investigated further. A quick fix is to replace with type jpg or png -- something like this should be safe:

    sed -i -r 's/(.*)(.eps)(.*type=\")(eps)(\".*)/\1.jpg\3jpg\5/' *.R

In short, OpenBUGS and BRugs work great on Linux, and your scripts encounter difficulties only with the output. For an overview, see http://rwiki.sciviews.org/doku.php?id=tips:graphics-misc:export.

I very much appreciate all the work you've done with Bayesian data analysis and will spend some time learning the methods you have developed.

Best wishes,
...

P.S. In the medium to long run, you may want to look into switching from OpenBUGS to JAGS (and from BRugs to rjags). OpenBUGS is written in Component Pascal, a dead language with no debugging support, while JAGS is written in standard C++ and is deservedly getting the lion's share of developer energy.

No comments:

Post a Comment