do.MortalityModels: Fit Multiple Stochastic Mortality Models

Description Usage Arguments Examples

View source: R/do_MortalityModels.R

Description

Fit Multiple Stochastic Mortality Models

Usage

1
2
3
do.MortalityModels(data, data.B = NULL, x = NULL, y = NULL,
  data.in = c("qx", "mx", "dx", "lx"), models = c("MRWD"),
  verbose = TRUE, ...)

Arguments

data

A data.frame or a matrix containing mortality data with ages x as row and time y as column.

data.B

A data.frame or a matrix containing mortality data for the benchmark population. This dataset is needed only in the coherent mortality models (e.g. LiLee, OeppenC). Must be the same format as in data;

x

Numerical vector indicating the ages in input data. Optional. Default: NULL.

y

Numerical vector indicating the years in input data. Optional. Default: NULL.

data.in

Specify the type of input data. Various life table indices are accepted: "qx", "mx", "dx", "lx".

models

One or several mortality models to be estimated. The following options are available:

  • "MRW" – The Multivariate Random-Walk (w/o Drift);

  • "MRWD" – The Multivariate Random-Walk with Drift;

  • "LeeCarter" – The Lee-Carter Mortality Model;

  • "LiLee" – The Li-Lee Mortality Model;

  • "HyndmanUllah" – The Hyndman-Ullah Mortality Model;

  • "RenshawHaberman" – The Renshaw-Haberman Mortality Model;

  • "Oeppen" – The Oeppen Mortality Model;

  • "OeppenC" – The Coherent Oeppen Mortality Model;

  • "MEM2" – The Maximum Entropy Mortality Model of order 2;

  • "MEM3" – The Maximum Entropy Mortality Model of order 3;

  • "MEM4" – The Maximum Entropy Mortality Model of order 4;

  • "MEM5" – The Maximum Entropy Mortality Model of order 5;

  • "MEM6" – The Maximum Entropy Mortality Model of order 6;

  • "MEM7" – The Maximum Entropy Mortality Model of order 7;

verbose

A logical value. Set verbose = FALSE to silent the process that take place inside the function and avoid progress messages.

...

Arguments to be passed to or from other methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
x  <- 0:100      # Ages
y  <- 2005:2016  # Years
h  <- 16         # forecasting horizon
MM <- c("MRWD", "LeeCarter", "LiLee", "HyndmanUllah", 
        "Oeppen", "OeppenC", "MEM5", "RenshawHaberman") # mortality models
D  <- HMD_male$dx$GBRTENW[paste(x), paste(y)]  # data
B  <- HMD_female$dx$GBRTENW[paste(x), paste(y)]  # benchmark population

# Note: We are fitting various mortality model to E&W males data. Most of them 
# are single population model i.e. the estimates are resulted only from data 
# specific to that population. However, the coherent models like "OeppenC" or 
# "LiLee" require additional data. In these cases, here, female data is used.


M <- do.MortalityModels(data = D, 
                        data.B = B,
                        x = x, 
                        y = y, 
                        data.in = "dx", 
                        models = MM)

P <- do.MortalityForecasts(object = M, 
                           h = h, 
                           level = 95, 
                           jumpchoice = "actual")

oex <- get.Observed(M, data.out = "ex")
fex <- get.Fitted(M, data.out = "ex")
rex <- get.Residuals(M, data.out = "ex")
pex <- get.Forecasts(P, data.out = "ex")

mpascariu/MortalityForecast documentation built on Sept. 28, 2020, 2:40 p.m.