# Introduction

WORK IN PROGRESS

This third part Case studies 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.

I have assembled a searchable list at https://oliviergimenez.github.io/curated-list-HMM-apps/ of HMM analyses of capture-recapture data to get inspiration. This list is not exhaustive, please get in touch with us if you’d like to add a reference.

Before we start with case studies, we’d like to give you a few pieces of advice. This is not rocket science. Just a few things based on our own experience of Bayesian capture-recapture analysis with HMM.

• Make your ecological question explicit. First things first. Make sure you’ve spent some to time to make your ecological question explicit. This step will help you to stay on course, and make the right choices. For example, it’s ok to use subsets of your data to address different questions.

• Now in terms of modeling. Don’t jump on your keyboard right away. Think of observations and states first. Spend some time thinking about your model with pen and paper. In particular make sure you have the observations and the states of your HMM. Then write down the observation and transition matrices on paper. Write down the transition matrix. You may act as if you had no imperfect detection. This is really what you’re after, the ecological process (survival, dispersal, etc). Proceed with the observation matrix.

• Start simple, all parameters constant for example. Make sure convergence is reached. When it comes to model fitting with NIMBLE, start simple. Consider all parameters constant. Make sure convergence is reached. Then add complexity one step at a time. Time effect for example, or random effects, or uncertainty in the assignment of states.

• Use simulations to better understand your model. When it comes to model building, consider simulating data to better understand your model. You will always learn something on your model by seeing it an engine to generate data, instead of estimating its parameters. The cool thing with NIMBLE is that you can you models to simulate data.

• Another advice, quite general in programming, is to not try to optimize your code. Or to try to make it elegant right away. Make it work first. Then think of optimization.

Hidden Markov models combined with the Bayesian framework are very flexible to analyse capture-recapture data. With the same data, you may ask further questions, sometimes you just need to consider different states. The limit is your imagination (and CPU time).