model.MEM: The Maximum-Entropy Mortality Model

Description Usage Arguments Details Value References See Also Examples

View source: R/model_MEM.R

Description

The Maximum-Entropy Mortality Model

Usage

1
model.MEM(data, x = NULL, y = NULL, n = 5, verbose = FALSE, ...)

Arguments

data

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

x

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

y

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

n

The maximum order of the moments to be used.

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.

Details

\insertNoCite

pascariu_phd2018MortalityForecast

Value

The output is an object of class MEM with the components:

input

List with arguments provided in input. Saved for convenience;

info

Short details about the model;

call

An unevaluated function call, that is, an unevaluated expression which consists of the named function applied to the given arguments;

coefficients

Estimated coefficients;

fitted.values

Fitted values of the estimated model;

observed.values

Observed values used in fitting;

fitted.raw.moments

Fitted raw moments;

observed.raw.moments

Observed raw moments of the input data;

residuals

Deviance residuals;

random.walk.model

Object containing the components of the fitted time series model to the extrapolate moments;

x

Vector of ages used in the fitting;

y

Vector of years used in the fitting.

References

\insertAllCited

See Also

predict.MEM plot.MEM find.moments

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
# Data
x  <- 0:110
y  <- 1985:2014
dx <- HMD_male$dx$GBRTENW[paste(x), paste(y)]

# Fit model the Maximum-Entropy Mortality of order 5,
# that is using the first 6 statistical moments (moment 0 to 5).

M <- model.MEM(data = dx, x = x, y = y, n = 5)
M
R <- residuals(M)

plot(M, plotType = "observed")
plot(M, plotType = "fitted")

plot(R, plotType = "scatter")
plot(R, plotType = "colourmap")
plot(R, plotType = "signplot")

# Perform forecasts
P <- predict(M, h = 16, x.h = 0:120)

plot(P, plotType = "mean")
plot(P, plotType = "lower")
plot(P, plotType = "upper")

plot(P, M, plotType = "raw_moments")
plot(P, M, plotType = "normalised_moments")

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