Convert between mx and qx values given the length of an age interval. If ax (the average number of years lived in the x to x + n age interval by those dying in the interval) exists, use the ax_to functions. The mx_to_qx and qx_to_mx functions assume smooth mortality across the interval.
mx_to_qx(mx, age_length)
mx_ax_to_qx(mx, ax, age_length)
qx_to_mx(qx, age_length)
mx_qx_to_ax(mx, qx, age_length)
qx_ax_to_mx(qx, ax, age_length)
mx_to_ax(mx, age_length)
[numeric()
]
The converted mx, qx, or ax value(s).
mx_to_qx: qx = 1 - exp((-1 * age_length) * mx)
mx_ax_to_qx: qx = (age_length * mx) / (1 + (age_length - ax) * mx)
qx_to_mx: mx = log(1 - qx) / (-1 * age_length)
mx_qx_to_ax: ax = (qx + (mx * age_length * (qx - 1))) / (mx * qx)
qx_ax_to_mx: mx = qx / (age_length - (age_length * qx) + (ax * qx))
mx_to_ax: ax = age_length + (1 / mx) - age_length / (1 - exp(- age_length * mx))
For all functions calculating qx, if age_length = Inf return qx = 1. For all functions computing mx or ax, if age_length = Inf modify age_length to arbitrarily large value (200) to get real number result.
Preston Demography textbook
vignette("introduction_to_life_tables", package = "demCore")
mx_to_qx(0.25, 45)
#> [1] 0.999987
mx_ax_to_qx(0.2, 3, 5)
#> [1] 0.7142857
qx_to_mx(0.5, 5)
#> [1] 0.1386294
mx_qx_to_ax(0.005, 0.0247, 5)
#> [1] 2.57085
qx_ax_to_mx(0.1, 3, 5)
#> [1] 0.02083333
mx_to_ax(0.2, 5)
#> [1] 2.090116