Description Usage Arguments Value Examples
Calculate life expectancy using the Chiang method
1 | life_table(hazard, start_age, neonatal_deaths = TRUE)
|
hazard |
A numeric vector. The age specific hazard. |
start_age |
A numeric vector. The first age (in years) in each age group. |
neonatal_deaths |
Logical. Are neonatal deaths included? |
A data frame of:
Age groups
Age-specific hazards
Population surviving from a cohort of 100,000
Survival probability
Number of deaths per 100,000
Number of life-years lived per 100,0000
life expectancy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Using an abridged set of population and mortality data:
head(abridged_data)
population <- subset(abridged_data,
time == 2011 & sex == "Persons" & measure == "Population",
select = c(age, value))
population = population$value
deaths <- subset(abridged_data,
time == 2011 & sex == "Persons" & measure == "Deaths",
select = c(age, value))
start_age <- as.numeric(gsub(" .+", "", deaths$age))
deaths <- deaths$value
hazard <- deaths / population
life_table(hazard, start_age)
# Using single-year population and mortality data
head(single_year_data)
population <- subset(single_year_data,
time == 2011 & sex == "Persons" & measure == "Population",
select = c(age, value))
population = population$value
deaths <- subset(single_year_data,
time == 2011 & sex == "Persons" & measure == "Deaths",
select = c(age, value))
start_age <- as.numeric(gsub(" .+", "", deaths$age))
deaths <- deaths$value
hazard <- deaths / population
life_table(hazard, start_age)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.