The first problem in Bayesian analysis is generally how to install the software. We didn’t want to give advice on this in the book itself because requirements change from time to time. Here, we provide links to official advice so that you can hear it directly from the developers.

The book includes BUGS, JAGS, Stan, Stata, R packages including bayesmeta and brms, and JASP. On the website at present, we also include PyMC. We would be interested to hear from you if you have an interest in other software you want to interface from, such as Julia or Matlab, or other software that can do Bayesian inference, such as Turing.jl or MLwiN. If there is enough interest, we might add it, time permitting… You can email hello@bayesian-ma.net to tell us about any software that you would like to see covered here.
As an appendix to the book, we summarise the software differences in a table, which you can download here. We don’t think that we can guide you in a couple of minutes to choose software that’s right for you. Indeed, the first half of the book shows several options so that you can make your own mind up. Considerations are:
- Is it compatible with the rest of your software stack?
- How hard is it to learn?
- How flexible can it be?
- How unfamiliar is the syntax?
- Is there an active community or forum where I can ask questions and exhange ideas?
- How much harder or stranger is it to program a bespoke prior or likelihood?
Some things you absolutely should not consider (much) are:
- Is it what I already know?
- Is it what my professor / boss uses?
- Is it free?
- Will I sound cool for using it?
- Can I use it right now because I have to submit my paper by midnight?
Here, we include the most popular R and Python packages. Our list is not comprehensive. We also use the term GUI (graphical user interface) for a point-and-click interface, and “stand-alone application” for an executable program that opens as a window in your operating system.
BUGS
We’ll consider the stand-alone GUI WinBUGS, and some packages linking to WinBUGS or OpenBUGS from R, Python, and Stata.
WinBUGS is a 32-bit Windows application (you can’t use it on Mac or Linux). It still works but hasn’t been maintained for several years. Opinion is divided, but it is a reasonable option for learning Bayes. The website for all BUGS projects is hosted by the Medical Research Council Biostatistics Unit. You can download and install from there. Importantly, there is also a link there to BUGS Examples, which are a brilliant learning resource. The BUGS Book (CRC Press, of course) is also highly recommended, even if you have no intention of using BUGS!
If you are using OpenBUGS, you will definitely need an interface for R, Python, etc. WinBUGS also has some interface packages that will call it in the background.
R packages include the self-explanatory “R2WinBUGS” and “R2OpenBUGS”, both on CRAN (these will install the dependencies called “boot” and “coda”). There was an older package called “BRugs”, no longer maintained and now removed from CRAN.
JAGS
JAGS is stand-alone software and you can download it from sourceforge, where there are binary installers for Windows and Mac, and source code for compilation on other operating systems. You will then need an interface package (although it is possible to run it from the command line / terminal). R packages include “rjags” (programmed by the JAGS developer), “R2JAGS” (which calls “rjags”), and “runjags”. These R packages all have “coda” as a dependency.
In Python, there is a “pyjags” package, available through pip or other package managers. It claims to work easily with the visualisation package “arviz” (we haven’t tried it).
Stan
All the installation advice and downloads you need are at the Stan website. Follow the instructions slowly and carefully, and don’t make any assumptions.
There is a command line stand-along package called CmdStan. Few people work directly with CmdStan, though it is not hard to do. Some of the interfaces call CmdStan in the background, others contain all the Stan code within themselves. The advantage of going through CmdStan is twofold: updates to Stan are enacted in CmdStan first, so you get the benefit of new features and optimisations, also, wrapping up all the Stan code inside a package like RStan requires Stan, R, possibly an IDE like RStudio, and your operating system all to work nicely together. Little changes to any one of those could cause trouble (this happened in recent years with Windows 11, and Apple’s ARM chips). CmdStan-based interfaces avoid all this trouble by handing over your data and model to CmdStan, which runs lightweight and fast in the background.
If you work mostly in R, you can choose from two packages: “cmdstanr” or “rstan”. rstan wraps up all the code for Stan inside R. Installation of this has got a lot faster with pre-compiled packages in R version 4 and up, but on Windows, you may have to install a C++ compiler such as the one contained in Rtools. cmdstanr is a more lightweight package that calls CmdStan as described above.
Python users should work with “cmdstanpy”; there is a “PyStan” package but it is not actively maintained at present.
Stata users can go via a chunk of Python code (see Python integration on the Stata website) and then use CmdStanPy (we generally recommend this). However, if you don’t have the time, energy, or mental bandwidth to learn some Python syntax, or if you have an older version of Stata that does not have Python integration, there is a “stan” user-written command (written by Robert) on SSC, which is effectively CmdStanStata (if it were written today, it would be called that). You can get it in Stata by typing ‘ssc install stan’.
There are also interfaces for Julia, Matlab etc.
By the way, note it is Stan and never STAN.
Stata
Stata is a great choice for general-purpose data analysis software. It is a commercial product (which means you get customer support) but, unlike many others, it is relatively affordable, is extended by user-written commands, has an active community, and is largely open-source in that commands are written in its own languages.
When installed, Bayesian functionality necessary to do all the examples in the book and on this website is ready to go. If you wanted to interface to Stan, see above under Stan — though meta-analysis problems are small in both data and parameters, and should not require anything more than Stata’s RWMH or Gibbs sampler.
There are several user-written commands which fit non-Bayesian network and multivariate meta-analyses, which you might find useful, mostly written by Ian White. As Stata advances through future versions, some of this functionality is likely to be absorbed into the out-of-the-box Stata installation; we will try to keep this page up-to-date with this.
If you wanted to interface from an old version of Stata that does not have Bayesian functionality to BUGS, track down a copy of the (now out-of-print) book “Bayesian Analysis with Stata” by John Thompson. But you might also question the growing cost of patching together old software while your operating system moves on, and consider upgrading your Stata.
Like Stan, note it is Stata and never STATA, though apparently you can pronounce it how you like.
bayesmeta
This is an R package to do a limited range of Bayesian meta-analyses using approximate analytical expressions for the posteriors of theta and tau. Installation is via CRAN. There are several other packages that do some limited meta-analyses, but we can’t vouch for them.
brms
This is an R package; it stands for Bayesian Regression Modelling with Stan. Most people say it by spelling out the abbreviation, though some take the opportunity to make motorbike noises. Paul-Christian Bürkner, the lead developer, has a useful website with installation advice and vignettes.
“brms” can be installed from CRAN as usual, when it will install “rstan” if it is not already present (along with several other useful packages). brms translates your R regression style model specification into a Stan model file, then fires up “rstan” to compile it and sample from it. See notes above under Stan on the other software you will need (particularly in Windows PCs) for “rstan”.
If you are looking for brms software online, include “Bayesian” in your search to distinguish it from some unrelated corporate software with the same name.
JASP
JASP stands for Just Another Statistics Package; its original intention is to lure psychologists away from SPSS and to offer Bayesian alternatives to all the familiar methods they use. It is a freeware stand-alone GUI, and can be installed directly from the website.
JASP is a front-end to R, and uses various R packages to carry out its functions. Development is very active and, as the developers are also involved in meta-analysis topics such as model averaging for publication-bias-robust meta-analysis (RoBMA), we expect JASP to develop quickly and to be a very serious contender.
PyMC
PyMC is a Python package for Bayesian modelling that is extremely flexible and can use various sampling algorithms. Installation is through Anaconda, pip or other package managers. Instructions are on the website.
PyMC versions 4 and up use TensorFlow Probability as the backend package for fast numeric computation. Installing this dependency is only going to be a problem if you are trying to use a small and old, or wilfully obscure, computer.


Leave a Reply