nSx_from_lx_nLx_Tx: Calculate survivorship ratios

View source: R/survivorship_ratio.R

nSx_from_lx_nLx_TxR Documentation

Calculate survivorship ratios

Description

Calculate survivorship ratios to be used in projecting populations forward in time with ccmpp(). The survivorship ratios represent the proportion of people in one age group that will survive into the next age group given the age-specific mortality rates in a life table.

Usage

nSx_from_lx_nLx_Tx(dt, id_cols, terminal_age)

Arguments

dt

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

id_cols

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

terminal_age

[integer(1)]
The terminal age group in the population that the calculated survivorship ratios will be used to project in. This must be less than or equal to the maximum 'age_start' in dt.

Details

See the references page for the formatted equations below.

First age group:

{}_{n}S_0 = \frac{{}_{n}L_{0}}{n \cdot l_0}

Other age groups:

{}_{n}S_x = \frac{{}_{n}L_{x}}{{}_{n}L_{x-n}}

Terminal age group:

{}_{n}S_x = \frac{T_{x}}{T_{x-n}}

Value

[data.table()] with the id_cols plus a column for 'nSx' with the survivorship ratio value.

See Also

ccmpp()

Other survivorship_ratio: gen_lx_from_nLx_ax(), gen_nLx_from_nSx()

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),
  mx = c(0.1, 0.2, 0.3, 0.4),
  ax = c(2.5, 2.5, 2.5, 2.5)
)
lifetable(dt, id_cols)
nSx <- nSx_from_lx_nLx_Tx(dt, id_cols, terminal_age = 15)


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