lifeTableFun: Extract a life table function from a life table.

Description Usage Arguments Details Value See Also Examples

Description

Obtain values for a life table function from an object of class LifeTable.

Usage

1
2
3
4
lifeTableFun(object, fun = c("mx", "qx", "px", "dx", "lx", "Lx", "Tx", "ex"))

## S4 method for signature 'LifeTable'
lifeTableFun(object, fun = c("mx", "qx", "px", "dx", "lx", "Lx", "Tx", "ex"))

Arguments

object

An object of class LifeTable.

fun

The name of a life table function.

Details

The life table functions are as follows:

Function Definition
mx Mortality rate for age-group x.
qx Given survival to exact age x, the probability dying before the end of the age interval.
px 1 - qx
lx Of radix births, the number of people expected to survive to exact age x
dx The number of deaths in the age interval, for a cohort of size radix at birth.
Lx The expected number of person-years lived in an age interval by a cohort of size radix at birth.
Tx Sum of the Lx from age x to the highest age.
ex Life expectancy at age x.
ax The 'separation factor' - the average number of years lived during an age interval by someone who does during that interval.

The fun argument in calls to lifeTableFun does not need to be one of the functions specified in the showFun argument to LifeTable.

Value

If fun is "dx", "lx", "Lx", or "Tx", an object of class Counts; otherwise an object of class Values.

See Also

lifeExpectancy is a convenience function for extracting life expectancy at a particular age.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
al <- demdata::afghan.life
al <- dembase::Values(al)
mx <- dembase::subarray(al,
               subarray = (fun == "mx") & (time == "2001-2005"))
lt <- LifeTable(mx)
lt
lifeTableFun(lt, fun = "qx")
lifeTableFun(lt, fun = "Lx")
## Because it is not included in the default value for 'showFun'
## in function 'LifeTable', "Tx" is not displayed in the
## life table above.  However, 'lifeTableFun' will generate
## a value for 'Tx' anyway.
lifeTableFun(lt, fun = "Tx")

StatisticsNZ/demlife documentation built on April 27, 2021, 10:02 p.m.