Description Usage Arguments Details Value Examples
View source: R/summarize_survival_from_census.R
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.
1 2 3 4 5 6 | summarize_survival_from_census(
census,
fem_surv_probs = NULL,
male_surv_probs = NULL,
nbins = 10
)
|
census |
a tibble of census counts with columns |
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 |
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.
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.
1 2 3 4 5 6 7 8 9 | 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.