summarize_survival_from_census: Summarize annual sex-and-age-specific survival rates from the...

View source: R/summarize_survival_from_census.R

summarize_survival_from_censusR Documentation

Summarize annual sex-and-age-specific survival rates from the census information

Description

The prekill census in year t+1 is the post-kill census in year t, so we can use the prekill census to record the realized fraction of individuals of each age and sex that survived the death episode in each year. In the output survival in year t is the fraction of j-year olds in year t that survive to be j+1 year-olds in year t+1.

Usage

summarize_survival_from_census(
  census,
  fem_surv_probs = NULL,
  male_surv_probs = NULL,
  nbins = 10
)

Arguments

census

a tibble of census counts with columns year and age, and then the counts of the different sexes in columns named male, and female.

fem_surv_probs

a vector of the parameters used for the simulation. If present these are put on the histogram plots. If you provide one of these, you have to provide both.

male_surv_probs

a vector of the parameters used for the simulation. If present these are put on the histogram plots.

nbins

number of bins for the histograms

Details

This function does not track migrants. Another one is eventually in order that accounts for migrants out of the population. Also, the plots here might not play well with multiple populations.

Value

A list with components:

  • survival_tibble: A tibble with the following columns:

    • year: The year

    • pop: The population whose census is being counted

    • age: The age of individuals

    • sex: The sex of individuals

    • n: The number of individuals alive and present of sex sex and age age in year year in pop pop.

    • cohort: The birth year of these individuals

    • surv_fract: The fraction of the n individuals that survive to have age age + 1 in year year + 1.

  • plot_histos_by_age_and_sex: A ggplot object of histograms of observed survival fractions facet-wrapped by age and sex. Blue vertical lines are the observed means and dashed vertical red lines are the expected values given the simulation parameters.

Examples

result <- summarize_survival_from_census(
  species_1_slurped_results$census_prekill,
  species_1_life_history$`fem-surv-probs`,
  species_1_life_history$`male-surv-probs`
)

# print the results if you want
result$survival_tibble
result$plot_histos_by_age_and_sex


eriqande/CKMRpop documentation built on Jan. 25, 2024, 2:10 p.m.