Learn R Programming

bayesPop (version 6.2-4)

LifeTableMx: Life Table Functions

Description

Functions for obtaining life table quantities.

Usage

LifeTableMx(mx, sex = c("Male", "Female"), include01 = TRUE,
	radix = 1, open.age = 130)

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 matrix with first dimension being the age.

sex

For which sex is the life table.

include01

Logical. If it is FALSE the first two age groups (0-1 and 1-4) are collapsed to one age group (0-4).

radix

Base of the life table.

open.age

Open age group. If smaller than the last age group of mxm, the life table is truncated.

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:

age

Age groups

mx

mx, the input vector of mortality rates.

qx

nqx, probability of dying between ages x ad x+n.

lx

lx, number left alive at age x.

dx

ndx, cohort deaths between ages x ad x+n.

Lx

nLx, person-years lived between ages x and x+n.

sx

sx, survival rate at age x.

Tx

Tx, person-years lived above age x.

ex

e0x, expectation of life at age x.

ax

nax, 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
# NOT RUN {
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, ...
mxm <- pop.byage.table(pred, expression="MEC_M{age.index01(27)}", year=2020)[,1]
print(LifeTableMx(mxm), digits=3)
# female LT with first two age categories collapsed 
mxf <- pop.byage.table(pred, expression="MEC_F{age.index01(27)}", year=2020)[,1]
print(LifeTableMx(mxf, sex="Female", include01=FALSE), digits=3)
unlink(sim.dir, recursive=TRUE)
# }

Run the code above in your browser using DataLab