IPSA Summer School, Sao Paulo, February 2012
This class provides a practical introduction to Bayesian statistical
inference, with an emphasis on applications in the social sciences.
We will begin slowly, with a consideration of how Bayesian statistical
inference differs from classical or frequentist inference. We will
examine these differences in the context of simple statistical
procedures and models: e.g., one and two-sample t-tests, the
analysis of a two-by-two tables, one-way ANOVA, regression.
We then show how the explosion in desktop
computing power since the 1990s has made Bayesian approaches attractive for more
complex models. Specifically, the set of algorithms known as Markov
chain Monte Carlo (MCMC) allows researchers to tackle classes of
problems that used to fall in the ``too hard'' basket.
Today, MCMC is
well and truly part of the statistical computing toolkit available to
social scientists, and implemented in various forms in many different
software packages (we will survey some of these, see below). We will
examine how these algorithms make Bayesian inference feasible, their
strengths and weaknesses, and some of the pitfalls to avoid when
deploying MCMC algorithms.
We will use my text, Bayesian Analysis for the Social Sciences (Wiley, 2009; Amazon).
Please consult the errata
(last changed on
April 16 2013) and let me know if you see any more errors, typos etc.
- The rjags R package
- Brazilian legislative roll call data, analysis in ideal: R code Rdata object
- Monte Carlo analysis, difference of two binomial proportions: R; JAGS
- Regression; with posterior predictive density (election fraud in Pennsylvania state senate election): R; JAGS
- Multivariate t regression for compositional data (Example 6.9; UK House of Commons):
- R data rda; save to your computer; read into R with load("UKHouseOfCommons.rda")
- write-up PDF
- Blocking example (Example 6.3): R; JAGS (faster/blocked) JAGS (slower/unblocked)
- Missing data example (poking holes in the electoral fraud data set): R, JAGS.
- One-way Anova, presidential elections data:
- One-way hierarchical model (High school and Beyond data): data set 1, data set 2, data reader R, set for JAGS R, JAGS.
- Iraq war, use of force authorization in the U.S. Senate:
- Rock the Vote analysis R JAGS
- Ordinal logistic model (political information) R JAGS
- Ordinal logistic model, with hierarchical structure ("random effects" for interviewers) JAGS
- Factor analysis, social attributes of the 50 American states R JAGS
- Hierarchical version of factor analysis model, §9.2.5 JAGS
- Analysis of roll calls from the 110th U.S. Senate PDF
- Hierarchical version of the roll call model (Example 9.2) JAGS