Friday, September 24, 2010

Installing JAGS/rjags/R2jags

I got a new computer via a project. It is a Windows machine which is heavily administered, but they let me put Virtualbox on it, and naturally I have Ubuntu running on it so I can actually build the tools that let me do work. Times like this I am very glad I've been putting my installation notes for various packages on the blog since it saves me time searching all over the place (e.g. some gotchas on Eclipse and StatET (R-project))

For JAGS (Just Another Gibbs Sampler), there is an Ubuntu package of 1.0.2, but JAGS is at 2.0+. And the CRAN packages of rjags and R2jags are similarly behind. So I downloaded the source and installed them.

JAGS was simple. The usual combination of:

./configure

make


sudo make install


make installcheck


works as expected.

For rjags and R2jags I had to try a number of different configurations. I ended up with

sudo R --with-jags-modules=/usr/local/lib/JAGS/modules-2.1.0 CMD INSTALL rjags_2.1.0-10.tar.gz

sudo R --with-jags-modules=/usr/local/lib/JAGS/modules-2.1.0 CMD INSTALL R2jags_0.02-09.tar.gz

While I'm not entirely sure that sudo was necessary, prior to this I was getting in trouble with

Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared library '/home/louis/R/i486-pc-linux-gnu-library/2.10/rjags/libs/rjags.so':
libjags.so.2: cannot open shared object file: No such file or directory


So this did work. Source is Installing jags on 64-bit Debian by Roger Levy

No comments: