Bayesian data analysis on a Mac
From enfascination
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.
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. That is the really narrow problem that this post is solving.
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. The linked-to book has puppies on the cover to signal its friendliness to the 'fraid-of-math.
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")
- Download this test file and type
setwd("~/whereeverthefilewent") source("TutorialBRugsTest.R")
You should get pretty graphs. That means it works. If you want more sample code, there is lots here. The folder lists the samples from Kruschke's book, and they should all run fine if you download everything to one spot.