lt_a_un | R Documentation |
The UN a(x) formula uses Coale-Demeny for ages 0, and 1-4, values of 2.5 for ages 5-9 and 10-14, and the Greville formula for higher ages. In the original sources these are referred to as separation factors.
lt_a_un(
nMx,
nqx,
lx,
IMR = NA,
Age,
AgeInt,
a0rule = "ak",
Sex = "m",
region = "w",
SRB = 1.05,
tol = .Machine$double.eps,
maxit = 1000,
mod = TRUE,
extrapLaw = "kannisto",
extrapFrom = max(Age),
extrapFit = Age[Age >= 60],
...
)
nMx |
numeric. Event exposure mortality rates. |
nqx |
numeric. Vector of age specific death probabilities in standard abridged age groups. |
lx |
numeric. Vector of lifetable survivorship in standard abridged age groups. |
IMR |
numeric. Optional. q0, the death probability in first year of life, in case available separately. |
Age |
integer. A vector of ages of the lower integer bound of the age classes. |
AgeInt |
integer. Vector of age interval widths. |
a0rule |
character. Either |
Sex |
character. |
region |
character. |
SRB |
numeric. The sex ratio at birth (boys/girls), default 1.05. |
tol |
numeric. The tolerance for the qx-based iterative method. Default |
maxit |
integer. The maximum number of iterations for the qx-based iterative method. Default 1000. |
mod |
logical. Whether or not to use Gerland's modification for ages 5-14. Default |
extrapLaw |
character. If extrapolating, which parametric mortality law should be invoked? Options include |
extrapFrom |
integer. Age from which to impute extrapolated mortality. |
extrapFit |
integer vector. Ages to include in model fitting. Defaults to all ages |
... |
Other arguments to be passed on to the
|
a(x) for age 0 and age group 1-4 are based on Coale-Demeny q0-based lookup tables. If the main input is nMx
, and if IMR
is not given, we first approximate q0 for the Coale-Demeny approach before applying the formula. The final a(x) value is closed out using the lt_a_closeout()
method (reciprocal and Mortpak methods are deprecated). For nMx inputs this method is rather direct, but for qX or l(x) inputs it is iterative. Age groups must be standard abridged. No check on age groups are done.
nax average contribution to exposure of those dying in the interval.
greville1977shortDemoTools \insertRefun1982modelDemoTools \insertRefarriaga1994populationDemoTools \insertRefmortpak1988DemoTools
# example data from UN 1982 Model Life Tables for Developing Countries.
# first Latin American model table for males (p. 34).
Mx <- c(.23669,.04672,.00982,.00511,.00697,.01036,.01169,
.01332,.01528,.01757,.02092,.02517,.03225,.04241,.06056,
.08574,.11840,.16226,.23745)
ax <- c(0.330,1.352,2.500,2.500,2.633,2.586,2.528,2.528,
2.526,2.529,2.531,2.538,2.542,2.543,2.520,2.461,2.386,2.295,4.211)
AgeInt <- inferAgeIntAbr(vec = Mx)
Age <- int2age(AgeInt)
nAx1 <- lt_a_un(nMx = Mx,
Age = Age,
AgeInt = AgeInt,
a0rule = "cd",
Sex = "m",
region = "w",
mod = FALSE)
nAx2 <- lt_a_un(nMx = Mx,
Age = Age,
AgeInt = AgeInt,
a0rule = "cd",
Sex = "m",
region = "w",
mod = TRUE)
# this is acceptable...
round(nAx2,3) - ax # only different in ages 5-9 and 10-14, and last two ages
# ignore open age, which is treated differently
N <- length(ax)
# default unit test...
stopifnot(all(round(nAx1[Age<80],3) - ax[Age<80] == 0)) # spot on
# another example:
nMx <- c(0.11621,0.02268,0.00409,0.00212,0.00295,
0.00418,0.00509,0.00609,0.00714,0.00808,
0.00971,0.0125,0.0175,0.02551,0.03809,
0.05595,0.0809,0.15353,0.2557)
AgeInt <- inferAgeIntAbr(vec = nMx)
Age <- int2age(AgeInt)
nAx1 <- lt_a_un(nMx,
Age = Age,
AgeInt = AgeInt,
a0rule = "ak",
mod = TRUE,
closeout = TRUE)
nqx <- lt_id_ma_q(nMx = nMx,
nax = nAx1,
AgeInt = AgeInt,
closeout = FALSE)
nAx2 <- lt_a_un(nqx = nqx,
Age = Age,
AgeInt = AgeInt,
a0rule = "ak",
mod= TRUE,
closeout = TRUE)
stopifnot(all(abs(nAx1[Age<75] - nAx2[Age<75]) < 1e-7))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.