# 4 Survival

WORK IN PROGRESS.

## 4.1 Introduction

Blabla. Blabla. Need to explain sensitivity analyses somewhere.

`knitr::include_graphics("images/lebreton.png")`

## 4.2 History of the Cormack-Jolly-Seber (CJS) model

S.T. Buckland (2016). A Conversation with Richard M. Cormack. Statistical Science 31: 142-150.

Bayesian uptake

## 4.3 What we’ve seen so far

For states (in gray), \(z = 1\) is alive, \(z = 2\) is dead.

For observations (in white), \(y = 1\) is non-detected, \(y = 2\) is detected

## 4.4 In the CJS model, survival and recapture are time-varying

Survival probability is \(\phi_t = \Pr(z_{t+1} = 1 | z_t = 1)\).

Recapture (detection) probability is \(p_t = \Pr(y_{t} = 1 | z_t = 1)\).

Accounts for variation in e.g. environmental conditions (survival) or sampling effort (detection).

## 4.8 294 dippers captured and recaptured between 1981 and 1987 with known sex and wing length

year_1981 | year_1982 | year_1983 | year_1984 | year_1985 | year_1986 | year_1987 | sex | wing_length |
---|---|---|---|---|---|---|---|---|

1 | 1 | 1 | 1 | 1 | 1 | 0 | M | 95 |

1 | 1 | 1 | 1 | 1 | 0 | 0 | F | 88 |

1 | 1 | 1 | 1 | 0 | 0 | 0 | M | 94 |

1 | 1 | 1 | 1 | 0 | 0 | 0 | F | 85 |

1 | 1 | 0 | 1 | 1 | 1 | 0 | F | 86 |

1 | 1 | 0 | 0 | 0 | 0 | 0 | M | 97 |

1 | 1 | 0 | 0 | 0 | 0 | 0 | M | 96 |

1 | 1 | 0 | 0 | 0 | 0 | 0 | M | 98 |

1 | 1 | 0 | 0 | 0 | 0 | 0 | M | 96 |

1 | 1 | 0 | 0 | 0 | 0 | 0 | F | 89 |

1 | 1 | 0 | 0 | 0 | 0 | 0 | F | 86 |

1 | 0 | 1 | 0 | 0 | 0 | 0 | M | 98 |

1 | 0 | 1 | 0 | 0 | 0 | 0 | F | 92 |

1 | 0 | 0 | 0 | 0 | 0 | 0 | M | 97 |

1 | 0 | 0 | 0 | 0 | 0 | 0 | M | 96 |

1 | 0 | 0 | 0 | 0 | 0 | 0 | M | 95 |

1 | 0 | 0 | 0 | 0 | 0 | 0 | M | 98 |

1 | 0 | 0 | 0 | 0 | 0 | 0 | M | 96 |

1 | 0 | 0 | 0 | 0 | 0 | 0 | F | 91 |

1 | 0 | 0 | 0 | 0 | 0 | 0 | F | 89 |

1 | 0 | 0 | 0 | 0 | 0 | 0 | F | 87 |

1 | 0 | 0 | 0 | 0 | 0 | 0 | F | 90 |

0 | 1 | 1 | 1 | 1 | 1 | 1 | F | 87 |

0 | 1 | 1 | 1 | 1 | 1 | 1 | F | 86 |

0 | 1 | 1 | 1 | 1 | 1 | 0 | F | 88 |

0 | 1 | 1 | 1 | 1 | 0 | 0 | M | 99 |

0 | 1 | 1 | 1 | 1 | 0 | 0 | F | 84 |

0 | 1 | 1 | 1 | 1 | 0 | 0 | F | 87 |

0 | 1 | 1 | 1 | 0 | 0 | 0 | M | 96 |

0 | 1 | 1 | 1 | 0 | 0 | 0 | F | 89 |

0 | 1 | 1 | 0 | 1 | 1 | 0 | F | 89 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | M | 97 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | M | 91 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | M | 98 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | M | 97 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | M | 94 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | M | 90 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | M | 93 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | F | 91 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | F | 84 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | F | 89 |

