Learn R Programming

bayesPop (version 3.2-3)

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'), ...)

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
  • LxnLx, person-years lived between ages n and x+n.
  • lxlx, number left alive at age x.
  • qxnqx, probability of dying between ages x ad x+n.
  • 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).

    If include01 is TRUE the number of rows on the data frame corresponds to the size of mx. In such a case, the first row corresponds to the age group 0-1 and the second row to the age group 0-5 (not 1-5!). If include01 is FALSE, the first row is eliminated.

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,
			keep.vital.events=TRUE)
# get male mortality rates from 2000 for age groups 0-1, 1-4, 5-9, ...
mx <- pop.byage.table(pred, expression='MEC_M{c(-1,0,2:21)}')[,1]
LifeTableMx(mx)
unlink(sim.dir, recursive=TRUE)

Run the code above in your browser using DataLab