do_extrapolate: Wrapper for Extrapolating Old-Age Human Mortality Data Using...

Description Usage Arguments Value Source See Also Examples

View source: R/ExtrapolationMethods.R

Description

Wrapper for Extrapolating Old-Age Human Mortality Data Using Various Mortality Models ("laws")

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
do_extrapolate(
  X,
  x_fit,
  x_extr,
  law = c("kannisto", "kannisto_makeham", "makeham", "gompertz", "ggompertz", "beard",
    "beard_makeham", "quadratic"),
  verbose = TRUE,
  opt.method = "LF2",
  ...
)

Arguments

X

Input data. UN format.

x_fit

Ages to be considered in estimating the mortality model parameters. x_fit can be a subset of x. However, after the model is identifies fitted values and residuals are computed for all ages in x.

x_extr

Ages for which to extrapolate the death-rates.

law

The name of the mortality law/model to be used. The following options are available:

  • "kannisto" – The Kannisto model;

  • "kannisto_makeham" – The Kannisto-Makeham model;

  • "gompertz" – The Gompertz model;

  • "ggompertz" – The Gamma-Gompertz model;

  • "makeham" – The Makeham model;

  • "beard" – The Beard model;

  • "beard_makeham" – The Beard-Makeham model;

  • "quadratic" – The Quadratic model.

verbose

Logical value. If TRUE messages are printed as the method is applied. Set verbose = FALSE to silent the function.

opt.method

Optimization method to use. Default set to 'LF2'. See DemoTools::lt_rule_m_extrapolate for all available options.

...

Other arguments to be passed on to the MortalityLaw function.

Value

A data.frame having the same number of columns as input data. Different numbers of rows. UN format.

Source

The function is based on the methods implemented in the MortalityLaws R package.

See Also

lt_rule_m_extrapolate MortalityLaw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Example 1 - abridged data
# Extrapolate old-age mortality data
E <- do_extrapolate(X = DDSQLtools.data$Mx5,           # data - UN format
                    x_fit = c(75, 80, 85, 90),         # ages to be used in fitting
                    x_extr = c(90, 95, 100, 105, 110), # ages for which the extrapolation is applied
                    law = "kannisto")                  # the model

E

# Build 2 life table: 1st using the original data and the 2nd using the extended data
LT1 <- do_lifetable(X = DDSQLtools.data$Mx5)
LT2 <- do_lifetable(X = E)

LT1[LT1$IndicatorID == "ex", c("AgeStart", "DataValue")]
LT2[LT2$IndicatorID == "ex", c("AgeStart", "DataValue")]

dim(LT1)
dim(LT2) # note the 2nd life table has few extra rows

timriffe/DDSQLtools documentation built on Oct. 6, 2021, 5:34 p.m.