Bayes with JAGS – a tutorial for wildlife researchers

Welcome to the BCSS tutorial on using JAGS and R to analyse wildlife data. We are just starting to put this together so please bear with us where it is incomplete.

Been here before? Check out the Recent Changes page.

Why Bayes?

The key reason for adopting Bayesian analysis for wildlife data analysis is that it provides useful information for management of wildlife and protected areas. Bayesian posterior probabilities can be used directly in formal decision-making methods. In contrast, frequentist methods based on p-values and null hypothesis significance testing (NHST) can give misleading information.

See Wade (2000) Bayesian methods in conservation biology. Conservation Biology, 14, 1308-1316 for an application to management of beluga whales in Alaska.


JAGS – together with WinBUGS, OpenBUGS and nimble – uses the BUGS language to code models. This allows biologists to write model code in a way which reflects their understanding of the mechanisms involved.

JAGS works across platforms – Windows, Mac and Linux – and is open source (written in C) and actively maintained. WinBUGS and OpenBUGS do not work on all platforms. They are built on proprietary software which is no longer maintained.

nimble is a relatively new development; we do not include it here (yet!) as we have little experience using it.

Stan is another new package for Bayesian analysis, but it does not use the BUGS language and cannot easily handle the binary latent variables which are so common in wildlife models (eg, present/absent, dead/alive, captured/not captured).

Subject matter

Bayesian analysis is used in a very wide variety of fields from image recognition to genetics. This tutorial focuses on topics relevant to management of animal populations: where species occur, the density or abundance of a population, survival, and community composition.

These share one key feature: our data are imperfect as we do not detect every animal. We need to model the detection process as well as the biological process we are interested in, leading inevitably to hierarchical models.

Author, acknowledgements, IPR

Most of the text for this tutorial was written by Mike Meredith, but incorporates many suggestions and comments from instructors and participants on our real-life “Bayes with JAGS” workshops. As with other BCSS materials, this is made available under a CC-BY-4.0 licence.

Next: Using this tutorial, Contents page

10 thoughts on “Bayes with JAGS – a tutorial for wildlife researchers”

  1. It looks like the “Bayes workshop” packaged into a blogpost. Nice work nonetheless guys.

    1. That’s the idea Bob! Folks don’t have to wait until we run a JAGS workshop before they can get started.

  2. This is great! Will this be made available for everyone or only for those who registered for the stats bootcamps or JAGS workshops?

    Great job!

    1. Thanks Akchou! It will be available for everyone — once we get a bit more meat onto the bones!

  3. Mike, I have really benefited from your experience with JAGS and SCR analyses. Your blog posts are spot on.

  4. Hello!

    I have a question. How the Distance sampling method matches the tutorials?. Researchers use this to estimate population abundance through the following parameters: group counts, distances to the center or first individual, transect length, and effective sampling area. We generally use DISTANCE software (sorry to not be updated). It is been a while since I work with these subjects.


    1. Distance sampling data can be analysed in JAGS, though you do have to model encounter rate. Lots of literature on this for more advanced models, eg, Buckland et al (2015) Distance sampling: Methods and applications. Kéry & Royle (2016) Applied Hierarchical Modeling in Ecology vol.1 have 2 chapters on hierarchical distance sampling and more in vol 2 (2021).

      I’ve spent hundreds of days in the forest collecting distance-sampling data. Great fun, but useless, since we can’t meet the basic assumptions in forests where animals are hunted. We could include it in the tutorial, but not a priority at the moment.

Leave a Reply

Your email address will not be published. Required fields are marked *

The maximum upload file size: 1 MB. You can upload: image, document, text, archive.