gen_u5_ax_from_qx | R Documentation |
Add ax onto a data.table for ages <1 and 1-4 years, with algorithm based on under-1 qx.
gen_u5_ax_from_qx(dt, id_cols)
dt |
[
|
id_cols |
[ |
Takes a data.table
with 'age_start', 'age_end', 'sex', and
infant probability of death ('qx') and adds a column 'ax'. There is no
absolute relationship between ax and qx without mx also known. Instead,
this function performs an inverse calculation of the calculation described
for gen_u5_ax_from_mx()
which estimates ax from 1m0. Since
the inverse involves a quadratic, we use stats::uniroot()
to find the
solution.
Modifies dt
in place with 'ax' column added on.
Preston Samuel H, Patrick H, Michel G. Demography: measuring and modeling population processes. MA: Blackwell Publishing. 2001.
gen_u5_ax_from_mx()
dt <- data.table::data.table(
age_start = c(0, 1),
age_end = c(1, 5),
qx = c(0.0846, 0.3658),
sex = c("male", "male")
)
gen_u5_ax_from_qx(dt, id_cols = c("age_start", "age_end", "sex"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.