LifeTableMx: Life Table Functions

LifeTableMxR Documentation

Life Table Functions


Functions for obtaining life table quantities.


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

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



Vector of age-specific mortality rates nmx. If abridged is TRUE, the elements correspond to 1m0, 4m1, 5m5, 5m10, ..., otherwise they corresppond single year age groups. In the abridged case teh vector 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.


For which sex is the life table.


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


Logical. If TRUE (default) the life table and the mx argument is assumed for 5-year age groups. Otherwise 1-year age groups are assumed.


Base of the life table.


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


Name of the column of the life table that should be returned.


Arguments passed to underlying functions, e.g. abridged. In addition for abridged life table only, 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.


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. The underlying workhorse here is the life.table function from the MortCast package. These functions only collapse the first age groups if needed for an abridged life table (LifeTableMx) or/and combine results for multiple time periods into one object (LifeTableMxCol).


Function LifeTableMx returns a data frame with the following elements:


Age groups


mx, the input vector of mortality rates.


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


lx, number left alive at age x.


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


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


sx, survival rate at age x.


Tx, person-years lived above age x.


e0x, expectation of life at age x.


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


Hana Sevcikova, Thomas Buettner, Nan Li, Patrick Gerland


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

See Also

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


## Not run: 
sim.dir <- tempfile()
pred <- pop.predict(countries="Ecuador", output.dir=sim.dir, wpp.year=2015,
    present.year=2015,,, 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)
## End(Not run)

bayesPop documentation built on Aug. 10, 2023, 1:10 a.m.