gen_nLx_from_nSx: Generate nLx life table parameter from survivorship ratios

View source: R/survivorship_ratio.R

gen_nLx_from_nSxR Documentation

Generate nLx life table parameter from survivorship ratios

Description

Generate the nLx life table parameter given survivorship ratios (nSx).

Usage

gen_nLx_from_nSx(dt, id_cols)

Arguments

dt

[data.table()]
Input data that includes columns for id_cols and 'nSx'.

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.

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}

Value

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

See Also

Other survivorship_ratio: gen_lx_from_nLx_ax(), 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),
  nSx = c(0.95, 0.99, 0.99, 0.75)
)
gen_nLx_from_nSx(dt, id_cols)


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