Workshop materials

Bayesian data analysis with JAGS and R


Software and materials for the workshop on Bayesian analysis with JAGS and R at King Mongkut's University of Technology Thonburi (KMUTT), Thailand, from 3 to 14 July 2017.

Additional materials

Scripts for Wednesday 5 July (ZIP, 3KB)

Script we did Wednesday afternoon (ZIP, 3KB)

Scripts we did Saturday afternoon (ZIP, 5KB)

Useful links:

Blue ridge salamanders @ Wikipedia

Willow tits, the Swiss Breeding Bird Survey

Grand skinks in New Zealand

Khana Tiger Reserve



Before the workshop

  1. Check your laptop specs! Your computer should have 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.

    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 your operating system: You can use Windows 7, 8 or 10, provided it uses a 64-bit processor. You can use a Mac with OS X 10.9 (Mavericks) or later; if you have a Mac, you will need the XQuartz utility installed.
  3. Check that you have the current versions of necessary software: R 3.4.0 and JAGS 4.2.0. The version of R appears at the top of the console window when you open R; also check that you are running the 64-bit version of R. Doing library(rjags) will produce a message with the version of JAGS in use.
  4. Download and preview the workshop materials (see below).
  5. Prepare ONE PowerPoint SLIDE to introduce yourself and send to <stats.bcss@gmail.com>. 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).
  6. 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.4.0 or later; 3.4.0 is faster than previous versions; if you have an old version please install the newest. Update: R 3.4.1 was released on 30 June; if not on your local mirror, get it here.
  • You will also need JAGS 4.2.0. If necessary, use the new Windows installer, "JAGS-4.2.0-Rtools33.exe" as the "JAGS-4.2.0.exe" installer is not compatible with R 3.3.0 or later. This is not an issue with Mac or Linux.
  • 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.

Other R packages

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

A spreadsheet program

  • You should have either LibreOffice Calc (which is free software) or Microsoft Excel.

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, 123KB).

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

Click here to download the materials for days 4 to 6 (ZIP, 49KB)

Materials for days 7 to 10 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.

Many of the Bayesian analyses need long runs, sometimes several hours, to get good estimates. We have "precooked" these, but the files with the results are huge (totaling several GB) so will be distributed on USB drives at the workshop.

The instructor team

Ngumbang Juat, BCSS staff and gibbon researcher.

Lukmann Haqeem bin Alen ("Bob"), WWF Malaysia, orangutan field researcher in Sarawak.

Dr Dusit Ngoprasert, KMUTT lecturer, interested in large mammals and galliformes.

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



Page updated 9 July 2017 by Mike Meredith