Why this book?

To be completed. Why and what of capture-recapture data and models, with fields of application.1 Brief history of capture-recapture, with switch to state-space/hidden Markov model (HMM) formulation. Flexibility of HMM to decompose complex problems in smaller pieces that are easier to understand, model and analyse. From satellite guidance to conservation of endangered species. Why Bayes? Also three of my fav research topics – capture-recapture, HMM and Bayes statistics – let’s enjoy this great cocktail together.

Who should read this book?

This book is aimed at beginners who’re comfortable using R and write basic code (including loops), as well as connoisseurs of capture-recapture who’d like to tap into the power of the Bayesian side of statistics. For both audiences, thinking in the HMM framework will help you in confidently building models and make the most of your capture-recapture data.

What will you learn?

The book is divided into five parts. The first part is aimed at getting you up-to-speed with Bayesian statistics, NIMBLE, and hidden Markov models. The second part will teach you all about capture-recapture models for open populations, with reproducible R code to ease the learning process. In the third part, we will focus on issues in inferring states (dealing with uncertainty in assignment, modelling waiting time distribution). The fourth part provides real-world case studies from the scientific literature that you can reproduce using material covered in previous chapters. These problems can either i) be used to cement and deepen your understanding of methods and models, ii) be adapted for your own purpose, or iii) serve as teaching projects. The fifth and last chapter closes the book with take-home messages and recommendations, a list of frequently asked questions and references cited in the book. Likely to be amended after feedbacks.

What won’t you learn?

There is hardly any maths in this book. The equations I use are either simple enough to be understood without a background in maths, or can be skipped without prejudice. I do not cover Bayesian statistics or even hidden Markov models fully, I provide just what you need to work with capture-recapture data. If you are interested in knowing more about these topics, hopefully the section Suggested reading at the end of each chapter will put you in the right direction. There are also a number of important topics specific to capture-recapture that I do not cover, including closed-population capture-recapture models (Williams, Nichols, and Conroy 2002), and spatial capture-recapture models (Royle et al. 2013). These models can be treated as HMMs, but for now the usual formulation is just fine. There will be spatial considerations in the Covariates chapter w/ splines and CAR. I’m not sure yet about SCR models (R. Glennie’s Biometrics paper on HMMs and open pop SCR will not be easy to Bayes transform and implement in NIMBLE).


This book uses primarily the R package NIMBLE, so you need to install at least R and NIMBLE. A bunch of other R packages are used. You can install them all at once by running:

  "magick", "MCMCvis", "nimble", "pdftools", 
  "tidyverse", "wesanderson" 


To be completed.

How this book was written

I am writing this book in RStudio using bookdown. The book website is hosted with GitHub Pages, and automatically updated after every push by Github Actions. The source is available from GitHub.

The version of the book you’re reading was built with R version 4.1.0 (2021-05-18) and the following packages:

package version source
magick 2.7.3 CRAN (R 4.1.0)
MCMCvis 0.15.3 CRAN (R 4.1.0)
nimble 0.11.1 CRAN (R 4.1.0)
pdftools 3.0.1 CRAN (R 4.1.0)
tidyverse 1.3.1 CRAN (R 4.1.0)
wesanderson 0.3.6 CRAN (R 4.1.0)