# R only alternatives to BUGS [closed]

I am following a course on Bayesian statistics using BUGS and R. Now, I already know BUGS, it's great but I am not really fond of using a separate program rather than just R.

I have read that there are a lot of new Bayesian packages in R. Is there a list or reference on which packages there are for Bayesian statistics and what these do? And, is there an R package alternative for the flexibility of BUGS?

## closed as off-topic by kjetil b halvorsen, Peter Flom♦Mar 10 at 13:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – kjetil b halvorsen, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

You can take a look at the MCMCglmm package that comes with very nice vignettes. There's a also a bayesglm() function for fitting Bayesian generalized linear models in the arm package, by Andrew Gelman. I've also heard of a future release blmer/bglmer functions for hierarchical modeling in the same package.

• In the package arm there is the fucntion bugs, which allows you to call bugs from R. That's what I use in my reasearch. In the Gelman's blog there is an example of caling winbugs by R. – Manoel Galdino Jun 6 '11 at 15:32

A few people I know have been using JAGS. The JAGS syntax is similar to BUGS.

• (+1 but I think the OP is after some pure R solution.) It works great with the rjags package, but we still need to specify our model in BUGS syntax in an external file. – chl Jun 6 '11 at 10:59

Second the Bayesian task view. I'd just add a vote for MCMCpack, a mature package which offers a variety of models. For the most part it's pretty well-documented too.

Performance is the main reason people use WinBUGS / OpenBUGS /JAGS vs. packages like MCMglmm. It is very hard not practical to write an efficient Gibbs sampler in native R. There are packages that let you run BUGS models from an R script, notably RBUGS and BUGSParallel.

• MCMCglamm is a bad example because "[a]ll simulation is done in C/ C++ using the CSparse library for sparse linear systems" (see abstract). – Bernd Weiss Jun 6 '11 at 13:03
• -1; see @Bernd. Most mature packages use compiled code. The main reason is actually that BUGS et al are more flexible in that they can fit more models. While this may lead to more efficient computation since an R package - even with compiled code - has to be more general, it may not. – JMS Jun 6 '11 at 15:00
• MCMCpack uses compiled C/C++ code, optimized for the task at hand, so it's actually faster than doing something in a generalized package like JAGS (for a particular task). – Wayne Mar 20 '12 at 20:20