| LT | R Documentation |
Accepts either single age or 5-year abridged data. Accepts many optional arguments, such as differing methods for a(x) estimation, optional smoothing for M(x) or a(x) values, a changeable radix.
LT(Nx = NULL, Dx = NULL, Mx = Dx/Nx,
ages = 0:(length(Mx) - 1), axmethod = "midpoint",
sex = "female", mxsmooth = TRUE, axsmooth = TRUE,
radix = 1, verbose = TRUE)
Nx |
numeric vector of population exposures by age. |
Dx |
numeric vector of death counts by age. |
Mx |
numeric vector of central death rates (assumed in the function to be the lifetable m(x)), calculated as deaths/exposure. |
ages |
optional, default = |
axmethod |
either |
sex |
either |
mxsmooth |
logical, default = |
axsmooth |
logical, default = |
radix |
The lifetable starting population at age 0, l(0). default = 1. Other common values are 1000 and 100000, although any value may be given. |
verbose |
logical, default = |
Either Nx must be specified along with Dx,
*or* Mx must be specified directly. If smoothing
is used, it is better to specify both Nx and
Dx, since the Nx vector can be used as an
offset in the MortalitySmooth smoother.
a list is invisibly returned
LT A
data.frame with 11 columns and as many rows as you
have ages. The columns are "Age" (character age labels,
i.e. with "+"), "ages" (numeric), "mx", "ax", "qx",
"px", "lx", "dx", "Lx", "Tx", "ex". All the individual
components of the lifetable can be called and are
unrounded when individually called. Some additional
values are also available:
Age character
vector of ages. Denotes intervals in the case of an
abridged table.
ages numeric vector of
ages. Left side of interval.
mx the
lifetable mx (may differ from a given Mx).
ax Chiang's ax, either given by the user or
estimated in axEstimate.
qx typical
lifetable qx. Death probability for interval x, x + n.
lx typical lifetable lx. Number of radix
individuals entering age x. l(0) = the radix population.
dx typical lifetable dx. When radix =
1 (default), this is the probability density function of
deaths.
Lx typical lifetable Lx. Lifetable
exposure for the interval x,x+n.
Tx typical
lifetable Tx. Total number of years remaining to be lived
by the cohort entering age x.
ex typical
lifetable ex. Life remaining life expectancy at age x.
e(0) = life expectancy at birth. Two other estimates of
e(0) are given below.
Sx probability of
surviving from age x until age x + n (L_x+n/L_x).
Widths vector of age intervals (n).
The main reference for this function has been:
Preston et al (2001). Demography: Measuring and Modelling Population Processes. Blackwell Publishing
ax estimation also received input from:
Chiang C.L.(1968) Introduction to Stochastic Processes in Biostatistics. New York: Wiley.
Coale Anseley and Paul Demeny, with B Vaughan (1983). Regional Model Life Tables and Stable Populations. New York Academic Press.\ Keyfitz, Nathan (1966) A Life Table that Agrees with the Data. Journal of the American Statistical Association, 61 (314):305-12. As described on page 44-45 of: Schoen R. (1978) Calculating lifetables by estimating Chiang's a from observed rates. Demography 15: 625-35.
function calls MortalitySmooth: Carlo G Camarda
(2009) MortalitySmooth: Smoothing Poisson counts with
P-splines. (version 2.3 at the time of this writing)
http://CRAN.R-project.org/package=MortalitySmooth.
MortalitySmooth, axEstimate.
## Not run:
library(LifeTable)
data(UKRmales1965)
head(UKRmales1965)
Nx <- UKRmales1965[, 3]
Dx <- UKRmales1965[, 2]
# comparing different estimates of life expectancy based on whether mx or ax smoothing
# is used (no major differences). Could also just specify Mx directly instead of both Nx and Dx.
# if you want to smooth the mx, better to use Nx and Dx together instead of Mx.
LT(Nx, Dx, axsmooth = TRUE)$ex[1]
LT(Nx, Dx, axsmooth = FALSE)$ex[1]
LT(Nx, Dx, mxsmooth = FALSE, axsmooth = FALSE)$ex[1]
LT(Nx, Dx, mxsmooth = FALSE, axsmooth = TRUE)$ex[1]
# now comparing life expectancy estimates depending on the ax estimation method used (no major differences)
LT(Nx, Dx, axmethod = "keyfitz", mxsmooth = FALSE)$ex[1]
LT(Nx, Dx, axmethod = "schoen")$ex[1]
LT(Nx, Dx, axmethod = "preston")$ex[1]
# there are tons more combinations of with/without smoothing, ax methods...
# here a graph with the major functions:
LT1 <- LT(Nx, Dx, axmethod = "keyfitz", mxsmooth = TRUE)
plot(LT1$ages, LT1$lx, type = 'l', col = "blue", main = "major lifetable functions, UKR 1965 (HMD)",
xlab = "age", ylab = "lx ; dx*10 ; mux")
lines(LT1$ages, LT1$mx, col = "red")
lines(LT1$ages, LT1$dx * 10, col = "orange", type = 'l')
legend("topright", lty = 1, col = c("blue", "orange", "red"), legend = c("l(x)", "d(x) * 10", "mux"), bg = "white")
######### with 5-year age groups:
data(UKR5males1965)
head(UKR5males1965)
Nx <- UKR5males1965[, 3]
Dx <- UKR5males1965[, 2]
LT5 <- LT(Nx, Dx, ages=c(0,1,seq(5,110,by=5)), axmethod = "schoen", mxsmooth = FALSE, axsmooth = FALSE)
plot(LT5$ages, LT5$lx, type = 'l', col = "blue", main = "major lifetable functions, UKR 1965 (HMD)", xlab = "age", ylab = "lx ; dx * 10 ; mux")
lines(LT5$ages, LT5$mx, col = "red")
lines(LT5$ages, c(LT5$dx[1], LT5$dx[2] / 4, LT5$dx[3:24] / 5) * 10, col = "orange", type = 'l')
legend("topright", lty = 1, col = c("blue", "orange", "red"), legend = c("l(x)", "d(x) * 10", "mux"), bg = "white")
######### just want a nice Sx vector for your Leslie matrix?:
Sx <- LT1$Sx
plot(Sx)
# don't worry, the last Sx is already the ratio of the last Tx divided by the penultimate Tx
## End(Not run)