R/abridged_life_tables.R
build_abridged_life_table.RdConstructs an abridged period life table (age groups "00-04",
"05-09", ..., "95-99", "100+") independently from observed grouped
central death rates. It is a separate estimate, not an abridgement of the
single-year table from build_life_tables(): it uses no Kannisto
smoothing, and its open interval is 100+ rather than 110+, so the two
tables' life expectancies differ slightly by construction.
build_abridged_life_table(mx_1x1, mx_5x1, sex = c("female", "male"))tibble with columns age (single years, at least
0:4), mx, for one year and one sex - see compute_death_rates()'s
mx_1x1 output, filtered to one province/year/sex.
tibble with columns age_group ("00-04", "05-09",
..., "100+"), mx, for the same year and sex - see
compute_death_rates()'s mx_5x1 output, filtered the same way.
"female" or "male" - selects the Andreev-Kingkade a0
branch for the youngest group, same as build_life_table().
tibble: age_group, age_start, n (interval width, NA
for the open interval), mx, ax, qx, lx, dx, Lx, Tx, ex.
Closed groups from age 5 use Greville's nax with the Chiang
conversion nqx = n nmx / (1 + (n - nax) nmx) and
nLx = n l(x+n) + nax ndx (Preston, Heuveline & Guillot 2001, Box 3.1),
falling back to a constant hazard (nqx = 1 - exp(-n nmx),
nLx = ndx / nmx) where Greville's slope term is undefined. Both keep
nmx = ndx / nLx exactly. The open interval has qx = 1,
Lx = lx / mx.
Complements build_life_table()'s single-year (1x1) tables - use
this when comparing against other agencies' published abridged
tables, or when only grouped-age data is available. The youngest
group ("00-04") is the one exception to using mx_5x1 alone: it is
built from an exact single-year sub-table using mx_1x1's
Andreev-Kingkade a0 (see andreev_kingkade_a0()), avoiding the
external nax(0-4) regression a from-mx_5x1-alone method would
otherwise need for that interval's sharp infant-mortality gradient.
mx1 <- data.frame(age = 0:4, mx = c(0.004, 0.0003, 0.0002, 0.0002, 0.0002))
start <- seq(0, 100, by = 5)
mx5 <- data.frame(
age_group = c(sprintf("%02d-%02d", start[-21], start[-21] + 4), "100+"),
mx = c(0.0011, 0.00004 * exp(0.095 * start[-1]))
)
build_abridged_life_table(mx1, mx5, "female")
#> # A tibble: 21 × 11
#> age_group age_start n mx ax qx lx dx Lx Tx
#> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 00-04 0 5 0.0011 0.635 4.88e-3 1 e5 488. 4.98e5 7.79e6
#> 2 05-09 5 5 0.0000643 2.01 3.22e-4 9.95e4 32.0 4.97e5 7.29e6
#> 3 10-14 10 5 0.000103 2.70 5.17e-4 9.95e4 51.4 4.97e5 6.80e6
#> 4 15-19 15 5 0.000166 2.70 8.31e-4 9.94e4 82.7 4.97e5 6.30e6
#> 5 20-24 20 5 0.000267 2.70 1.34e-3 9.93e4 133. 4.96e5 5.80e6
#> 6 25-29 25 5 0.000430 2.70 2.15e-3 9.92e4 213. 4.96e5 5.30e6
#> 7 30-34 30 5 0.000692 2.70 3.45e-3 9.90e4 342. 4.94e5 4.81e6
#> 8 35-39 35 5 0.00111 2.70 5.55e-3 9.87e4 547. 4.92e5 4.32e6
#> 9 40-44 40 5 0.00179 2.69 8.90e-3 9.81e4 874. 4.89e5 3.82e6
#> 10 45-49 45 5 0.00288 2.69 1.43e-2 9.72e4 1389. 4.83e5 3.33e6
#> # ℹ 11 more rows
#> # ℹ 1 more variable: ex <dbl>
# Missing or duplicated age groups are rejected
try(build_abridged_life_table(mx1, mx5[-5, ], "female"))
#> Error : Invalid `mx_5x1` age groups: age groups are not contiguous (gap or overlap).