Bayesian data analysis on a Mac

From enfascination

Jump to: navigation, search
Line 18: Line 18:
 
  source("TutorialBRugsTest.R")
 
  source("TutorialBRugsTest.R")
  
You should get pretty graphs.  That means it worked.  If you want more sample code, there is lots [http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/ here].  The folder lists the samples from [http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis 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.
+
You should get pretty graphs.  That means it worked.  If you want more, the samples from [http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis Kruschke's book] are [http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/ here].   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.

Revision as of 21:52, 9 March 2011

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 either for the cousins of OpenBUGS or for their bridges with 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 a book.

Instructions for using BRugs 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, the samples from Kruschke's book are here. 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.