Learn R Programming

rprev (version 0.2.4)

population_survival_rate: Transform yearly mortality rates to daily.

Description

Calculates the daily mortality probability for a given population stratified by age, based on their yearly mortality rates.

Usage

population_survival_rate(form, data, max_age = 100)

Arguments

form

Formula where the LHS indicates the name of the mortality rate column, and the RHS is the column where age is located. This function assumes that the population data frame has already been stratified by sex, or any other categorical variable of interest.

data

Data frame of population mortality stratified by sex and age. The following columns must be present: sex, age, and rate.

max_age

Maximum age to calculate mortality for.

Value

An estimate of the survival rate by age in days, with max_age * DAYS_IN_YEAR values.

Examples

Run this code
# NOT RUN {
data(UKmortality)

population_survival_rate(rate ~ age, UKmortality)
population_survival_rate(rate ~ age, subset(UKmortality, sex==0))

# }

Run the code above in your browser using DataLab