class: center, middle, inverse, title-slide # Lecture 15 ## Multi-state models ###
WILD6900 (Spring 2020) --- ## Readings > ### Kéry & Schaub 264-313 --- ## What is a "state" #### Alive/dead - CJS model -- #### Occupied/unoccupied - Occupancy model -- #### Geographic location (location `\(1, 2, ...,S\)`) -- #### Un-infected/infected/dead -- #### Age class -- #### Any combination of above states* .footnote[ *At least in theory ] --- ## Two states #### State model <img src="figs/cjs1.png" width="75%" style="display: block; margin: auto;" /> <br/> <br/> <br/> <br/> <br/> <br/> <br/> `$$\Large z_{i,t} \sim Bernoulli(z_{i,t-1}\phi)$$` --- ## Two states #### Observation model <img src="figs/cjs2.png" width="75%" style="display: block; margin: auto;" /> <br/> `$$\Large y_{i,t} \sim Bernoulli(z_{i,t}p)$$` --- ## Three states #### State model <img src="figs/multi_state.png" width="75%" style="display: block; margin: auto;" /> --- ## Three states #### State model <img src="figs/multi_state2.png" width="75%" style="display: block; margin: auto;" /> --- ## Three states - example #### Movement between two sites --- ## Three states - example #### Movement between two sites <img src="figs/ms_AB.png" width="50%" style="display: block; margin: auto;" /> - `\(\large \phi_A\)`: Probability alive at site A - `\(\large \phi_B\)`: Probability alive at site B - `\(\large \psi_{AB}\)`: Probability of moving from site A to site B - `\(\large \psi_{BA}\)`: Probability of moving from site B to site A --- ## Three states - example #### State model .left-column[ <br/> <br/> <br/> #### True state at time *t* ] .right-column[ <center> #### True state at time *t + 1* </center> <table class="table table-striped table-hover table-condensed table-responsive" style="font-size: 14px; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:center;"> </th> <th style="text-align:center;"> Site A </th> <th style="text-align:center;"> Site B </th> <th style="text-align:center;"> Dead </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> Site A </td> <td style="text-align:center;"> \(\phi_A (1 - \psi_{AB})\) </td> <td style="text-align:center;"> \(\phi_A \psi_{AB}\) </td> <td style="text-align:center;"> \(1 - \phi_A\) </td> </tr> <tr> <td style="text-align:center;"> Site B </td> <td style="text-align:center;"> \(\phi_B \psi_{BA}\) </td> <td style="text-align:center;"> \(\phi_B (1 - \psi_{BA})\) </td> <td style="text-align:center;"> \(1 - \phi_B\) </td> </tr> <tr> <td style="text-align:center;"> Dead </td> <td style="text-align:center;"> 0 </td> <td style="text-align:center;"> 0 </td> <td style="text-align:center;"> 1 </td> </tr> </tbody> </table> ] --- ## Three states - example #### Observation model .left-column[ <br/> <br/> <br/> #### True state at time *t* ] .right-column[ <center> #### Observation at time *t* </center> <table class="table table-striped table-hover table-condensed table-responsive" style="font-size: 14px; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:center;"> </th> <th style="text-align:center;"> Site A </th> <th style="text-align:center;"> Site B </th> <th style="text-align:center;"> Not Seen </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> Site A </td> <td style="text-align:center;"> \(p_A\) </td> <td style="text-align:center;"> 0 </td> <td style="text-align:center;"> \(1 - p_A\) </td> </tr> <tr> <td style="text-align:center;"> Site B </td> <td style="text-align:center;"> 0 </td> <td style="text-align:center;"> \(p_B\) </td> <td style="text-align:center;"> \(1 - p_B\) </td> </tr> <tr> <td style="text-align:center;"> Dead </td> <td style="text-align:center;"> 0 </td> <td style="text-align:center;"> 0 </td> <td style="text-align:center;"> 1 </td> </tr> </tbody> </table> ] --- ## Three states - example #### The data - `\(1 =\)` Seen alive at site A - `\(2 =\)` Seen alive at site B - `\(3 =\)` Not seen -- ```r head(rCH) ``` ``` ## [,1] [,2] [,3] [,4] [,5] [,6] ## [1,] 1 1 3 1 1 1 ## [2,] 1 1 1 1 1 1 ## [3,] 1 3 1 2 3 3 ## [4,] 1 3 3 3 3 3 ## [5,] 1 1 2 3 3 3 ## [6,] 1 3 3 2 3 1 ``` --- ## Three states - example #### The data - `\(f =\)` First capture occasion ```r tail(rCH) ``` ``` ## [,1] [,2] [,3] [,4] [,5] [,6] ## [795,] 3 3 3 3 2 3 ## [796,] 3 3 3 3 2 3 ## [797,] 3 3 3 3 2 3 ## [798,] 3 3 3 3 2 3 ## [799,] 3 3 3 3 2 1 ## [800,] 3 3 3 3 2 3 ``` ```r tail(f) ``` ``` ## [1] 5 5 5 5 5 5 ``` --- ## Three states - example #### The likelihood - The Bernoulli distribution describes the probability of one (of two) outcomes -- - The categorical distribution describes the probability of one (of `\(N\)`) outcomes + `\(\Omega\)` and `\(\Theta\)` are matrices defining the state/observation probabilities -- `$$\large z_{i, t+1}|z_{i,t} \sim categorical(\Omega_{z_{i,t},1:S})$$` `$$\large y_{i, t}|z_{i,t} \sim categorical(\Theta_{z_{i,t},1:S})$$` --- ## Analysis in JAGS ```r sink("ms.jags") cat(" model { # Priors phiA ~ dunif(0, 1) phiB ~ dunif(0, 1) psiAB ~ dunif(0, 1) psiBA ~ dunif(0, 1) pA ~ dunif(0, 1) pB ~ dunif(0, 1) ``` --- ## Analysis in JAGS ```r # Define state-transition and observation matrices # Define probabilities of state S(t+1) given S(t) ps[1,1] <- phiA * (1-psiAB) ps[1,2] <- phiA * psiAB ps[1,3] <- 1-phiA ps[2,1] <- phiB * psiBA ps[2,2] <- phiB * (1-psiBA) ps[2,3] <- 1-phiB ps[3,1] <- 0 ps[3,2] <- 0 ps[3,3] <- 1 ``` --- ## Analysis in JAGS ```r # Define probabilities of O(t) given S(t) po[1,1] <- pA po[1,2] <- 0 po[1,3] <- 1-pA po[2,1] <- 0 po[2,2] <- pB po[2,3] <- 1-pB po[3,1] <- 0 po[3,2] <- 0 po[3,3] <- 1 ``` --- ## Analysis in JAGS ```r # Likelihood for (i in 1:nInd){ # Define latent state at first capture z[i,f[i]] <- y[i,f[i]] for (t in (f[i]+1):nOcc){ # State process: draw S(t) given S(t-1) z[i,t] ~ dcat(ps[z[i,t-1],]) # Observation process: draw O(t) given S(t) y[i,t] ~ dcat(po[z[i,t],]) } #t } #i } ",fill = TRUE) sink() ``` --- ## Multi-state models #### Very flexible - Most capture-recapture models can be formulated as multi-state models - Can accommodate many states - Can include covariates and individual/temporal variation #### But complexity comes at a cost - Data hungry - Often not fully identifiable - Computationally intensive