lt_abridged2single: create a life table by single year of age by graduating an...

View source: R/lt_regroup_age.R

lt_abridged2singleR Documentation

create a life table by single year of age by graduating an abridged life table

Description

Computes single year of age life table by graduating the mortality schedule of an abridged life table, using the ungroup::pclm() to ungroup binned count data. Returns complete single-age lifetable.

Usage

lt_abridged2single(
  Deaths = NULL,
  Exposures = NULL,
  nMx = NULL,
  nqx = NULL,
  lx = NULL,
  Age,
  radix = 1e+05,
  axmethod = "un",
  a0rule = "ak",
  Sex = "m",
  region = "w",
  IMR = NA,
  mod = TRUE,
  SRB = 1.05,
  OAG = TRUE,
  OAnew = max(Age),
  extrapLaw = NULL,
  extrapFrom = max(Age),
  extrapFit = NULL,
  ...
)

Arguments

Deaths

numeric. Vector of death counts in abridged age classes.

Exposures

numeric. Vector of population exposures in abridged age classes.

nMx

numeric. Vector of mortality rates in abridged age classes.

nqx

numeric. Vector of conditional death probabilities in abridged age classes.

lx

numeric. Vector of lifetable survivorship at abridged ages.

Age

integer. A vector of ages of the lower integer bound of the age classes.

radix

numeric. Lifetable radix, l0. Default 100000.

axmethod

character. Either "pas" or "un".

a0rule

character. Either "ak" (default) or "cd".

Sex

character. Either male "m", female "f", or both "b".

region

character. North, East, South, or West: "n", "e", "s", "w". Default "w".

IMR

numeric. Infant mortality rate q0, in case available and nqx is not specified. Default NA.

mod

logical. If "un" specified for axmethod, whether or not to use Nan Li's modification for ages 5-14. Default TRUE.

SRB

the sex ratio at birth (boys / girls), default 1.05

OAG

logical. Whether or not the last element of nMx (or nqx or lx) is an open age group. Default TRUE.

OAnew

integer. Desired open age group (5-year ages only). Default max(Age). If higher then rates are extrapolated.

extrapLaw

character. If extrapolating, which parametric mortality law should be invoked? Options include "Kannisto", "Kannisto_Makeham", "Makeham", "Gompertz", "GGompertz", "Beard", "Beard_Makeham", "Quadratic". Default "Kannisto" if the highest age is at least 90, otherwise "makeham". See details.

extrapFrom

integer. Age from which to impute extrapolated mortality.

extrapFit

integer vector. Ages to include in model fitting. Defaults to all ages > =60.

...

optional arguments passed to pclm(). For example, if you pass an explicit lambda parameter via the control argument, you can speed up estimation

Details

Similar to lt_abridged() details, forthcoming.

Value

Single-year lifetable in data.frame with columns

  • Age integer. Lower bound of single year age class

  • AgeInt integer. Age class widths.

  • nMx numeric. Age-specific central death rates.

  • nAx numeric. Average time spent in interval by those deceased in interval.

  • nqx numeric. Age-specific conditional death probabilities.

  • lx numeric. Lifetable survivorship

  • ndx numeric. Lifetable deaths distribution.

  • nLx numeric. Lifetable exposure.

  • Sx numeric. Survivor ratios.

  • Tx numeric. Lifetable total years left to live above age x.

  • ex numeric. Age-specific remaining life expectancy.

Examples

 Mx <- c(.23669,.04672,.00982,.00511,.00697,.01036,.01169,
         .01332,.01528,.01757,.02092,.02517,.03225,.04241,.06056,
         .08574,.11840,.16226,.23745)
 Age = c(0,1,seq(5,85,by=5))
 AgeInt <- inferAgeIntAbr(vec = Mx)
 LTabr <- lt_abridged(nMx = Mx,
                      Age = Age, 
                      axmethod = "un",
                      Sex = "m",
                      mod = TRUE)
 
 LT1 <- lt_abridged2single(nMx = Mx,
                    Age = Age, 
                    axmethod = "un",
                    Sex = "m",
                    mod = TRUE)
LTabr$ex[1]
LT1$ex[1]
## Not run: 
plot(Age, LTabr$nMx,type = 's', log = 'y')
lines(LT1$Age, LT1$nMx)

plot(Age, LTabr$lx,type='S')
lines(LT1$Age, LT1$lx)

## End(Not run)

timriffe/DemoTools documentation built on Oct. 14, 2024, 12:53 p.m.