Does anybody do MCMC Sampling in R?

Have you done any MCMC sampling in R? Or, what programs to you use to do iterative sampling? How do you summarize the results? Just trust BUGS do everything?

Sometimes writing your own sampler may be inevitable. In our research there have been cases when BUGS just gets stuck. I’m writing an R program that should make writing samplers a semi-automatic task. Also I’m finishing the beta version of a random variable object class in R. Manipulating such objects instead of raw simulations should make Bayesian programming much more intuitive.

If you have any comments about your experiences about writing your own samplers and summarizing simulations, please leave a comment! Your comments will be helpful in developing the programs.

3 thoughts on “Does anybody do MCMC Sampling in R?

  1. I do write my samplers in R, typically in the Lexically Scoped style suggested by Gentleman and Ihaka (JCGS, 2000). I.e. a Gibbs sampler takes the form of

    make.sampler = function(X=#initialize X,Y=#initialize Y) {

    function(…) {

    X

  2. Erm, Moveable Type mangled my R code. Those X Y inside the second function should be drawing new X given Y and new Y given X with a global assignment to X and Y (i.e.

  3. Check out Quinn and Martin's MCMCpack library…. it uses C++ to speed all of the looping and they have some nice routines to automate the C++ to R parts of the coding.

Comments are closed.