---
title: "Methods used in `bbouretro` for Estimating Survival, Recruitment, and Population Growth"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Methods used in `bbouretro` for Estimating Survival, Recruitment, and Population Growth}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
bibliography: bibliography.bib
---

<!-- # Copyright 2024 Province of Alberta -->
<!-- # -->
<!-- # Licensed under the Apache License, Version 2.0 (the "License"); -->
<!-- # you may not use this file except in compliance with the License. -->
<!-- # You may obtain a copy of the License at -->
<!-- # -->
<!-- # http://www.apache.org/licenses/LICENSE-2.0 -->
<!-- # -->
<!-- # Unless required by applicable law or agreed to in writing, software -->
<!-- # distributed under the License is distributed on an "AS IS" BASIS, -->
<!-- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
<!-- # See the License for the specific language governing permissions and -->
<!-- # limitations under the License. -->


```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

There are multiple ways cited in literature to calculate survival, recruitment, and population growth.
The traditional or **retro** methods used in bbou**retro** are outlined below. 

## Survival, $S$

The `bbr_survival()` function uses the staggered entry Kaplan-Meier method.

The staggered entry Kaplan-Meier, which uses discrete time steps, is defined algebraically below [@pollock_survival_1989].
The probability of surviving in the $i$th time step (usually month) is given by the equation below 

$$ \hat{S}_{i} = 1 - \frac{d_{i}}{r_{i}} $$

where $d_{i}$  is the number of mortalities during the period and  $r_{i}$ is the number of collared individuals at the start of period.
The estimated survival for any arbitrary time period $t$  (usually year) is given by

$$ \hat{S}(t) = \prod_{i=1}(\hat{S}_{i,t}) $$

where $S$ is the survival during the $i$th time step of the $t$th period.

Standard error is estimated using the Greenwood’s formula [@cox_analysis_1984].

$$SE(\hat{S}(t)) = \sqrt{[\hat{S}(t)]^2 \sum \frac{d_{i}}{r_{i}(r_{i} - d_{i})}}$$

Cox and Oakes [-@cox_analysis_1984] propose a simple binomial variance formula “which is better in the tails of the distribution” [@pollock_survival_1989].

$$SE(\hat{S}(t)) = \sqrt{ \frac{[\hat{S}(t)]^2 - [1-\hat{S}(t)]}{r(t)}}$$

Logit-based confidence limits are estimated using the Wald method.
Further details on the Kaplan-Meier approach as applied in boreal caribou studies are given in `vignette("previous-methods")`.

## Recruitment, $R$

The `bbr_recruitment()` function estimates recruitment using the following method. 

Estimation of recruitment follows methods of DeCesare et al. [-@decesare_estimating_2012].

The age ratio, $X$, is commonly estimated as the number of calves, $n{_j}$, per adult female, $n_{af}$, observed at the end of a measured year, such that 

$$X = \frac{n_j}{n_{af}}$$ 

where $X \cdot sex\_ratio$ estimates the number of female calves $(n_{jf})$ per adult female. 

Recruitment is estimated using the equation below which accounts for recruitment of calves into the yearling/adult age class at the end of the caribou year.

$$R_{RM} = \frac{X \cdot sex\_ratio}{1 + X \cdot sex\_ratio}$$

Variance is estimated using a bootstrap approach or the binomial method.

The bootstrap approach randomly resamples groups for 1000 iterations to create 1000 estimates of calf cow ratio and recruitment.
Percentile-based 95% confidence limits are then estimated from the 1000 estimates.

For the binomial method, variance is estimated as $(R_m \cdot (1 - R_{rm})/n)$ where $n$ is the number of adult females sampled during each yearly survey.  


It is assumed that both survival and recruitment are independently distributed on the logit scale therefore bounding each value between 0 and 1.
The bootstrap method is recommended as the most robust approach to obtain variance estimates [@manly_1984] .
A full summary of methods is given in `vignette("previous-methods")`.

## Population Growth, $\lambda$

For `bbr_growth()` function uses the basic Hatter-Bergerud method [@hatter_moose_1991].

The basic Hatter-Bergerud equation used to estimate $\lambda$ is given below.

$$\lambda = \frac{(S)}{(1 - R)}$$

The standard errors on estimates of survival and recruitment are then used to create simulated distributions of $S$ and $R$ and derive a distribution of $\lambda$ based on the simulated values.
It is assumed both survival and recruitment are distributed on the logit scale therefore bounding each value between 0 and 1.

One thousand simulations are conducted.
Percentile-based confidence limits are then derived.
Also, the proportion of simulations where $\lambda$ is greater than 1 is tabulated to provide a p-value for the hypothesis test $(Ho: \lambda >= 1, Ha: \lambda < 1)$.

Output summaries also include mean values simulated for $S$, $R$, as well as mean and median $\lambda$ values from the simulation.

Users can generate plots of simulated lambda values using the `bbr_plot_growth_distributions()` or yearly estimates using `bbr_plot_growth()`.

## References