0 | 1 | 1 | 0 | 0 | 0 | 0 | F | 89 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 94 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 96 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 93 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 92 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 96 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 97 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 94 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 98 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 97 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 96 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | M | 98 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 88 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 88 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 88 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 86 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 93 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 85 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 88 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 88 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 86 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 88 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 88 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 89 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 86 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 88 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 88 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 84 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 87 |

0 | 1 | 0 | 0 | 0 | 0 | 0 | F | 88 |

0 | 0 | 1 | 1 | 1 | 1 | 1 | F | 89 |

0 | 0 | 1 | 1 | 1 | 1 | 1 | F | 87 |

0 | 0 | 1 | 1 | 1 | 1 | 0 | M | 96 |

0 | 0 | 1 | 1 | 1 | 1 | 0 | F | 85 |

0 | 0 | 1 | 1 | 1 | 0 | 0 | M | 98 |

0 | 0 | 1 | 1 | 1 | 0 | 0 | M | 94 |

0 | 0 | 1 | 1 | 1 | 0 | 0 | M | 94 |

0 | 0 | 1 | 1 | 1 | 0 | 0 | M | 99 |

0 | 0 | 1 | 1 | 1 | 0 | 0 | F | 90 |

0 | 0 | 1 | 1 | 1 | 0 | 0 | F | 86 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | M | 96 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | M | 97 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | M | 98 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | M | 93 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | M | 94 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | M | 97 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | M | 98 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | M | 96 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | F | 89 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | F | 88 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | F | 90 |

0 | 0 | 1 | 1 | 0 | 0 | 0 | F | 87 |

0 | 0 | 1 | 0 | 1 | 1 | 0 | M | 95 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 93 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 97 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 97 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 99 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 96 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 94 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 95 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 100 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 92 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 96 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | M | 97 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 88 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 89 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 91 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 90 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 88 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 91 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 89 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 87 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 90 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 84 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 86 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 86 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 87 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 89 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 88 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 85 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 90 |

0 | 0 | 1 | 0 | 0 | 0 | 0 | F | 86 |

0 | 0 | 0 | 1 | 1 | 1 | 1 | M | 98 |

0 | 0 | 0 | 1 | 1 | 1 | 1 | M | 100 |

0 | 0 | 0 | 1 | 1 | 1 | 1 | M | 94 |

0 | 0 | 0 | 1 | 1 | 1 | 1 | M | 97 |

0 | 0 | 0 | 1 | 1 | 1 | 1 | M | 96 |

0 | 0 | 0 | 1 | 1 | 1 | 1 | M | 95 |

0 | 0 | 0 | 1 | 1 | 1 | 1 | F | 85 |

0 | 0 | 0 | 1 | 1 | 1 | 1 | F | 85 |

0 | 0 | 0 | 1 | 1 | 1 | 0 | M | 93 |

0 | 0 | 0 | 1 | 1 | 1 | 0 | M | 99 |

0 | 0 | 0 | 1 | 1 | 1 | 0 | M | 95 |

0 | 0 | 0 | 1 | 1 | 1 | 0 | F | 86 |

0 | 0 | 0 | 1 | 1 | 1 | 0 | F | 85 |

0 | 0 | 0 | 1 | 1 | 1 | 0 | F | 92 |

0 | 0 | 0 | 1 | 1 | 1 | 0 | F | 89 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | M | 97 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | M | 92 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | M | 96 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | M | 95 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | M | 94 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | M | 95 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | F | 88 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | F | 88 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | F | 87 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | F | 87 |

0 | 0 | 0 | 1 | 1 | 0 | 0 | F | 87 |

0 | 0 | 0 | 1 | 0 | 1 | 1 | F | 88 |

0 | 0 | 0 | 1 | 0 | 0 | 1 | M | 96 |

0 | 0 | 0 | 1 | 0 | 0 | 1 | F | 87 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | M | 94 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | M | 92 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | M | 96 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | M | 95 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | M | 97 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | M | 95 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | F | 89 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | F | 89 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | F | 88 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | F | 88 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | F | 92 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | F | 88 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | F | 89 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | F | 88 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | F | 87 |

0 | 0 | 0 | 1 | 0 | 0 | 0 | F | 88 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | M | 94 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | M | 96 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | M | 94 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | M | 100 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | M | 95 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | M | 96 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | M | 97 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | M | 97 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | M | 95 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | M | 98 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | F | 87 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | F | 85 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | F | 87 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | F | 89 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | F | 87 |

