| lifeTableFun {demlife} | R Documentation |
Obtain values for a life table function from an object of class
LifeTable.
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"))
object |
An object of class |
fun |
The name of a life table function. |
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.
If fun is "dx", "lx", "Lx", or
"Tx", an object of class Counts;
otherwise an object of class Values.
lifeExpectancy is a convenience function for
extracting life expectancy at a particular age.
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")