Learn R Programming

LifeTables (version 1.0)

lt.mx: Life tables from nmx

Description

Builds a life table by using the mortality rate schedule to calculate the subsequent columns of the table

Usage

lt.mx(nmx, sex="female", age = c(0,1,seq(5,110,5)), nax=NULL)

Arguments

nmx
A vector of age-specific mortality rates
age
The start age of each age interval (will also be the start age for each interval of the subsequent life table)
sex
"male" or "female". The sex determines the nax value for the childhood age intervals using the Coale and Demeney West values when nax=NULL and when under 5 mortality is split into 0-1 and 1-4.
nax
A set of nax values for the life table. Must have the same length as nmx and if no values are provided, this argument defaults to half the length of the age interval except for the first two childhood age groups.

Value

e0
Life expectancy at birth
lt
A life table with age intervals matching those of the nmx schedule on which the table is built and with columns for age, nax, nmx, nqx, npx, ndx, lx, nLx, Tx, and ex.
lt.5q0
The probability a newborn will die before age 5
lt.45q15
The probability a 15-year old will die before reaching age 60

Examples

Run this code
# some data to build the table
data(MLTobs)
test.mx.m <- mlt.mx[,1]

# build the life table
lt.mx(nmx=test.mx.m, sex="male")

# another example with female data ages 0-85
test.mx.f <- flt.mx[1:19,1] ## ages 0-85
lt.mx(nmx=test.mx.f, sex="female", age=c(0,1,seq(5,85,5)))
        

Run the code above in your browser using DataLab