Learn R Programming

bayesPop (version 6.0-0)

LifeTableMx: Life Table Functions

Description

Functions for obtaining life table quantities.

Usage

LifeTableMx(mx, sex = c("Male", "Female"))

LifeTableMxCol(mx, colname=c('Lx', 'lx', 'qx', 'mx', 'dx', 'Tx', 'sx', 'ex', 'ax'), ...)

Arguments

mx
Vector of age-specific mortality rates nmx. The elements correspond to 1m0, 4m1, 5m5, 5m10, .... It can have no more than 28 elements which corresponds to age up to 130. In the LifeTableMxCol function, this argument can be a two-dimensional m
sex
For which sex is the life table.
colname
Name of the column of the life table that should be returned.
...
Arguments passed to underlying functions. Argument age05 is a logical vector of size three, specifying if the age groups 0-1, 1-4 and 0-5 should be included. Default value of c(FALSE, FALSE, TRUE) includes the 0-5 age group only.

Value

  • Function LifeTableMx returns a data frame with the following elements:
  • ageAge groups
  • mxmx, the input vector of mortality rates.
  • qxnqx, probability of dying between ages x ad x+n.
  • lxlx, number left alive at age x.
  • dxndx, cohort deaths between ages x ad x+n.
  • LxnLx, person-years lived between ages x and x+n.
  • sxsx, survival rate at age x.
  • TxTx, person-years lived above age x.
  • exe0x, expectation of life at age x.
  • axnax, average person-years lived in the interval by those dying in the interval.
  • Function LifeTableMxCol returns one given column of the life table, possibly as a matrix (if mx is a matrix).

Details

Function LifeTableMx returns a life table for one set of mortality rates. Function LifeTableMxCol returns one column of the life table for (possibly) multiple sets of mortality rates.

References

Preston, P., Heuveline, P., Guillot, M. (2001): Demography. Blackwell Publishing Ltd.

See Also

pop.expressions for examples on retrieving some life table quantities.

Examples

Run this code
sim.dir <- tempfile()
pred <- pop.predict(countries="Ecuador", output.dir=sim.dir, wpp.year=2015,
    present.year=2015, keep.vital.events=TRUE, fixed.mx=TRUE, fixed.pasfr=TRUE)
# get male mortality rates from 2020 for age groups 0-1, 1-4, 5-9, ...
mx <- pop.byage.table(pred, expression="MEC_M{c(-1,0,2:27)}", year=2020)[,1]
print(LifeTableMx(mx), digits=3)
unlink(sim.dir, recursive=TRUE)

Run the code above in your browser using DataLab