View source: R/analytical_functions.R
life.table | R Documentation |
life.table
calculates
life table(s).
The algorithm is optimised for deceased populations
encountered in archaeological research.
See Chamberlain 2006, 27ff., Herrmann et. al 1990, 303ff.,
Kokkotidis/Richter 1991, Keyfitz et al. 2005
for selected literature.
The function takes an individual data.frame or a list of
data.frames and returns an object of class mortaar_life_table
or mortaar_life_table_list, for which specialised summary,
print and plot functions exist.
life.table(neclist, agecor = TRUE, agecorfac = c(), option_spline = NULL)
neclist |
single data.frame or list of data.frames with the columns 'x', 'a', 'Dx'.
|
agecor |
logical, optional. If set TRUE, the average number of years lived within a given age class of individuals having died in this class can be adjusted via agecorfac. If set FALSE, it is assumed that they died in the middle of this class. Due to the higher mortality rates of infants, this assumption is certainly inaccurate for individuals <= 5 years. Default setup is: TRUE. |
agecorfac |
numeric vector, optional. Only applies if agecor == TRUE. Given values replace the standard values from the first age interval onward. Default setup is 1/3 for every age class <= 5 life years, and 1/2 for the others. |
option_spline |
integer, optional. If > 0, values for adults will be interpolated by a monotonic cubic spline. Usual options will by '10' or '20' which will interpolate the values for individuals of an age of 20 or older by 10- or 20- year cumulated values. To be used carefully, as diagnostic features of the life table might be smoothed and essentially removed. Only available when the methods 'Standard' or 'Equal5' in prep.life.table have been chosen. |
An object of class mortaar_life_table or mortaar_life_table_list. Each mortaar_life_table contains the following variables:
x: age interval.
a: years within x.
Ax: average number of years lived by an individual that died within a specific age class x :
A_{x} = a_{x} * agecorfac_{x}
Dx: number of deaths within x.
dx: proportion of deaths within x (percent) :
d_{x} = \frac{D_{x}}{\sum_{i=1}^{n} D_{i}} * 100
lx: survivorship within x (percent) :
l_{x+1} = l_{x} - d_{x}
with l_{0} = 100
qx: probability of death within x (percent) :
q_{x} = \frac{d_{x}}{l_{x}}* 100
Lx: number of years lived within x by those that died within x and those that reached the next age class :
L_{x} = (a_{x} * l_{x}) - ((a_{x} - A_{x}) * d_{x})
Tx: sum of years lived within current and remaining x :
T_{x+1} = T_{x} - L_{x}
with T_{0} = \sum_{i=1}^{n}{L_{i}}
ex: average years of life remaining (average life expectancy at mean(x)) :
e_{x} = \frac{T_{x}}{l_{x}}
rel_popx: percentage of L(x) of the sum of L(x) :
relpopx_{x} = \frac{L_{x}}{\sum_{i=1}^{n}{L_{i}}} * 100
chamberlain_demography_2006mortAAR
\insertRefherrmann_prahistorische_1990mortAAR
\insertRefkeyfitz_applied_2005mortAAR
\insertRefkokkotidis_graberfeld-_1991mortAAR
# Create a mortaar_life_table from a prepared dataset.
schleswig_1 <- life.table(schleswig_ma[c("a", "Dx")])
print(schleswig_1)
plot(schleswig_1, display = "lx")
# Create a mortaar_life_table_list from two datasets.
odagsen <- life.table(list(
"corpus mandibulae" = odagsen_cm[c("a", "Dx")],
"margo orbitalis" = odagsen_mo[c("a", "Dx")]
))
print(odagsen)
plot(odagsen, display = "ex")
# Prepare a real world dataset and create a mortaar_life_table.
library(magrittr)
magdalenenberg %>%
replace(. == "60-x", "60-70") %>%
tidyr::separate(a, c("from", "to")) %>%
dplyr::mutate(from = as.numeric(from), to = as.numeric(to)) %>%
prep.life.table(
dec = "Dx",
agebeg = "from",
ageend = "to",
method = "Standard",
agerange = "excluded"
) %>%
life.table()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.