[R] R vs. Bugs
peter.muhlberger at gmail.com
Sun Jun 22 18:34:26 CEST 2008
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
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.
More information about the R-help