gen_lx_from_nLx_ax: Generate the lx life table parameter given nLx and ax.

View source: R/survivorship_ratio.R

gen_lx_from_nLx_axR Documentation

Generate the lx life table parameter given nLx and ax.

Description

Generate the lx life table parameter given nLx and ax.

Usage

gen_lx_from_nLx_ax(dt, id_cols)

Arguments

dt

[data.table()]
Input data that includes columns for id_cols, 'nLx', and 'ax'.

id_cols

[character()]
Columns that uniquely identify each row of dt. Must include 'age_start' and 'age_end'.

Details

See the references page for the formatted equations below.

Terminal age group:

\begin{align} {}_{\infty}L_{x} &= n \cdot l_{x+n} + {}_{\infty}a_{x} \cdot {}_{\infty}d_{x} \\ &= {}_{\infty}a_{x} \cdot {}_{\infty}d_{x} \\ &= {}_{\infty}a_{x} \cdot l_{x} \end{align}

l_{x} = \frac{{}_{\infty}L_{x}}{{}_{\infty}a_{x}}

Other age groups:

\begin{align} {}_{n}L_{x} &= n \cdot l_{x+n} + {}_{n}a_{x} \cdot {}_{n}d_{x} \\ &= n \cdot l_{x+n} + {}_{n}a_{x} \cdot (l_x - l_{x+n}) \end{align}

l_x = \frac{{}_{n}L_{x} - ((n - {}_{n}a_{x}) \cdot l_{x+n})}{{}_{n}a_{x}}

Value

dt with column added for new life table parameter. Modifies data.tables in place.

See Also

Other survivorship_ratio: gen_nLx_from_nSx(), nSx_from_lx_nLx_Tx()

Examples

id_cols <- c("sex", "age_start", "age_end")
dt <- data.table::data.table(
  sex = rep("both", 4),
  age_start = c(0, 5, 10, 15),
  age_end = c(5, 10, 15, Inf),
  nLx = c(4, 2, 0.6, 0.1),
  ax = c(2.5, 2.5, 2.5, 2.5)
)
gen_lx_from_nLx_ax(dt, id_cols)


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