View source: R/survivorship_ratio.R
gen_nLx_from_nSx | R Documentation |
Generate the nLx life table parameter given survivorship ratios (nSx).
gen_nLx_from_nSx(dt, id_cols)
dt |
[ |
id_cols |
[ |
See the references page for the formatted equations below.
First age group:
{}_{n}S_0 = \frac{{}_{n}L_{0}}{n \cdot l_0}
{}_{n}L_{0} = {}_{n}S_0 \cdot n \cdot l_0
Other age groups:
{}_{n}S_x = \frac{{}_{n}L_{x}}{{}_{n}L_{x-n}}
{}_{n}L_{x} = {}_{n}S_x \cdot {{}_{n}L_{x-n}}
Terminal age group:
{}_{n}S_x = \frac{T_{x}}{T_{x-n}} =
\frac{{}_{\infty}L_{x}}{{}_{\infty}L_{x} + {}_{n}L_{x - n}}
{}_{\infty}L_{x} = \frac{{}_{n}S_x \cdot {}_{n}L_{x - n}}{1 - {}_{n}S_x}
dt
with column added for new life table parameter. Modifies
data.tables in place.
Other survivorship_ratio:
gen_lx_from_nLx_ax()
,
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),
nSx = c(0.95, 0.99, 0.99, 0.75)
)
gen_nLx_from_nSx(dt, id_cols)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.