Category: Announcements and Resources, a.k.a. BayesWatch

Getting Set Up with Software

Throughout the term, we will be discussing code samples from two complimentary software packages / languages: R and JAGS (“Just Another Gibbs Sampler”). It would be helpful to have both of these up and running on your personal computers before we dive in (i.e., by Week 2, if possible). For the most part, setup of both is straightforward; most of you likely have R set up already. Having said that, I’ve run into enough trouble installing JAGS in the past (albeit in Linux) that I’m writing to point out some resources.

John Kruschke, from whom we will be reading for our week 2 meeting, has the best guide that I’ve found for installing the necessary packages. That guide is here. I recommend following it. In short, you’ll need to install three components:

  1. R (and, if you like, an IDE such as RStudio)
  2. JAGS, from the project’s SourceForge page
    1. For Linux, JAGS is also available from major distros’ repositories.
    2. JAGS has released three versions. If given the choice, I recommend installing JAGS3, since it’s most up-to-date.
  3. rjags, an R package that lets JAGS and R speak to each other. To install this, launch R, then run install.packages('rjags').

Notes on the installation process:

  • Make sure that R and JAGS are both working before attempting to install rjags. To do this, open a terminal, run R (i.e., type R, and press enter), and make sure that R loads (to exit, type quit()). Then try running jags and make sure that it launches, as well (to exit, you can use Ctrl+C).
  • Potential problems that may be unique to Linux (and, within Linux, may even be unique to openSUSE): If you try to install rjags and are getting error messages about files not being found, one of a few things is most likely wrong:
    • You don’t have a C++ compiler installed.
    • If you get an error message about a file called “console.h” not being available, you may need to install the jags-devel package in addition to the jags package.
    • You are not installing JAGS with superuser privileges (sudo R).
    • You may want to look at the post here, if all else has failed.

Feel free to comment on this post if you have questions or other tips to add. Good luck!

UPDATE: Rose has written up helpful additional Mac-specific instructions (as well as some additional instructions that should work cross-platform) here. Take a look at those, as well.