lt_id_morq_a_greville: UN version of the Greville formula for a(x) from M(x)

View source: R/nAx.R

lt_id_morq_a_grevilleR Documentation

UN version of the Greville formula for a(x) from M(x)

Description

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 thereafter. In the original sources these are referred to as separation factors.

Usage

lt_id_morq_a_greville(
  nMx,
  nqx,
  lx,
  Age,
  AgeInt = age2int(Age, OAvalue = 5),
  a0rule = "ak",
  IMR = NA,
  Sex = "m",
  region = "w",
  mod = TRUE,
  SRB = 1.05,
  closeout = TRUE,
  extrapLaw = "kannisto",
  extrapFrom = max(Age),
  extrapFit = Age[Age >= 60],
  ...
)

Arguments

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.

Age

integer. Vector of lower bounds of abridged age groups.

AgeInt

integer. Vector of age group intervals.

a0rule

character. Either "ak" (default) or "cd".

IMR

numeric. Optional. q0, the death probability in first year of life, in case available separately.

Sex

character. "m", "f" or "b" for male, female, or both.

region

character. ⁠"n",⁠ "e", "s" or "w" for North, East, South, or West.

mod

logical. Whether or not to use Gerland's modification for ages 5-14. Default TRUE.

SRB

numeric. The sex ratio at birth (boys/girls), default 1.05.

closeout

logical. Whether or not to estimate open age a(x) via extrapolation. Default TRUE.

extrapLaw

character. The following options are available:

  • "kannisto" – The Kannisto model;

  • "kannisto_makeham" – The Kannisto-Makeham model;

  • "gompertz" – The Gompertz model;

  • "ggompertz" – The Gamma-Gompertz model;

  • "makeham" – The Makeham model;

  • "beard" – The Beard model;

  • "beard_makeham" – The Beard-Makeham model;

  • "quadratic" – The Quadratic model.

extrapFrom

integer. Age from which to impute extrapolated mortality.

extrapFit

integer vector. Ages to include in model fitting. Defaults to all ages > =60.

...

Other arguments to be passed on to the MortalityLaw function.

Details

a(x) for age 0 and age group 1-4 are based on Coale-Demeny q0-based lookup tables. An approximation to get from M(0) to q0 for the sake of generating a(0) and 4a1 is used. The final a(x) value is closed out using the lt_a_closeout() method (reciprocal and Mortpak methods are deprecated). Age groups must be standard abridged. No check on age groups is done.

There are different vectors one can specify for this method: ultimately it's either nMx or nqx, and the nax, but nax results should be reasonably close. For full convergence implying transitivity, instead use lt_a_un()

Value

nax average contribution to exposure of those dying in the interval.

References

\insertRef

greville1977shortDemoTools \insertRefun1982modelDemoTools \insertRefarriaga1994populationDemoTools \insertRefmortpak1988DemoTools

See Also

lt_a_closeout

Examples

#Example witn Mexican data from UN
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.08098,
0.15353,0.2557)

nqx <- c(0.10793,0.08554,0.02025,0.01053,0.01463,0.02071,0.02515,0.02999,
0.03507, 0.03958,0.04742,0.0606,0.08381,0.11992,0.17391,0.2454,0.33672,
0.54723,NA)

lx  <- c(100000,89207,81577,79924,79083,77925,76312,74393,72162,69631,66875,
63704,59843,54828,48253,39861,30079,19951,9033)

Age <- c(0,1,seq(5,85,by = 5))
AgeInt <- age2int(Age, OAvalue = 5)
# two quite different results depending whether you start with mx or qx
lt_id_morq_a_greville(nMx = nMx, 
                      Age = Age, 
                      AgeInt = AgeInt, 
                      Sex = 'f',
                      region = 'w')
lt_id_morq_a_greville(nqx = nqx, 
                      Age = Age, 
                      AgeInt = AgeInt, 
                      Sex = 'f',
                      region = 'w')
# same, qx comes from lx (Except OAG, because qx closed above w NA)
lt_id_morq_a_greville(lx = lx, 
                      Age = Age, 
                      AgeInt = AgeInt, 
                      Sex = 'f',
                      region = 'w')
# both qx and lx given, but lx not used for anything = same as qx
lt_id_morq_a_greville(nqx = nqx, 
                      lx = lx, 
                      Age = Age, 
                      AgeInt = AgeInt, 
                      Sex = 'f',
                      region = 'w')
#'
# nMx taken over lx.
lt_id_morq_a_greville(nMx = nMx,  
                      lx = lx, 
                      Sex = 'f', 
                      Age = Age, 
                      AgeInt = AgeInt, 
                      region = 'w')

# example of transitivity. UN ax method is iterative
# and used greville on the inside

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))


timriffe/DemoTools documentation built on Oct. 14, 2024, 12:53 p.m.