Bayesian Data Analysis, CogSci 2010
Doing Bayesian data analysis with R and BUGS
This page updated July 26, 2010.
 |
Figure
1. Why you should attend the tutorial. (Notice that the
Bayesian analysis reveals many credible regression lines, for which
the slopes and intercepts trade off, instead of just one "best"
line.) |
This full-day tutorial shows you how to do Bayesian data analysis,
hands on. The software is free; see installation instructions, below, before arriving at the
tutorial. The intended audience is grad students and other
researchers who want a ground-floor introduction to Bayesian data
analysis. No mathematical expertise is presumed. If you can handle a
few minutes of summation notation like
Σixi and integral notation like
∫ x dx, you're good to go. Complete computer programs
will be worked through, step by step.
Schedule of Topics:
Room B113-114
- 9:00-10:30 Bayes' Rule, Grid Approximation, and R.
10:30-11:00 Break (Accompanied by frantic scurrying back to
internet-enabled hotel rooms by people who didn't download the
software before arriving at the non-internet enabled
tutorial room. See installation instructions below, before arriving.)
- 11:00-12:30 Markov Chain Monte Carlo and BUGS.
12:30-1:30 Lunch (on your own)
- 1:30-3:00 Linear Regression and Hierarchical Models.
3:00-3:30 Break
- 3:30-5:00 Bayesian ANOVA and Power Analysis.
Bayesian data analysis is not Bayesian modeling of
cognition. Data analysis involves "generic" descriptive models
(such as linear regression) without any necessary interpretation as
cognitive computation. The rational way to estimate parameters in
descriptive models is Bayesian, regardless of whether or not Bayesian
models of mind are viable.
Why go Bayesian? See Figure 1. For a more serious,
yet brief discussion of several benefits of Bayesian data analysis,
along with an example and an emphasis that Bayesian data analysis is
not Bayesian modeling of mind, see this article from
Trends in Cognitive Sciences. For a lengthier exposition
that explains a fatal flaw of 20th century null hypothesis
significance testing, along with a discussion of Bayesian null
hypothesis testing and other examples, see this article from Wiley
Interdisciplinary Reviews: Cognitive Science.
Who is the instructor? John
Kruschke has taught introductory Bayesian statistics to graduate
students for several years (and traditional statistics and
mathematical modeling for over 20 years). He is five-time winner of
Teaching Excellence Recognition Awards from Indiana University, where
he is Professor of Psychological and Brain Sciences, and Adjunct
Professor of Statistics. He has written an introductory textbook on
Bayesian data analysis, to be published in November 2010; see also the
articles linked above. His research interests include models of
attention in learning, which he has developed in both connectionist
and Bayesian formalisms. He received a Troland Research Award from the
National Academy of Sciences. He chaired the Cognitive Science
Conference in 1992.
Before arriving at the tutorial,
you must install the software listed below on your notebook
computer, because there will not be any internet service
available in the tutorial room.
- One of the packages we'll be using requires the Windows
operating system (OS). If your machine can operate with Windows,
the tutorial materials may operate best that way. If you are using
Macintosh OS or Linux without the option to boot with Windows, you
must install a Windows emulator such as the freeware
WINE (which stands for WINE Is Not an Emulator). WINE can be
downloaded from http://www.winehq.org/. From this point on, these
instructions assume you are running Windows or a Windows
(non-)emulator.
- Install the free programming language R. Go to http://cran.r-project.org/. In the box labelled
"Download and Install R" click the "Windows" link. On the page
that appears, click the "base" link. The next page that appears
has the latest version of R as its top link. Click that link and
follow the installation instructions. (Even if you are using MacOS or
Linux, download the Windows executable and install R within WINE!)
- Invoke R. (If you are using MacOS or Linux, invoke the Windows
version of R within WINE.) At the command line in the R console
window, type
install.packages("BRugs") You must
include the quotes around "BRugs", and type "BR" in uppercase and
everything else in lowercase. You will be prompted to select an
internet repository; choose a site that is geographically near you.
Note: You must be using a recent version of R, preferably version
2.11.0 or later, for the install.packages("BRugs") command to work
properly. Are you getting an error message that the package is not
available? If so, try this: In the R console window, click menu items
Packages > Select Repositories, and, in the resulting pop-up window,
make sure to select both CRAN and CRAN(extras), then click
okay. BRugs lives in CRAN(extras). Then try install.packages("BRugs")
again. Thanks to Uwe Ligges for these hints!
- Copy the following data analysis program to your computer and
be sure that it runs. Right click this link and save the linked file on your
computer, using any file name with a ".R" extension. Then, invoke R,
and on the R console window click the menu items File >
Source R code... Browse to your saved file and
select it (and click Open or OK). The program should run in R and
produce a graph in a new window and some output text in the R console.
If the program does not run, please study all the previous steps
and be sure that each was successfully accomplished.
- Download this
zip file of data analysis programs. (This link updated on July 26,
2010.)
|
This page URL:
http://www.indiana.edu/~jkkteach/TutorialCogSci2010.html