Computes 1x1 (single-year age/period), 5x1 (5-year age group), and age-standardised (ESP 2013) death rates for every province present in both deaths and exposure, per SHMD Protocol Section 12, Step 5.

compute_death_rates(deaths, exposure)

Arguments

deaths

Output of the data_provinces element of get_ine_deaths().

exposure

Output of the data element of compute_exposure().

Value

list(mx_1x1, mx_5x1, asdr, qc):

  • mx_1x1: nuts3_code, province_name, year, age, central death rates mx_female, mx_male, mx_total, and the deaths (d_*) and exposures (e_*) they come from (needed by build_life_tables()).

  • mx_5x1: the same by five-year group (age_group), pooled as sum(deaths) / sum(exposure).

  • asdr: age-standardised death rates per 100,000 (European Standard Population 2013; the 95+ weight of 200 is spread evenly over ages 95-99 and 100+). NA unless all ages 0-100 have finite rates.

  • qc: output of validate_death_rates() on mx_1x1.

Missing data

INE's age-specific deaths table omits cells with zero deaths, so an age missing from a province-year that is otherwise present is treated as a structural zero. An explicit NA count (unavailable or suppressed and not recoverable) is kept as NA and propagates to the rate, the grouped rate, and the ASDR, and makes validate_death_rates() fail. A province-year with exposure but no death records at all is unavailable, not zero: it is excluded with a warning.

Examples

deaths <- tibble::tibble(
  nuts3_code = "ES111", province_name = "A Coruna", year = 2023,
  age = c(0, 1), female = c(1, 0), male = c(1, 1), total = c(2, 1)
)
exposure <- tibble::tibble(
  nuts3_code = "ES111", province_name = "A Coruna", year = 2023,
  age = c(0, 1), female = c(500, 490), male = c(510, 505), total = c(1010, 995)
)
rates <- compute_death_rates(deaths, exposure)
#> Warning: Death rate validation flagged 1 issue category: incomplete_age_coverage.
#> Validation issues detected in death rates (see returned $qc$issues).
rates$mx_1x1
#> # A tibble: 2 × 13
#>   nuts3_code province_name  year   age mx_female mx_male mx_total d_female
#>   <chr>      <chr>         <dbl> <dbl>     <dbl>   <dbl>    <dbl>    <dbl>
#> 1 ES111      A Coruna       2023     0     0.002 0.00196  0.00198        1
#> 2 ES111      A Coruna       2023     1     0     0.00198  0.00101        0
#> # ℹ 5 more variables: d_male <dbl>, d_total <dbl>, e_female <dbl>,
#> #   e_male <dbl>, e_total <dbl>
rates$asdr
#> # A tibble: 1 × 6
#>   nuts3_code province_name  year asdr_female asdr_male asdr_total
#>   <chr>      <chr>         <dbl>       <dbl>     <dbl>      <dbl>
#> 1 ES111      A Coruna       2023          NA        NA         NA