View source: R/survivorship_ratio.R
gen_lx_from_nLx_ax | R Documentation |
Generate the lx life table parameter given nLx and ax.
gen_lx_from_nLx_ax(dt, id_cols)
dt |
[ |
id_cols |
[ |
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}}
dt
with column added for new life table parameter. Modifies
data.tables in place.
Other survivorship_ratio:
gen_nLx_from_nSx()
,
nSx_from_lx_nLx_Tx()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.