R/survivorship_ratio.R
gen_lx_from_nLx_ax.Rd
Generate the lx life table parameter given nLx and ax.
gen_lx_from_nLx_ax(dt, id_cols)
[data.table()
]
Input data that includes columns for id_cols
, 'nLx', and 'ax'.
[character()
]
Columns that uniquely identify each row
of dt
. Must include 'age_start' and 'age_end'.
dt
with column added for new life table parameter. Modifies
data.tables in place.
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}}$$
Other survivorship_ratio:
gen_nLx_from_nSx()
,
nSx_from_lx_nLx_Tx()