Bayesian data analysis on a Mac

From enfascination

Jump to: navigation, search

specifically: Bayesian Data Analysis on a Mac with R and OpenBUGS via BRugs

Bayesian data analysis is a way of figuring out what you believe given what you just saw, but in math. R is a free computer language for calculating statistics. OpenBUGS is a flexible program for doing Bayesian data analysis. BRugs is a bridge between R and BUGS. Macs are why Steve Jobs wears black turtlenecks.

This post is solving a very narrow problem. R is cross-platform, but OpenBUGS only works on Windows. The same holds for most of the cousins of OpenBUGS, and most of the bridges between the cousins and R. So it is hard for Mac users to do Bayesian data analysis in R with the flexibility offered by BUGS.

My colleague Jack Harris has a fix that doesn't take any fiddling. Its great. If you know what you are doing, instructions are below. If you wish you knew what you were doing, read more.

Instructions for doing Bayesian Data Analysis on a Mac

  • Be a Mac user of R (if you aren't then you don't have a problem)
  • Download this.
  • Extract the tarball or (if you don't know what that means) hope that your computer magically turns the file into one that ends with .app .
  • Open the app, wait a bit. There will be a benign error, just hit OK.
  • After R loads, type
install.packages("Brugs")
setwd("~/whereeverthefilewent")
source("TutorialBRugsTest.R")

You should get pretty graphs. That means it worked. If you want more sample code, there is lots here. The folder lists the samples from Kruschke's book. The samples should all run fine if you download everything to one spot. The book has puppies on the cover to signal its friendliness to the 'fraid-of-math.