View source: R/MakeLifeTable.R
MakeLifeTable | R Documentation |
This function calculates a standard cohort-based life table from death ages.
MakeLifeTable(DeathAges, ax = 0.5, n = 1)
DeathAges |
A vector of ages at death. These can be precise (e.g. 5.4 yrs) or rounded to the integer year (e.g. 5 yrs). |
ax |
A vector describing the average proportion of the interval lived by those dying in the interval. Note that this is slightly different from convention, which defines ax as the average length of time lived in the interval by those dying in the interval. This is so we can cope automatically with varying interval sizes. Further note that the |
n |
Defines the interval width. The default is 1 (yr), but it can be set to be any numerical value(s). For example, if you want small intervals for early ages, and larger intervals for older ages, you can define n as a sequence such as |
The function returns a data.frame
in the form of a life table with the following column headings.
Start and end of the interval, where start of the interval is defined as x, lx (number alive at age x (i.e. at the start of the interval)), nx the size of the interval, dx (number dying between ages x and x+n), mx (death rate in the cohort between ages x and x+n), ax (average time lived in the interval by those dying in the interval), qx (probability of dying between ages x and x+n), px (probability of surviving between ages x and x+n), Lx (‘person’ years lived between ages x and x+n), Tx (‘person’ years lived above age x), ex (life expectancy at age x).
Owen Jones jones@biology.sdu.dk
Preston, S.H., Heuveline, P. and Guillot, M. (2001) Demography: Measuring and modeling population processes. Blackwell Publishers, Oxford, UK.
basta
MakeLifeTable(rpois(100,3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.