Workshop materials

Bayesian data analysis with JAGS and R


Software and materials for the workshop on "Bayesian analysis with JAGS and R" in Bhutan, from 11 to 23 September 2018.

Extra materials

Extra scripts for orangutan

New version of wiqid package

Group photo

Before the workshop

  1. Check your laptop specs!
    • Your computer should have a 64-bit processor and 4 or 8 'logical' cores. To check the number of cores available, open R and do: parallel::detectCores().
    • We will be generating some very large objects, so you will need at least 4 Gb of installed RAM, preferably 8 or 16 Gb.
    • Check your operating system: You can use Windows 7, 8 or 10 or a  Mac with OS X 10.11 (El Capitan) or later. If you have a Mac, you will need the XQuartz utility installed.
    • If you have problems with your operating system, see here for more information.
    • We will be doing a lot of heavy-duty number crunching, so if your laptop tends to overheat, you may need a cooling system.
  2. Check that you have recent versions of necessary software (see below).
  3. Prepare ONE PowerPoint SLIDE to introduce yourself and send to <workshops@bcss.org.my>. We'll put those together and show them during the introductions at the beginning of the workshop. The aspect ratio should be 4:3; go to Page Setup and select Slides sized for: On-screen Show (4:3).
  4. Download and preview the workshop materials (see below).
  5. Look through the R Skills Review again - both your answers and the suggested answers - and make sure you have these skills at your finger-tips.


You will need the following software installed on your laptop:

R, JAGS and rjags

  • You should have R 3.5.0 or later; 3.5.x is faster than previous versions; if you have an old version please install the newest.
  • You will also need JAGS 4.2.0 or later. Look for the download link just below the menu bar here.
  • Install the rjags package and check that it loads correctly: When you do library(rjags) you should get a message telling you that rjags has linked to JAGS 4.2.0 or 4.3.0.

Other R packages

  • You should have the following CRAN packages installed:
    install.packages(c("jagsUI", "AHMbook", "secr", "wiqid", "shiny", "loo", "rgdal", "devtools"))
  • Also install the makeJAGSmask and saveJAGS packages from Github with
    devtools::install_github(c("mikemeredith/makeJAGSmask", "mikemeredith/saveJAGS"))
  • If you have problems installing R packages, don't worry: we can fix this at the beginning of the workshop.

A text editor which shows line numbers

  • Error messages from JAGS specify the line number in the model file, and you won't want to count lines from the top. Notepad doesn't do this, but Notepad++ and RStudio do, and emacs has an option to show line numbers.

A spreadsheet program

  • You should have either LibreOffice Calc (which is free software) or Microsoft Excel. Other spreadsheet programs will likely work, provided they can open and save .csv files.

A PDF reader

  • You need a PDF Reader which allows you to annotate PDFs, such as Adobe Reader.


The outline schedule for the workshop is here (PDF, 27KB).

Click here to download the materials for days 1 to 3 (ZIP, 310KB)

Materials for days 4 to 10 include some very large files, so they will be distributed on USB drives at the workshop.

After downloading, extract the files and put them in a folder on your hard disk, eg, in My Documents. Don't put it on the Desktop as some programs can't easily access the desktop.

The instructor team

Ngumbang Juat, BCSS staff and gibbon researcher.

Lukmann Haqeem, senior researcher with WWF Malaysia.

Mike Meredith, BCSS and WCS, background in park and wildlife management.



Page updated 30 Aug 2018 by Mike Meredith