Hierarchical Bayes for R or Python

There are a few hierarchical models in MCMCpack for R, which to my knowledge is the fastest sampler for many common model types. (I wrote the [hierarchical item response][2] model in it.)

[RJAGS][3] does what its name sounds like. Code up a jags-flavored .bug model, provide data in R, and call Jags from R.


in python, try PyMC. There is an example of multilevel modeling with it here: http://groups.google.com/group/pymc/browse_thread/thread/c6ce37a80edf7f85/1bfd9138c8db891d


There's OpenBUGS and R helper packages. Check out Gelman's site for his book, which has most of the relevant links:

  • http://www.stat.columbia.edu/~gelman/software/
  • Example of computation in R and Bugs

On the Python side, I only know of PyMC:

  • http://code.google.com/p/pymc/
  • An example statistical model

EDIT: Added a link to the appropriate appendix from Gelman's book, available online, for an example using R and BUGS.


Here are four books on hierarchical modeling and bayesian analysis written with R code throughout the books.

Hierarchical Modeling and Analysis for Spatial Data (Monographs on Statistics and Applied Probability) (Hardcover) http://www.amazon.com/gp/product/158488410X

Data Analysis Using Regression and Multilevel/Hierarchical Models (Paperback) http://www.amazon.com/Analysis-Regression-Multilevel-Hierarchical-Models/dp/052168689X/ref=pd_sim_b_1

Bayesian Computation with R (Use R) (Paperback) http://www.amazon.com/Bayesian-Computation-R-Use/dp/0387922970/ref=pd_bxgy_b_img_c

Hierarchical Modelling for the Environmental Sciences: Statistical Methods and Applications (Oxford Biology) (Paperback) (I'm assuming this one has R code as both authors use R extensively)

I know some python books dabble in multivariate analysis (Collective Intelligence, for example) but I haven't seen any that really delve into bayesian or hierarchical modeling.