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

do_extrapolate(
  X,
  x_fit,
  x_extr,
  law = c("kannisto", "kannisto_makeham", "makeham", "gompertz", "ggompertz", "beard",
    "beard_makeham", "quadratic"),
  verbose = TRUE,
  opt.method = "LF2",
  ...
)

Source

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

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.

Examples

# 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
#> Additional (optional) arguments to control the output for the DemoTools::lt_rule_m_extrapolate method:
#> opt.method ...
#> Check ?lt_rule_m_extrapolate for details and default values.

E
#> # A tibble: 24 × 13
#>    LocID ReferencePeriod DataValue AgeStart AgeSpan SexID IndicatorID DataTypeID
#>    <int>           <int>     <dbl>    <dbl>   <dbl> <dbl> <chr>       <chr>     
#>  1   328            1993   0.0297         0       1     1 nMx         "do_extra…
#>  2   328            1993   0.00665        1       4     1 nMx         "do_extra…
#>  3   328            1993   0.00343        5       5     1 nMx         "do_extra…
#>  4   328            1993   0.00378       10       5     1 nMx         "do_extra…
#>  5   328            1993   0.00707       15       5     1 nMx         "do_extra…
#>  6   328            1993   0.0134        20       5     1 nMx         "do_extra…
#>  7   328            1993   0.0184        25       5     1 nMx         "do_extra…
#>  8   328            1993   0.0223        30       5     1 nMx         "do_extra…
#>  9   328            1993   0.0257        35       5     1 nMx         "do_extra…
#> 10   328            1993   0.0361        40       5     1 nMx         "do_extra…
#> # … with 14 more rows, and 5 more variables: DataTypeName <chr>,
#> #   AgeLabel <dbl>, AgeMid <dbl>, AgeEnd <dbl>, AgeID <dbl>

# Build 2 life table: 1st using the original data and the 2nd using the extended data
LT1 <- do_lifetable(X = DDSQLtools.data$Mx5)
#> Additional (optional) arguments to control the output for the DemoTools::lt_abridged method:
#> Deaths Exposures nMx nqx lx AgeInt radix axmethod a0rule Sex IMR region mod SRB OAnew extrapLaw extrapFrom extrapFit ...
#> Check ?lt_abridged for details and default values.
LT2 <- do_lifetable(X = E)
#> Additional (optional) arguments to control the output for the DemoTools::lt_abridged method:
#> Deaths Exposures nMx nqx lx AgeInt radix axmethod a0rule Sex IMR region mod SRB OAnew extrapLaw extrapFrom extrapFit ...
#> Check ?lt_abridged for details and default values.

LT1[LT1$IndicatorID == "ex", c("AgeStart", "DataValue")]
#> # A tibble: 20 × 2
#>    AgeStart DataValue
#>       <int>     <dbl>
#>  1        0     42.0 
#>  2        1     42.2 
#>  3        5     39.3 
#>  4       10     34.9 
#>  5       15     30.5 
#>  6       20     26.6 
#>  7       25     23.2 
#>  8       30     20.2 
#>  9       35     17.3 
#> 10       40     14.3 
#> 11       45     11.7 
#> 12       50      9.21
#> 13       55      7.23
#> 14       60      5.70
#> 15       65      4.67
#> 16       70      3.69
#> 17       75      2.85
#> 18       80      2.75
#> 19       85      2.65
#> 20       90      2.63
LT2[LT2$IndicatorID == "ex", c("AgeStart", "DataValue")]
#> # A tibble: 24 × 2
#>    AgeStart DataValue
#>       <int>     <dbl>
#>  1        0      42.0
#>  2        1      42.2
#>  3        5      39.3
#>  4       10      34.9
#>  5       15      30.5
#>  6       20      26.6
#>  7       25      23.2
#>  8       30      20.2
#>  9       35      17.3
#> 10       40      14.3
#> # … with 14 more rows

dim(LT1)
#> [1] 180  13
dim(LT2) # note the 2nd life table has few extra rows
#> [1] 216  13