LifeTable: Compute Life Tables from Mortality Data

View source: R/LifeTable.R

LifeTableR Documentation

Compute Life Tables from Mortality Data


Construct either a full or abridged life table with various input choices like: death counts and mid-interval population estimates (Dx, Ex) or age-specific death rates (mx) or death probabilities (qx) or survivorship curve (lx) or a distribution of deaths (dx). If one of these options is specified, the other can be ignored. The input data can be an object of class: numerical vector, matrix or data.frame.


LifeTable(x, Dx = NULL, Ex = NULL,
             mx = NULL,
             qx = NULL,
             lx = NULL,
             dx = NULL,
             sex = NULL,
             lx0 = 1e5,
             ax  = NULL)



Vector of ages at the beginning of the age interval.


Object containing death counts. An element of the Dx object represents the number of deaths during the year to persons aged x to x+n.


Exposure in the period. Ex can be approximated by the mid-year population aged x to x+n.


Life table death rate in age interval [x, x+n).


Probability of dying in age interval [x, x+n).


Probability of survival up until exact age x (if l(0) = 1), or the number of survivors at exact age x, assuming l(0) > 1.


Deaths by life-table population in the age interval [x, x+n).


Sex of the population considered here. Default: NULL. This argument affects the first two values in the life table ax column. If sex is specified the values are computed based on the Coale-Demeny method and are slightly different for males than for females. Options: NULL, male, female, total.


Radix. Default: 100 000.


Numeric scalar. Subject-time alive in age-interval for those who die in the same interval. If NULL this will be estimated. A common assumption is ax = 0.5, i.e. the deaths occur in the middle of the interval. Default: NULL.


The "life table" is also called "mortality table" or "actuarial table". This shows, for each age, what the probability is that a person of that age will die before his or her next birthday, the expectation of life across different age ranges or the survivorship of people from a certain population.


The output is of the "LifeTable" class with the components:


Computed life table;


Call in which all of the specified arguments are specified by their full names;


Time stamp.


Marius D. Pascariu

See Also

LawTable convertFx


# Example 1 --- Full life tables with different inputs ---

y  <- 1900
x  <- as.numeric(rownames(ahmd$mx))
Dx <- ahmd$Dx[, paste(y)]
Ex <- ahmd$Ex[, paste(y)]

LT1 <- LifeTable(x, Dx = Dx, Ex = Ex)
LT2 <- LifeTable(x, mx = LT1$lt$mx)
LT3 <- LifeTable(x, qx = LT1$lt$qx)
LT4 <- LifeTable(x, lx = LT1$lt$lx)
LT5 <- LifeTable(x, dx = LT1$lt$dx)


# Example 2 --- Compute multiple life tables at once ---

LTs = LifeTable(x, mx = ahmd$mx)
# A warning is printed if the input contains missing values.
# Some of the missing values can be handled by the function.

# Example 3 --- Abridged life table ------------

x  <- c(0, 1, seq(5, 110, by = 5))
mx <- c(.053, .005, .001, .0012, .0018, .002, .003, .004,
        .004, .005, .006, .0093, .0129, .019, .031, .049,
        .084, .129, .180, .2354, .3085, .390, .478, .551)
LT6 <- LifeTable(x, mx = mx, sex = "female")

# Example 4 --- Abridged life table w using my own 'ax' ------------
# In this examples we are using the ages (x) and death rates (mx) from
# example 3. Note that 'ax' must have the same length as the 'x' vector
# otherwise an error message will be returned.

my_ax <- c(0.1, 1.5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
           2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1)

LT7 <- LifeTable(x = x, mx = mx, ax = my_ax)

MortalityLaws documentation built on July 1, 2022, 5:06 p.m.