R/abridged_life_tables.R
build_abridged_life_tables.RdConstructs female, male, and both-sex abridged (5-year age group)
period life tables for every province and year present in mx_5x1,
from compute_death_rates()'s mx_1x1/mx_5x1 output. See
build_abridged_life_table() for the method; build_life_tables()
for the single-year (1x1) equivalent this complements.
build_abridged_life_tables(mx_1x1, mx_5x1)Output of the mx_1x1 element of compute_death_rates().
Output of the mx_5x1 element of compute_death_rates().
list(fltper, mltper, bltper, qc): each a tibble with
nuts3_code, province_name, year, age_group, age_start,
n, mx, ax, qx, lx, dx, Lx, Tx, ex; qc is a named
list of validate_abridged_life_table() results.
mx_1x1 <- tibble::tibble(
nuts3_code = "ES111", province_name = "A Coruna", year = 2023,
age = 0:4, mx_female = c(0.004, 0.0003, 0.0002, 0.0002, 0.0002),
mx_male = c(0.005, 0.0004, 0.0003, 0.0003, 0.0003),
mx_total = c(0.0045, 0.00035, 0.00025, 0.00025, 0.00025)
)
mx_5x1 <- tibble::tibble(
nuts3_code = "ES111", province_name = "A Coruna", year = 2023,
age_group = c("00-04", "100+"),
mx_female = c(0.0006, 0.35), mx_male = c(0.0008, 0.4), mx_total = c(0.0007, 0.38)
)
alt <- build_abridged_life_tables(mx_1x1, mx_5x1)
#> All abridged life tables passed validation.
alt$fltper
#> # A tibble: 2 × 14
#> nuts3_code province_name age_group age_start n mx ax qx lx
#> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl>
#> 1 ES111 A Coruna 00-04 0 5 0.0006 0.635 0.00488 1 e5
#> 2 ES111 A Coruna 100+ 100 NA 0.35 2.86 1 9.95e4
#> # ℹ 5 more variables: dx <dbl>, Lx <dbl>, Tx <dbl>, ex <dbl>, year <dbl>