Re: [R] R vs. Bugs

From: Peter Muhlberg <>
Date: Sun, 22 Jun 2008 11:34:26 -0500

I've done some looking around in R and elsewhere to answer my question on the value of R vs. Bugs for MCMC. So, for anyone who is curious, here's what I think I've found: Bugs compiles its code, which should make it much faster than a pure R program. Packages such as AMCMC run MCMC in R, potentially with a user-defined C function for the density--which should make it comparable in speed to Bugs. The packages MCMCpack (MCMCmetrop1R function) and mcmc seem designed to run w/ a density function written in R. MCMCpack does have functions that use precompiled C code from the Scythe library (which looks nice), but I see no simple way to add a C density function. AMCMC and Bugs seem to use adaptive MCMC, but the other R packages don't appear to do so, which may mean another performance reduction.

I see no way to insert my own proposal density in the R functions. JAG, a Java-based version of BUGS, apparently allows users to create their own samplers, which might be a way to insert a different proposal density. Details about how to install a sampler are not given in the manual, which, incidentally, is nevertheless much better than the Bugs manual. Also, the proposal density I'd want would probably treat different variables differently, so I may need Metropolis within Gibbs, not standard Gibbs sampling. Can't get a clear picture of what JAG's algorithm(s) are--the manual doesn't mention Metropolis.

WinBugs and OpenBugs can't be made to run easily on Linux. It looks like WinBugs running under WINE might be the simplest viable configuration, though I don't know how well or quickly it runs under WINE or how much memory WINE ends up consuming.

Given all this, it may be easiest for my purposes to try to tweak the AMCMC code to allow a different proposal density. Maybe.

Peter mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sun 22 Jun 2008 - 17:41:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 23 Jun 2008 - 01:30:52 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive