LT: A function to build lifetables and extract certain lifetable...

Description Usage Arguments Details Value References See Also

View source: R/LT.r

Description

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.

Usage

1
2
3
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)

Arguments

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 = "auto". If "auto", the function tried to guess whether you have single-age data or 5-year abridged age groups. These are used in the lifetable labels, and do not enter into calculations. Otherwise, the user can specify a vector (character or numeric).

axmethod

either "keyfitz", "schoen", "preston" or "midpoint". Default = "keyfitz", although this is not recommended for abridged ages. See comparisons in axEstimate examples. The user can also supply a numeric vector of a(x) values here (e.g. from a different estimation procedure or from a different population).

sex

either "male" or "female" (default). It is only necessary to specify this if "preston" is the axmethod. It does not affect any other lifetable calculations.

mxsmooth

logical, default = TRUE. Should the mx vector be smoothed? If TRUE and both Nx and Dx vectors are supplied (the ideal case), smoothing is done using the function Mort1Dsmooth() from Giancarlo Camarda's MortalitySmooth package. In this case, Dx values are smoothed using log(Nx) as an offset, and all other items are the function defaults. If Mx is provided instead of Nx and Dx a loess smoother is used, loess, with span set to .15 for single age data and .4 for 5-year abridged data. If these smoothing procedures are not satisfactory, the user may wish to pre-process the Mx estimate and specify mxsmooth = FALSE, or else leave it rough.

axsmooth

logical, default = TRUE. Ignored if mxsmooth = TRUE. Should the a(x) values be calculated from a smoothed M(x) series? In this case, the M(x) series is smoothed within the axEstimate() function for a(x) estimation, but the smoothed M(x) function that was used is not returned. In general, it is better to smooth the M(x) function prior to putting it in this function, because the loess smoother used here has no weights or offset. If this is not possible, loess M(x) smoothing still produces more consistent and less erratic a(x) estimates. If mxsmooth = FALSE and axsmooth = TRUE, the Mx series is only smoothed for use in a(x) estimation, and does not affect any other lifetable calculations that are dependent on Mx.

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 = TRUE. Should informative but possibly annoying messages be returned when the function does something that you might want to know about?

Details

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.

Value

a list is invisibly returned

References

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) https://CRAN.R-project.org/package=MortalitySmooth.

See Also

MortalitySmooth, axEstimate.


MortHump documentation built on Jan. 24, 2018, 6:02 p.m.