0 | 0 | 0 | 0 | 1 | 1 | 1 | F | 91 |

0 | 0 | 0 | 0 | 1 | 1 | 0 | M | 96 |

0 | 0 | 0 | 0 | 1 | 1 | 0 | M | 97 |

0 | 0 | 0 | 0 | 1 | 1 | 0 | M | 95 |

0 | 0 | 0 | 0 | 1 | 1 | 0 | F | 86 |

0 | 0 | 0 | 0 | 1 | 1 | 0 | F | 87 |

0 | 0 | 0 | 0 | 1 | 1 | 0 | F | 88 |

0 | 0 | 0 | 0 | 1 | 1 | 0 | F | 90 |

0 | 0 | 0 | 0 | 1 | 1 | 0 | F | 90 |

0 | 0 | 0 | 0 | 1 | 1 | 0 | F | 88 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | M | 96 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | M | 98 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | M | 94 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | M | 98 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | M | 97 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | M | 97 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | M | 94 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | M | 98 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | M | 94 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | F | 89 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | F | 88 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | F | 89 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | F | 92 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | F | 91 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | F | 85 |

0 | 0 | 0 | 0 | 1 | 0 | 0 | F | 85 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 94 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 99 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 96 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 97 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 92 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 96 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 90 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 93 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 95 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 94 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 96 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | M | 96 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 87 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 87 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 86 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 87 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 90 |

0 | 0 | 0 | 0 | 0 | 1 | 1 | F | 91 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 95 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 98 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 95 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 96 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 99 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 98 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 91 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 94 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 96 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 99 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | M | 91 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 91 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 84 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 88 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 86 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 89 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 90 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 88 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 87 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 90 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 88 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 92 |

0 | 0 | 0 | 0 | 0 | 1 | 0 | F | 88 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 97 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 97 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 98 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 94 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 95 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 97 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 97 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 96 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 94 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 95 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 94 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 94 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 94 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 94 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 96 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 97 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | M | 95 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 86 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 87 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 90 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 90 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 91 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 90 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 86 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 90 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 90 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 90 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 92 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 86 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 89 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 88 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 90 |

0 | 0 | 0 | 0 | 0 | 0 | 1 | F | 93 |

## 4.9 Back to Nimble.

### 4.9.1 Our model so far \((\phi, p)\)

```
hmm.phip <- nimbleCode({
phi ~ dunif(0, 1) # prior survival
p ~ dunif(0, 1) # prior detection
# likelihood
gamma[1,1] <- phi # Pr(alive t -> alive t+1)
gamma[1,2] <- 1 - phi # Pr(alive t -> dead t+1)
gamma[2,1] <- 0 # Pr(dead t -> alive t+1)
gamma[2,2] <- 1 # Pr(dead t -> dead t+1)
delta[1] <- 1 # Pr(alive t = 1) = 1
delta[2] <- 0 # Pr(dead t = 1) = 0
omega[1,1] <- 1 - p # Pr(alive t -> non-detected t)
omega[1,2] <- p # Pr(alive t -> detected t)
omega[2,1] <- 1 # Pr(dead t -> non-detected t)
omega[2,2] <- 0 # Pr(dead t -> detected t)
for (i in 1:N){
z[i,first[i]] ~ dcat(delta[1:2])
for (j in (first[i]+1):T){
z[i,j] ~ dcat(gamma[z[i,j-1], 1:2])
y[i,j] ~ dcat(omega[z[i,j], 1:2])
}
}
})
```

### 4.9.2 Our model so far \((\phi, p)\)

```
## mean sd 2.5% 50% 97.5% Rhat n.eff
## phi 0.56 0.03 0.52 0.56 0.62 1.00 500
## p 0.89 0.03 0.83 0.89 0.94 1.13 273
```

### 4.9.3 The CJS model \((\phi_t, p_t)\)

