ineq_theil: ineq_theil

View source: R/indices.R

ineq_theilR Documentation

ineq_theil

Description

Calculate a lifetable column for the conditional Theil index of inequality in survivorship

Usage

ineq_theil(age, dx, ex, ax, distribution_type = c("aad", "rl"), check = TRUE)

Arguments

age

numeric. vector of lower age bounds.

dx

numeric. vector of the lifetable death distribution.

ex

numeric. vector of remaining life expectancy.

ax

numeric. vector of the average time spent in the age

distribution_type

character. Either "aad" (age at death) or "rl" (remaining life)

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

References

\insertRef

theil1967economicsLifeIneq \insertRefvanraalte2012LifeIneq \insertRefhakkert1987LifeIneq \insertRefcowell1980LifeIneq

See Also

MortalityLaws::MortalityLaw

ungroup::pclm

MortalitySmooth::Mort1Dsmooth

Examples

data(LT)
# A vector containing the conditional Theil indices
Ta = ineq_theil(age=LT$Age,dx=LT$dx,ex=LT$ex,ax=LT$ax, distribution_type = "aad")
# The Theil index from birth
Ta[1]
# The Theil index conditional upon survival to age 10
Ta[11]

# A shortfall (remaining years) version of the same:
Tr = ineq_theil(age=LT$Age,dx=LT$dx,ex=LT$ex,ax=LT$ax, distribution_type = "rl")
Tr[1]
Tr[11]
## Not run: 
plot(0:110, Tr, type='l',col="red",ylab="conditional Theil",xlab="Age")
lines(0:110, Ta, col = "blue")
legend("topleft",col = c("red","blue"), lty=1,legend = c("remaining life","age at death"))

## End(Not run)

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