Tuesday, September 2, 2014

Bayesian Inference, Step 1: Installing JAGS On Your Machine

Common complaint: "Bayesian analysis is too hard! Also, I have kidney stones."
Solution: Make Bayesian analysis accessible and efficient through freeware that anyone can use!

These days, advances in technology, computers, and lithotripsy have made Bayesian analysis easy to implement on any personal computer. All it requires is a couple of programs and a library of scripts to run the actual process of Bayesian inference; all that needs to be supplied by you, the user, is the data you have collected. Conceptually, this is no more difficult then entering in data into SAS or SPSS, and, I would argue, is easier in practice.

This can be done in R, statistical software that can interface with a variety of user-created packages. You can download one such package, JAGS, to do the MCMC sampling for building up distributions of parameter estimates, and then use those parameter estimates to brag to your friends about how you've "Gone Bayes."

All of the software and steps you need to install R, JAGS, and rjags (a program allowing JAGS to talk to R) can be found on John Kruschke's website here. Once you have that, it's simply a matter of entering in your own data, and letting the program do the nitty-gritty for you.


  1. Hi!
    I'd like to ask something off the topic if you don't mind... What is your computer set up? Do you run your analyses (not these blog demos but real ones) on your laptop, desktop or do you have a super computer/server? I am curious :) maybe a post about computer set up for neuroimagers ;) your blog is fantastic, thanks!

    1. Hey there,

      I run most of my actual analyses on a lab server running RedHat, which has worked pretty well for us. I do some simulations and small analyses on the Mac I use for demonstration purposes, but getting a little old (Mac OSX 10.6.8).

      Discussing computer setup for servers is beyond what I know, but I agree that would be useful. Maybe at some point...