```
hmm.phitpt <- nimbleCode({
delta[1] <- 1 # Pr(alive t = 1) = 1
delta[2] <- 0 # Pr(dead t = 1) = 0
for (t in 1:(T-1)){
phi[t] ~ dunif(0, 1) # prior survival #<<
gamma[1,1,t] <- phi[t] # Pr(alive t -> alive t+1)
gamma[1,2,t] <- 1 - phi[t] # Pr(alive t -> dead t+1)
gamma[2,1,t] <- 0 # Pr(dead t -> alive t+1)
gamma[2,2,t] <- 1 # Pr(dead t -> dead t+1)
p[t] ~ dunif(0, 1) # prior detection #<<
omega[1,1,t] <- 1 - p[t] # Pr(alive t -> non-detected t)
omega[1,2,t] <- p[t] # Pr(alive t -> detected t)
omega[2,1,t] <- 1 # Pr(dead t -> non-detected t)
omega[2,2,t] <- 0 # Pr(dead t -> detected t)
}
# likelihood
for (i in 1:N){
z[i,first[i]] ~ dcat(delta[1:2])
for (j in (first[i]+1):T){
z[i,j] ~ dcat(gamma[z[i,j-1], 1:2, j-1])
y[i,j] ~ dcat(omega[z[i,j], 1:2, j-1])
}
}
})
```

### 4.9.4 The CJS model \((\phi_t, p_t)\)

```
hmm.phitpt <- nimbleCode({
delta[1] <- 1 # Pr(alive t = 1) = 1
delta[2] <- 0 # Pr(dead t = 1) = 0
for (t in 1:(T-1)){ #<<
phi[t] ~ dunif(0, 1) # prior survival
gamma[1,1,t] <- phi[t] # Pr(alive t -> alive t+1)
gamma[1,2,t] <- 1 - phi[t] # Pr(alive t -> dead t+1)
gamma[2,1,t] <- 0 # Pr(dead t -> alive t+1)
gamma[2,2,t] <- 1 # Pr(dead t -> dead t+1)
p[t] ~ dunif(0, 1) # prior detection
omega[1,1,t] <- 1 - p[t] # Pr(alive t -> non-detected t)
omega[1,2,t] <- p[t] # Pr(alive t -> detected t)
omega[2,1,t] <- 1 # Pr(dead t -> non-detected t)
omega[2,2,t] <- 0 # Pr(dead t -> detected t)
} #<<
# likelihood
for (i in 1:N){
z[i,first[i]] ~ dcat(delta[1:2])
for (j in (first[i]+1):T){
z[i,j] ~ dcat(gamma[z[i,j-1], 1:2, j-1])
y[i,j] ~ dcat(omega[z[i,j], 1:2, j-1])
}
}
})
```

### 4.9.5 The CJS model \((\phi_t, p_t)\)

```
hmm.phitpt <- nimbleCode({
delta[1] <- 1 # Pr(alive t = 1) = 1
delta[2] <- 0 # Pr(dead t = 1) = 0
for (t in 1:(T-1)){
phi[t] ~ dunif(0, 1) # prior survival
gamma[1,1,t] <- phi[t] # Pr(alive t -> alive t+1) #<<
gamma[1,2,t] <- 1 - phi[t] # Pr(alive t -> dead t+1) #<<
gamma[2,1,t] <- 0 # Pr(dead t -> alive t+1) #<<
gamma[2,2,t] <- 1 # Pr(dead t -> dead t+1) #<<
p[t] ~ dunif(0, 1) # prior detection
omega[1,1,t] <- 1 - p[t] # Pr(alive t -> non-detected t)
omega[1,2,t] <- p[t] # Pr(alive t -> detected t)
omega[2,1,t] <- 1 # Pr(dead t -> non-detected t)
omega[2,2,t] <- 0 # Pr(dead t -> detected t)
}
# likelihood
for (i in 1:N){
z[i,first[i]] ~ dcat(delta[1:2])
for (j in (first[i]+1):T){
z[i,j] ~ dcat(gamma[z[i,j-1], 1:2, j-1])
y[i,j] ~ dcat(omega[z[i,j], 1:2, j-1])
}
}
})
```

### 4.9.6 The CJS model \((\phi_t, p_t)\)

