Installing required software

The required software for these workshops are all free and open source and will run identically on Windows, Mac OS X, and Linux platforms.

There are six main pieces of software to install:

  • R: An environment for statistical computing.
  • Rstudio: An integrated development environment for using R.
  • tidyverse: A bundle of R packages to use R the modern way.
  • Miscellaneous R packages: Other vital, or just handy, R packages.
  • Stan: A Bayesian probabilistic modelling language.
  • brms: An R package to interface with Stan.

All of the above installation should be easy and painless except possibly for the installation of Stan, which can possibly be tricky because it is an external program and requires addition programming tools like c++ libraries and compilers etc. However, in the instructions below there are links to pages that provide ample detail on how to install and test Stan and all its dependencies.

Installing R

Go to the R website and follow the links for downloading. On Windows, this should lead you to

Downloading this and following the usual Windows installation process, you'll then have a full working version of R.

On Macs, the installation procedure is essentially identical. The latest Mac installer should be available at

Download this and follow the usual Mac installation process to get a full working version of R for Macs.

Installing Rstudio

Using Rstudio is not strictly necessary. You can do all you need to do with R without using Rstudio. However, many people have found that using R is more convenient and pleasant when working through Rstudio. To install it, go to the Rstudio website, specifically to

which will list all the available installers. Note that you just want the Rstudio desktop program. The Rstudio server is something else (basically it is for providing remote access to Rstudio hosted on Linux servers).

Again, you'll just follow the usual installation process for Windows or Macs to install Rstudio using these installers.

Installing the tidyverse packages

The so-called tidyverse is a collection of interrelated R packages that implement essentially a new standard library for R. In other words, the tidyverse gives us a bundle tools for doing commonplace data manipulation and visualization and programming. It represents the modern way to use R, and in my opinion, it's the best way to use R. All the tidyverse packages can be installed by typing the following command in R:

install.packages("tidyverse")

The main packages that are contained within the tidyverse bundle are listed here.

Installing Miscellaneous R packages

There are a bunch of other R packages that we either will, or just may, use. Here are there installation commands:

install.packages("rmarkdown")
install.packages("knitr")
install.packages("BayesFactor")
install.packages("MCMCglmm")
install.packages("lme4")

Installing Stan

Stan is a probabilistic programming language. Using the Stan language, you can define arbitrary probabilistic models and then perform Bayesian inference on them using MCMC, specifically using Hamiltonian Monte Carlo.

In general, Stan is a external program to R; it does not need to be used with R. However, one of the most common ways of using Stan is by using it through R and that is what we will be doing in this workshop.

To use Stan with R, you need to install an R package called rstan. However, you also need addition libraries installed in order for rstan to work.

For Windows, instructions for installing Stan for use with R can be found here:

and for Macs, it is

Installing brms

If the installation of R, Rstudio and Stan seemed to go fine, you can get the brms R package, which makes using Stan with R particularly easy when using conventional models.

To get brms, first start Rstudio (whether on Windows, Macs, Linux) and then run

install.packages('brms')

You can test the installation of brms with

library('brms')

If no errors are raised, you can assume the installation was successful.