ineq_iqr | R Documentation |
Calculate the interquartile range survivorship age from a lifetable. Other quantile ranges can also be calculated.
ineq_iqr(age, lx, upper = 0.75, lower = 0.25)
age |
numeric. vector of lower age bounds. |
lx |
numeric. vector of the lifetable survivorship. |
upper |
numeric. upper survival quantile, default .75 |
lower |
numeric. lower survival quantile, defauly .25 |
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
).
MortalityLaws::MortalityLaw
ungroup::pclm
MortalitySmooth::Mort1Dsmooth
data(LT)
# The iqr range of survival age
iqr <- ineq_iqr(age=LT$Age,lx=LT$lx)
iqr
# age distance between 10th and 90th percentiles
idr <- ineq_iqr(age=LT$Age,lx=LT$lx,upper=.9,lower=.1)
idr
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.