```
hmm.phitpt <- nimbleCode({
delta[1] <- 1 # Pr(alive t = 1) = 1
delta[2] <- 0 # Pr(dead t = 1) = 0
for (t in 1:(T-1)){
phi[t] ~ dunif(0, 1) # prior survival
gamma[1,1,t] <- phi[t] # Pr(alive t -> alive t+1)
gamma[1,2,t] <- 1 - phi[t] # Pr(alive t -> dead t+1)
gamma[2,1,t] <- 0 # Pr(dead t -> alive t+1)
gamma[2,2,t] <- 1 # Pr(dead t -> dead t+1)
p[t] ~ dunif(0, 1) # prior detection
omega[1,1,t] <- 1 - p[t] # Pr(alive t -> non-detected t) #<<
omega[1,2,t] <- p[t] # Pr(alive t -> detected t) #<<
omega[2,1,t] <- 1 # Pr(dead t -> non-detected t) #<<
omega[2,2,t] <- 0 # Pr(dead t -> detected t) #<<
}
# likelihood
for (i in 1:N){
z[i,first[i]] ~ dcat(delta[1:2])
for (j in (first[i]+1):T){
z[i,j] ~ dcat(gamma[z[i,j-1], 1:2, j-1])
y[i,j] ~ dcat(omega[z[i,j], 1:2, j-1])
}
}
})
```

### 4.9.7 The CJS model \((\phi_t, p_t)\)

```
hmm.phitpt <- nimbleCode({
delta[1] <- 1 # Pr(alive t = 1) = 1
delta[2] <- 0 # Pr(dead t = 1) = 0
for (t in 1:(T-1)){
phi[t] ~ dunif(0, 1) # prior survival
gamma[1,1,t] <- phi[t] # Pr(alive t -> alive t+1)
gamma[1,2,t] <- 1 - phi[t] # Pr(alive t -> dead t+1)
gamma[2,1,t] <- 0 # Pr(dead t -> alive t+1)
gamma[2,2,t] <- 1 # Pr(dead t -> dead t+1)
p[t] ~ dunif(0, 1) # prior detection
omega[1,1,t] <- 1 - p[t] # Pr(alive t -> non-detected t)
omega[1,2,t] <- p[t] # Pr(alive t -> detected t)
omega[2,1,t] <- 1 # Pr(dead t -> non-detected t)
omega[2,2,t] <- 0 # Pr(dead t -> detected t)
}
# likelihood
for (i in 1:N){
z[i,first[i]] ~ dcat(delta[1:2])
for (j in (first[i]+1):T){
z[i,j] ~ dcat(gamma[z[i,j-1], 1:2, j-1]) #<<
y[i,j] ~ dcat(omega[z[i,j], 1:2, j-1]) #<<
}
}
})
```

### 4.9.8 The CJS model \((\phi_t, p_t)\)

```
## mean sd 2.5% 50% 97.5% Rhat n.eff
## phi[1] 0.73 0.14 0.46 0.72 0.99 1.02 199
## phi[2] 0.45 0.07 0.32 0.44 0.59 1.02 410
## phi[3] 0.48 0.06 0.35 0.48 0.59 1.01 506
## phi[4] 0.63 0.06 0.52 0.63 0.75 1.03 415
## phi[5] 0.60 0.06 0.49 0.60 0.72 1.01 365
## phi[6] 0.74 0.13 0.51 0.74 0.97 1.10 38
## p[1] 0.66 0.14 0.38 0.67 0.89 1.01 344
## p[2] 0.87 0.08 0.68 0.89 0.98 1.02 249
## p[3] 0.88 0.07 0.73 0.89 0.97 1.02 307
## p[4] 0.87 0.06 0.74 0.88 0.96 1.05 333
## p[5] 0.90 0.05 0.77 0.91 0.98 1.01 224
## p[6] 0.72 0.13 0.50 0.72 0.97 1.08 37
```

### 4.9.9 Time-varying survival \((\phi_t, p)\)

