ineq_mad: ineq_mad

View source: R/indices.R

ineq_madR Documentation

ineq_mad

Description

Calculate a lifetable column for the conditional mean absolute deviation in lifetable ages at death. This may be with respect to either conditional life expectancy or conditional median remaining lifespan.

Usage

ineq_mad(
  age,
  dx,
  lx,
  ex,
  ax,
  center_type = c("ex", "mean", "median"),
  check = TRUE
)

Arguments

age

numeric. vector of lower age bounds.

dx

numeric. vector of the lifetable death distribution.

lx

numeric. vector of the lifetable survivorship.

ex

numeric. vector of remaining life expectancy.

ax

numeric. vector of the average time spent in the age interval of those dying within the interval.

center_type

character either, "ex", "mean" (same thing), or "median"

check

logical. Shall we perform basic checks on input vectors? Default TRUE

Details

All input vectors must be the same length. Also, we recommend using input data from a life table by single year of age with a highest age group of at least age 110. If your data have a lower upper age bound, consider extrapolation methods, for instance a parametric Kannisto model (implemented in MortalityLaws::MortalityLaw). If your data are abridged, consider first smoothing over age, and calculating a life table by single year of age (for instance by smoothing with a pclm model in package ungroup or with a penalized B-spline approach in package MortalitySmooth).

This measure has not to our knowledge been used in the lifespan inequality literature. It is used more often in the literature on forecast evaluation or mortality estimation. But it makes sense according to us, so we include it. Values are on the same scale (years) and qualitatively comparable with both e-dagger, AID, or the standard deviation (See example plot).

See Also

MortalityLaws::MortalityLaw

ungroup::pclm

MortalitySmooth::Mort1Dsmooth

Examples


data(LT)
# A vector containing the conditional MAD in age at death 
M = ineq_mad(age=LT$Age,dx=LT$dx,lx=LT$lx,ex=LT$ex,ax=LT$ax)
# The MAD in age at death from birth
M[1]
# The MAD in age at death conditional upon survival to age 10
M[11]
# MAD wrt conditional median
ineq_mad(age = LT$Age, dx = LT$dx,
  lx = LT$lx, ex = LT$ex, ax = LT$ax, 
  center_type = "median")
## Not run: 
plot(age, M, type = "l", ylim = c(0,15))
lines(age, ineq_edag(age = LT$Age, dx = LT$dx, lx = LT$lx, ex = LT$ex, ax = LT$ax), col = "red")
lines(age, ineq_aid(age = LT$Age, dx = LT$dx, ex = LT$ex, ax = LT$ax), col = "blue")
lines(age, ineq_sd(age = LT$Age, dx = LT$dx, ex = LT$ex, ax = LT$ax), col = "forestgreen")
legend("bottomleft",legend = c("MAD","e-dagger","AID","sd"),
col = c("black","red","blue","forestgreen"),lty=1)

## End(Not run)

alysonvanraalte/LifeIneq documentation built on March 12, 2024, 1:42 p.m.