13

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?

Sacha Epskamp
  • 287
  • 1
  • 13

5 Answers5

9

Bayesian CRAN task view

Eduardo Leoni
  • 579
  • 4
  • 8
8

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.

chl
  • 50,972
  • 18
  • 205
  • 364
  • 2
    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 06 '11 at 15:32
6

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

csgillespie
  • 11,849
  • 9
  • 56
  • 85
  • (+1 but I think the OP is after some pure R solution.) It works great with the [rjags](http://cran.r-project.org/web/packages/rjags/index.html) package, but we still need to specify our model in BUGS syntax in an external file. – chl Jun 06 '11 at 10:59
5

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.

JMS
  • 4,660
  • 1
  • 22
  • 32
0

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.

Jeff Hall
  • 17
  • 1
  • 1
    `MCMCglamm` is a bad example because "[a]ll simulation is done in C/ C++ using the CSparse library for sparse linear systems" (see [abstract](http://cran.r-project.org/web/packages/MCMCglmm/vignettes/Overview.pdf)). – Bernd Weiss Jun 06 '11 at 13:03
  • 1
    -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 06 '11 at 15:00
  • 2
    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