lifetab {poputils} | R Documentation |
Calculate Life Tables or Life Expectancies
Description
Calculate life table quantities. Function
lifetab()
returns an entire life table.
Function lifeexp()
returns life expectancy at birth.
The inputs can be mortality rates (mx
) or
probabilities of dying (qx
), though not both.
Usage
lifetab(
data,
mx = NULL,
qx = NULL,
age = age,
sex = NULL,
ax = NULL,
by = NULL,
infant = c("constant", "linear", "CD", "AK"),
child = c("constant", "linear", "CD"),
closed = c("constant", "linear"),
open = "constant",
radix = 1e+05,
suffix = NULL
)
lifeexp(
data,
mx = NULL,
qx = NULL,
age = age,
sex = NULL,
ax = NULL,
by = NULL,
infant = c("constant", "linear", "CD", "AK"),
child = c("constant", "linear", "CD"),
closed = c("constant", "linear"),
open = "constant",
suffix = NULL
)
Arguments
data |
Data frame with mortality data. |
mx |
< |
qx |
< |
age |
< |
sex |
< |
ax |
< |
by |
< |
infant |
Method used to calculate
life table values in age group |
child |
Method used to calculate
life table values in age group |
closed |
Method used to calculate
life table values in closed age intervals
other than |
open |
Method used to calculate
life table values in the final, open age group
(eg |
radix |
Initial population for the
|
suffix |
Optional suffix added to new columns in result. |
Value
A tibble.
Definitions of life table quantities
-
mx
Deaths per person-year lived. -
qx
Probability of surviving from the start of age group 'x' to the end. -
lx
Number of people alive at the start of age groupx
. -
dx
Number of deaths in age groupx
-
Lx
Expected number of person years lived in age groupx
. -
ex
Life expectancy, calculated at the start of age groupx
.
Mortality rates mx
are sometimes expressed
as deaths per 1000 person-years lived, or per 100,000
person-years lived. lifetab()
and lifeexp()
assumed that they are expressed as deaths per
person-year lived.
Calculation methods
lifetab()
and lifeexp()
implement several
methods for calculating life table quantities
from mortality rates. Each method makes
different assumptions about
the way that mortality rates vary within
age intervals:
-
"constant"
Mortality rates are constant within each interval. -
"linear"
. Life table quantitylx
is a straight line within each interval. Equivalently, deaths are distributed uniformly within each interval. -
"CD"
. Used only with age groups "0" and "1-4". Mortality rates decline over the age interval, with the slope depending on the absolute level of infant mortality. The formulas were developed by Coale and Demeny (1983), and used in Preston et al (2001). -
"AK"
. Used only with age group "0". Mortality rates decline over the age interval, with the slope depending on the absolute level of infant mortality. The formulas were formulas developed by Andreev and Kingkade (2015), and are used in the Human Mortality Database methods protocol.
For a detailed description of the methods, see the vignette for poputils.
ax
ax
is the average number of years
lived in an age interval by people who
die in that interval. Demographers sometimes
refer to it as the 'separation factor'. If a non-NA
value of ax
is supplied for an age group,
then the results for that age group are based
on the formula
m_x = d_x / (n_x l_x + a_x d_x)
,
(where n_x
is the width of the age interval),
over-riding any methods specified via the infant
, child
,
closed
and open
arguments.
Open age group when inputs are qx
The probability of dying, qx
, is always 1 in the
final (open) age group. qx
therefore provides
no direct information on mortality conditions
within the final age group. lifetab()
and
lifeexp()
use conditions in the second-to-final
age group as a proxy for conditions in the final
age group. When open
is "constant"
(which
is currently the only option), and no value
for ax
in the final age group is provided,
lifetab()
and lifeexp()
assume
that m_A = m_{A-1}
, and set
L_{A} = l_A / m_A
.
In practice, mortality is likely to be higher
in the final age group than in the second-to-final
age group, so the default procedure is likely to
lead to inaccuracies. When the size of the final
age group is very small, these inaccuracies will
be inconsequential. But in other cases, it may
be necessary to supply an explicit value for
ax
for the final age group, or to use mx
rather than qx
as inputs.
Using rvecs to represent uncertainty
An rvec is a 'random vector',
holding multiple draws from a distribution.
Using an rvec for the mx
argument to
lifetab()
or lifeexp()
is a way of representing
uncertainty. This uncertainty is propagated
through to the life table values, which will
also be rvecs.
References
Preston SH, Heuveline P, and Guillot M. 2001. Demography: Measuring and Modeling Population Processes Oxford: Blackwell.
Coale AJ, Demeny P, and Vaughn B. 1983. Regional model life tables and stable populations New York: Academic Press.
Andreev, E.M. and Kingkade, W.W., 2015. Average age at death in infancy and infant mortality level: Reconsidering the Coale-Demeny formulas at current levels of low mortality. Demographic Research, 33, pp.363-390.
Human Mortality Database Methods Protocol.
See Also
-
ex_to_lifetab_brass()
Calculate life table from minimal inputs
Examples
library(dplyr)
## life table for females based on 'level 1'
## mortality rates "West" model life table
west_lifetab |>
filter(sex == "Female",
level == 1) |>
lifetab(mx = mx)
## change method for infant and children from
## default ("constant") to "CD"
west_lifetab |>
filter(sex == "Female",
level == 1) |>
lifetab(mx = mx,
sex = sex,
infant = "CD",
child = "CD")
## calculate life expectancies
## for all levels, using the 'by'
## argument to distinguish levels
west_lifetab |>
lifeexp(mx = mx,
sex = sex,
infant = "CD",
child = "CD",
by = level)
## obtain the same result using
## 'group_by'
west_lifetab |>
group_by(level) |>
lifeexp(mx = mx,
sex = sex,
infant = "CD",
child = "CD")
## calculations based on 'qx'
west_lifetab |>
lifeexp(qx = qx,
sex = sex,
by = level)