```
hmm.phitp <- nimbleCode({
for (t in 1:(T-1)){
phi[t] ~ dunif(0, 1) # prior survival
gamma[1,1,t] <- phi[t] # Pr(alive t -> alive t+1)
gamma[1,2,t] <- 1 - phi[t] # Pr(alive t -> dead t+1)
gamma[2,1,t] <- 0 # Pr(dead t -> alive t+1)
gamma[2,2,t] <- 1 # Pr(dead t -> dead t+1)
}
p ~ dunif(0, 1) # prior detection
delta[1] <- 1 # Pr(alive t = 1) = 1
delta[2] <- 0 # Pr(dead t = 1) = 0
omega[1,1] <- 1 - p # Pr(alive t -> non-detected t)
omega[1,2] <- p # Pr(alive t -> detected t)
omega[2,1] <- 1 # Pr(dead t -> non-detected t)
omega[2,2] <- 0 # Pr(dead t -> detected t)
# likelihood
for (i in 1:N){
z[i,first[i]] ~ dcat(delta[1:2])
for (j in (first[i]+1):T){
z[i,j] ~ dcat(gamma[z[i,j-1], 1:2, j-1])
y[i,j] ~ dcat(omega[z[i,j], 1:2])
}
}
})
```

]

### 4.9.10 Time-varying survival \((\phi_t, p)\)

```
## mean sd 2.5% 50% 97.5% Rhat n.eff
## phi[1] 0.63 0.10 0.42 0.63 0.82 1.04 564
## phi[2] 0.46 0.06 0.35 0.46 0.59 1.01 629
## phi[3] 0.48 0.05 0.37 0.48 0.59 1.00 610
## phi[4] 0.62 0.06 0.51 0.62 0.73 1.00 553
## phi[5] 0.61 0.05 0.50 0.61 0.72 1.00 568
## phi[6] 0.59 0.05 0.48 0.59 0.69 1.03 463
## p 0.89 0.03 0.82 0.89 0.95 1.04 211
```

### 4.9.11 Time-varying detection \((\phi, p_t)\)

```
hmm.phipt <- nimbleCode({
phi ~ dunif(0, 1) # prior survival
gamma[1,1] <- phi # Pr(alive t -> alive t+1)
gamma[1,2] <- 1 - phi # Pr(alive t -> dead t+1)
gamma[2,1] <- 0 # Pr(dead t -> alive t+1)
gamma[2,2] <- 1 # Pr(dead t -> dead t+1)
delta[1] <- 1 # Pr(alive t = 1) = 1
delta[2] <- 0 # Pr(dead t = 1) = 0
for (t in 1:(T-1)){
p[t] ~ dunif(0, 1) # prior detection
omega[1,1,t] <- 1 - p[t] # Pr(alive t -> non-detected t)
omega[1,2,t] <- p[t] # Pr(alive t -> detected t)
omega[2,1,t] <- 1 # Pr(dead t -> non-detected t)
omega[2,2,t] <- 0 # Pr(dead t -> detected t)
}
# likelihood
for (i in 1:N){
z[i,first[i]] ~ dcat(delta[1:2])
for (j in (first[i]+1):T){
z[i,j] ~ dcat(gamma[z[i,j-1], 1:2])
y[i,j] ~ dcat(omega[z[i,j], 1:2, j-1])
}
}
})
```

### 4.9.12 Time-varying detection \((\phi, p_t)\)

```
## mean sd 2.5% 50% 97.5% Rhat n.eff
## phi 0.56 0.03 0.52 0.56 0.61 1.02 381
## p[1] 0.75 0.12 0.48 0.77 0.93 1.03 452
## p[2] 0.85 0.08 0.68 0.86 0.97 1.02 359
## p[3] 0.85 0.07 0.69 0.85 0.96 1.00 316
## p[4] 0.89 0.05 0.77 0.89 0.97 1.00 412
## p[5] 0.91 0.04 0.82 0.92 0.98 1.00 376
## p[6] 0.90 0.07 0.73 0.91 1.00 1.07 111
```

## 4.11 Vague prior

So far, we have assumed a vague prior:

\[\phi_{prior} \sim \text{Beta}(1,1) = \text{Uniform}(0,1)\]

With a vague prior, mean posterior survival is \(\phi_{posterior} = 0.56\)

With credible interval \([0.52,0.62]\)

Posterior distribution of survival in color (two chains), prior in gray dashed line.

## 4.12 How to incorporate prior information?

Using information on body mass and annual survival of 27 European passerines, we can predict survival of European dippers using only body mass.

