gen_u5_ax_from_mx: Generate ax for ages under 5 years, from mx

View source: R/gen_u5_ax.R

gen_u5_ax_from_mxR Documentation

Generate ax for ages under 5 years, from mx

Description

Add ax onto a data.table for ages <1 and 1-4 years, with algorithm based on under-1 mx.

Usage

gen_u5_ax_from_mx(dt, id_cols)

Arguments

dt

[data.table()]
Columns:

  • 'age_start' with values 0 (for under-1) and 1 (for 1-4). Other ages permitted but will result in NA output for ax or unchanged ax if ax in input dt.

  • 'age_end' with values 1 (for under-1) and 5 (for 1-4).

  • 'sex' where values must be 'male', 'female', or 'both'

  • 'mx' for mortality rate

  • All additional columns from 'id_cols'

id_cols

[character()]
Columns that uniquely identify observations in dt. Must include 'age_start', 'age_end', and 'sex'.

Details

Takes a data.table with 'age_start', 'age_end', 'sex', and infant mortality rate ('mx') and adds a column 'ax'.

The following table shows the conversions from 1m0 to 1a0 and 4a1. Note that when sex is "both" the relationship is a mean of the male and female relationships.

Males Females
1a0:
If 1m0 >= 0.107 0.330 0.350
If 1m0 < 0.107 0.045 + 2.684 * 1m0 0.053 + 2.800 * 1m0
4a1:
If 1m0 >= 0.107 1.352 1.361
If 1m0 < 0.107 1.651 - 2.816 * 1m0 1.522 - 1.518 * 1m0

Value

Modifies dt in place with 'ax' column added on.

References

Preston Samuel H, Patrick H, Michel G. Demography: measuring and modeling population processes. MA: Blackwell Publishing. 2001.

Examples

dt <- data.table::data.table(
  age_start = c(0, 1),
  age_end = c(1, 5),
  mx = c(0.09, 0.12),
  sex = c("male", "male")
)
gen_u5_ax_from_mx(dt, id_cols = c("age_start", "age_end", "sex"))

ihmeuw-demographics/demCore documentation built on Feb. 24, 2024, 11:05 p.m.