-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path0-preface.Rmd
105 lines (73 loc) · 9.22 KB
/
0-preface.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Preface {-}
## Why this book? {-}
The HMM framework has gained much attention in the ecological literature over the last decade, and has been suggested as a general modelling framework for the demography of plant and animal populations. HMMs are increasingly used to analyse capture-recapture data and estimate key population parameters (e.g., survival, dispersal, or recruitment) with applications in all fields of ecology. 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. The first objective of this book is to illustrate the flexibility of HMM to decompose complex problems in smaller pieces that are easier to understand, model and analyse.
In parallel, Bayesian statistics is well established and fast growing in ecology and related disciplines, because it resonates with the scientific reasoning and allows accommodating uncertainty smoothly. The popularity of Bayesian statistics also comes from the availability of free pieces of software (WinBUGS, OpenBUGS, JAGS, Stan) that allow practitioners to code their own analyses. The second objective of this book is to illustrate the use of the R package NIMBLE (@deValpine2017) to analyse capture-recapture data with HMM in a Bayesian framework. NIMBLE is seen by many as the future of Bayesian statistical ecology to deal with complex models and/or big data.
An important part of the book consists in case studies from published papers presented in a tutorial style to abide by the “learning by doing” philosophy. The third objective of this book is to provide reproducible analyses with code and data to teach yourself by example.
## Who should read this book? {-}
This book is aimed at beginners who're comfortable using R and write basic code, 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 three parts. The first part `Foundations` is aimed at getting you up-to-speed with Bayesian statistics, NIMBLE, and hidden Markov models. The second part `Transitions` will teach you all about capture-recapture models for open populations, with reproducible R code to ease the learning process. The 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. **Here say that the code is available on GitHub, and the data through a package `crdata`.**
<!-- 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. **To be amended, the book structure (and my ambitions) have changed a lot since this project has started.** -->
## What won't you learn? {-}
I won't lie, there is some maths in this book. However, 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 exhaustively, 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 [@WilliamsEtAl2002], spatial capture-recapture models [@RoyleEtAl2013book] and continuous models [@rushing2023continuouscr] (**I might end up writing a chapter on continuous models.**). These models can be treated as HMMs, but for now the usual formulation is just fine. These developments will be the subject of new chapters in a second edition, hopefully.
<!-- **There will be spatial considerations in the Case studies w/ splines and CAR. No SCR models (R. Glennie's Biometrics paper on HMMs and open pop SCR will not be easy to Bayes transform and implement in NIMBLE). No IPM. No continuous. Maybe for second edition haha.** -->
## Prerequisites {-}
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:
```{r, echo = FALSE, cache = FALSE}
deps <- desc::desc_get_deps()
pkgs <- sort(deps$package[deps$type == "Imports"])
pkgs2 <- strwrap(paste(encodeString(pkgs, quote = '"'), collapse = ", "), exdent = 2)
install <- paste0(
"install.packages(c(\n ",
paste(pkgs2, "\n", collapse = ""),
"))"
)
```
```{r code = install, eval = FALSE}
```
## How this book was written {-}
I wrote this book in RStudio <http://www.rstudio.com/ide/> using bookdown <http://bookdown.org/>. The book website <https://oliviergimenez.github.io/banana-book> is hosted with GitHub Pages <https://pages.github.com/>, and automatically updated after every push by Github Actions <https://github.com/features/actions>. The source is available from GitHub <https://github.com/oliviergimenez/banana-book>.
The version of the book you're reading was built with `r R.version.string` and the following packages:
```{r, echo = FALSE, results="asis"}
pkgs <- sessioninfo::package_info(pkgs, dependencies = FALSE)
df <- tibble(
package = pkgs$package,
version = pkgs$ondiskversion,
source = gsub("@", "\\\\@", pkgs$source)
)
knitr::kable(df, format = "markdown")
```
```{r, echo = FALSE}
ruler <- function(width = getOption("width")) {
x <- seq_len(width)
y <- dplyr::case_when(
x %% 10 == 0 ~ as.character((x %/% 10) %% 10),
x %% 5 == 0 ~ "+",
TRUE ~ "-"
)
cat(y, "\n", sep = "")
cat(x %% 10, "\n", sep = "")
}
```
```{r, include = FALSE}
ruler()
```
## About the author {-}
My name is Olivier Gimenez (<https://oliviergimenez.github.io/>). I am a senior (euphemism for not so young anymore) scientist at the National Centre for Scientific Research (CNRS; <https://www.cnrs.fr/en>) in the beautiful city of Montpellier, France.
I struggled studying maths, obtained a PhD in applied statistics a long time ago in a galaxy of wine and cheese. I was awarded my habilitation (<https://en.wikipedia.org/wiki/Habilitation>) in ecology and evolution so that I could stop pretending to understand what my colleagues were talking about. More recently I embarked in sociology studies because hey, why not.
Lost somewhere at the interface of animal ecology, statistical modeling and social sciences, my so-called expertise lies in population dynamics and species distribution modeling to address questions in ecology and conservation biology about the impact of human activities and the management of carnivores. I would be nothing without the students and colleagues who are kind enough to bear with me.
You may find me on Twitter/X (https://twitter.com/oaggimenez), GitHub (https://github.com/oliviergimenez), or get in touch by email at olivier|dot|gimenez|at|cefe|dot|cnrs|dot|fr.
## Acknowledgements {-}
Writing a book is quite an adventure, and a lot of people contributed to make this book a reality. I wish to thank:
+ Rob Calver, Sherry Thomas, Vaishali Singh and Kumar Shashi at Chapman and Hall/CRC.
+ Marc Kéry, Rachel McCrea, Byron Morgan and Etienne Prévost for their positive reviews of the book proposal I sent to Chapman and Hall/CRC, and their constructive comments and suggestions.
+ Marc Kéry for his precious pieces of advice on the process of writing.
+ Perry de Valpine, Daniel Turek, Chris Paciorek and Ben Goldstein for the `NIMBLE` and `nimbleEcology` R packages.
+ Colleagues who shared their data; See list at <https://github.com/oliviergimenez/banana-book#readme>
+ People who commented, corrected, offered pieces of advice; See list at <https://github.com/oliviergimenez/banana-book#readme>.
+ Yihui Xie for the `bookdown` R package.
+ Attendees of the workshops we run in relation to the content of this book (latest edition was in 2023, see <https://oliviergimenez.github.io/bayesian-hmm-cr-workshop-valencia/>)
+ Perry de Valpine, Sarah Cubaynes, Chloé Nater, Maud Quéroué and Daniel Turek for their help with running workshops in relation to the content of this book (2021 edition: https://oliviergimenez.github.io/bayesian-cr-workshop/; 2022 edition: https://oliviergimenez.github.io/hmm-cr-nimble-isec2022-workshop/).
+ Ruth King, Steve Brooks and Byron Morgan for the workshop on Bayesian statistics for ecologists we taught in Cambridge, the book we wrote together [@king_bayesian_2009], and their contribution to statistical ecology.
+ Jean-Dominique Lebreton, Roger Pradel and Rémi Choquet for the workshops on modelling individual histories with state uncertainty we taught over the years, and sharing their science of capture-recapture with me.
+ My family, including my mother, my parents-in-law for their kindness and hospitality, my amazing kids and wonderful wife for putting up with me while I was writing this book.