Computes the infant mortality rate (deaths under age 1 per 1,000 live births) per province and year, joining get_ine_deaths() and get_ine_births() output.

infant_mortality_rate(deaths_df, births_df)

Arguments

deaths_df

Deaths tibble as returned by get_ine_deaths() $data_provinces (columns nuts3_code, province_name, year, age, total).

births_df

Births tibble as returned by get_ine_births()$data (columns nuts3_code, year, total).

Value

A tibble with nuts3_code, province_name, year, imr.

Details

This is the standard demographic IMR: infant deaths in a year divided by live births in that same year (the birth cohort those deaths are drawn from), not by population — a different denominator convention from crude_death_rate(). It is closely related to, but not identical to, q0 (probability of dying before age 1) in build_life_table()'s output: q0 is derived from the exposure-based central death rate m0 via the Andreev-Kingkade a0 (per HMD Methods Protocol V6), while IMR here uses the simpler, more standard deaths/births ratio directly. The two will usually be close but need not match exactly.

Examples

deaths <- tibble::tibble(
  nuts3_code = "ES111", province_name = "A Coruna", year = 2023,
  age = c(0, 1, 65), total = c(3, 1, 40)
)
births <- tibble::tibble(nuts3_code = "ES111", year = 2023, total = 1000)
infant_mortality_rate(deaths, births)
#> # A tibble: 1 × 4
#>   nuts3_code province_name  year   imr
#>   <chr>      <chr>         <dbl> <dbl>
#> 1 ES111      A Coruna       2023     3