For dippers, body mass is 59.8g, therefore \(\phi = 0.57\) with \(\text{sd} = 0.073\).

Assuming an informative prior \(\phi_{prior} \sim \text{Normal}(0.57,0.073^2)\).

Mean posterior \(\phi_{posterior} = 0.56\) with credible interval \([0.52, 0.61]\).

No increase of precision in posterior inference.

## 4.13 How to incorporate prior information?

Now if you had only the three first years of data, what would have happened?

Width of credible interval is 0.53 (vague prior) vs. 0.24 (informative prior).

Huge increase of precision in posterior inference, a \(120\%\) gain!

## 4.14 Prior elicitation via moment matching

The prior \(\phi_{prior} \sim \text{Normal}(0.57,0.073^2)\) is not entirely satisfying

Remember the Beta distribution

Recall that the Beta distribution is a continuous distribution with values between 0 and 1. Useful for modelling survival or detection probabilities.

If \(X \sim Beta(\alpha,\beta)\), then the first and second moments of \(X\) are:

\[\mu = \text{E}(X) = \frac{\alpha}{\alpha + \beta}\]

\[\sigma^2 = \text{Var}(X) = \frac{\alpha\beta}{(\alpha + \beta)^2 (\alpha + \beta + 1)}\]

## 4.15 Moment matching

In the capture-recapture example, we know a priori that the mean of the probability we’re interested in is \(\mu = 0.57\) and its variance is \(\sigma^2 = 0.073^2\). Parameters \(\mu\) and \(\sigma^2\) are seen as the moments of a \(Beta(\alpha,\beta)\) distribution. Now we look for values of \(\alpha\) and \(\beta\) that match the observed moments of the Beta distribution \(\mu\) and \(\sigma^2\). We need another set of equations:

\[\alpha = \bigg(\frac{1-\mu}{\sigma^2}- \frac{1}{\mu} \bigg)\mu^2\]

\[\beta = \alpha \bigg(\frac{1}{\mu}-1\bigg)\]

For our model, that means:

```
(alpha <- ( (1 - 0.57)/(0.073*0.073) - (1/0.57) )*0.57^2)
## [1] 25.65
(beta <- alpha * ( (1/0.57) - 1))
## [1] 19.35
```

Now use \(\phi_{prior} \sim \text{Beta}(\alpha = 25.6,\beta = 19.3)\) instead of \(\phi_{prior} \sim \text{Normal}(0.57,0.073^2)\)

## 4.16 Prior predictive checks

## 4.17 Capture-recapture models rely on assumptions

Design: No mark lost, Identity of individuals recorded without error (no false positives), Captured individuals are a random sample

Model: Homogeneity of survival and recapture probabilities, Independence between individuals (overdispersion)

Test validity of assumptions: These assumptions should be valid, whatever inferential framework, Use goodness-of-fit tests — Pradel et al. (2005), `R`

implementation with package `R2ucare`

, Posterior predictive checks can also be used (not covered; Gelman et al. 2020). Forward reference to chapter with gof and model selection.

## 4.18 Parameter redundancy

Two issues

Intrinsic redundancy: Likelihood can be expressed by a smaller number of parameters; Feature of the model

Extrinsic redundancy: Model structure is fine, But lack of data makes a parameter non-estimable, Feature of the data.

## 4.21 What does survival actually mean in capture-recapture ?

Survival refers to the study area.

Mortality and permanent emigration are confounded.

Therefore we estimate apparent survival, not true survival.

Apparent survival probability = true survival × study area fidelity.

Consequently, apparent survival < true survival unless study area fidelity = 1.

Use caution with interpretation. If possible, combine with ring-recovery data, or go spatial to get closer to true survival.

## 4.23 Suggested reading

CJS state-space formulation Gimenez et al. (2007) and Royle (2008).

Work on missing values by Bonner et al. (2006) and Langrock and King (2013) and Worthington et al. (2015).

The example on how to incorporate prior information is in McCarthy and Masters (2005).

Combine live recapture w/ dead recoveries by Lebreton et al. (1999) and go spatial to account for emigration Gilroy et al. (2012) and Schaub & Royle (2014).

Non-identifiability in a Bayesian framework, see Gimenez et al. (2009) and book by Cole (2020).