# StMoMo: Create a new Stochastic Mortality Model In StMoMo: Stochastic Mortality Modelling

## Description

Initialises a StMoMo object which represents a Generalised Age-Period-Cohort Stochastic Mortality Model.

StMoMo.

## Usage

 1 2 3 StMoMo(link = c("log", "logit"), staticAgeFun = TRUE, periodAgeFun = "NP", cohortAgeFun = NULL, constFun = function(ax, bx, kt, b0x, gc, wxt, ages) list(ax = ax, bx = bx, kt = kt, b0x = b0x, gc = gc)) 

## Arguments

 link defines the link function and random component associated with the mortality model. "log" would assume that deaths follow a Poisson distribution and use a log link while "logit" would assume that deaths follow a Binomial distribution and a logit link. staticAgeFun logical value indicating if a static age function α_x is to be included. periodAgeFun a list of length N with the definitions of the period age modulating parameters β_x^{(i)}. Each entry can take values: "NP" for non-parametric age terms, "1" for β_x^{(i)}=1 or a predefined parametric function of age (see details). Set this to NULL if there are no period terms in the model. cohortAgeFun defines the cohort age modulating parameter β_x^{(0)}. It can take values: "NP" for non-parametric age terms, "1" for β_x^{(0)}=1, a predefined parametric function of age (see details) or NULL if there is no cohort effect. constFun function defining the identifiability constraints of the model. It must be a function of the form constFun <- function(ax, bx, kt, b0x, gc, wxt, ages) taking a set of fitted model parameters and returning a list list(ax = ax, bx = bx, kt = kt, b0x = b0x, gc = gc) of the model parameters with the identifiability constraints applied. If omitted no identifiability constraints are applied to the model.

## Details

R implementation of the family of Generalised Age-Period-Cohort stochastic mortality models. This family of models encompasses many models proposed in the literature including the well-known Lee-Carter model, CBD model and APC model.

StMoMo defines an abstract representation of a Generalised Age-Period-Cohort (GAPC) Stochastic model that fits within the general class of generalised non-linear models defined as follows

D_{xt} \sim Poisson(E_{xt}μ_{xt}), D_{xt} \sim Binomial(E_{xt},q_{xt})

η_{xt} = \log μ_{xt}, η_{xt} = \mathrm{logit}\, q_{xt}

η_{xt} = α_x + ∑_{i=1}^N β_x^{(i)}κ_t^{(i)} + β_x^{(0)}γ_{t-x}

v: \{α_{x}, β_x^{(1)},..., β_x^{(N)}, κ_t^{(1)},..., κ_t^{(N)}, β_x^{(0)}, γ_{t-x}\} \mapsto \{α_{x}, β_x^{(1)},..., β_x^{(N)}, κ_t^{(1)},..., κ_t^{(N)}, β_x^{(0)}, γ_{t-x}\},

where

• α_x is a static age function;

• β_x^{(i)}κ_t^{(i)}, i = 1,..N, are age/period terms;

• β_x^{(0)}γ_{t-x} is the age/cohort term; and

• v is a function defining the identifiability constraints of the model.

Most Stochastic mortality models proposed in the literature can be cast to this representation (See Hunt and Blake (2015)).

Parametric age functions should be scalar functions of the form f <- function(x, ages) taking a scalar age x and a vector of model fitting ages (see examples below).

Do to limitation of functions gnm within package gnm, which is used for fitting "StMoMo" objects to data (see fit.StMoMo), models combining parametric and non-parametric age-modulating functions are not supported at the moment.

## Value

A list with class "StMoMo" with components:

 link a character string defining the link function of the model. staticAgeFun a logical value indicating if the model has a static age function. periodAgeFun a list defining the period age modulating parameters. cohortAgeFun an object defining the cohort age modulating parameters. constFun a function defining the identifiability constraints. N an integer specifying The number of age-period terms in the model. textFormula a character string of the model formula. gnmFormula a formula that can be used for fitting the model with package gnm.

## References

Plat, R. (2009). On stochastic mortality modeling. Insurance: Mathematics and Economics, 45(3), 393-404.

Hunt, A., & Blake, D. (2015). On the Structure and Classification of Mortality Models Mortality Models. Pension Institute Working Paper. http://www.pensions-institute.org/workingpapers/wp1506.pdf.

fit.StMoMo, lc, cbd, apc, rh, m6, m7, m8
  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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 #Lee-Carter model constLC <- function(ax, bx, kt, b0x, gc, wxt, ages) { c1 <- mean(kt[1, ], na.rm = TRUE) c2 <- sum(bx[, 1], na.rm = TRUE) list(ax = ax + c1 * bx, bx = bx / c2, kt = c2 * (kt - c1)) } LC <- StMoMo(link = "log", staticAgeFun = TRUE, periodAgeFun = "NP", constFun = constLC) plot(fit(LC, data = EWMaleData, ages.fit = 55:89)) #CBD model f2 <- function(x, ages) x - mean(ages) CBD <- StMoMo(link = "logit", staticAgeFun = FALSE, periodAgeFun = c("1", f2)) plot(fit(CBD, data = EWMaleData, ages.fit = 55:89)) #Reduced Plat model (Plat, 2009) f2 <- function(x, ages) mean(ages) - x constPlat <- function(ax, bx, kt, b0x, gc, wxt, ages) { nYears <- dim(wxt)[2] x <- ages t <- 1:nYears c <- (1 - tail(ages, 1)):(nYears - ages[1]) xbar <- mean(x) #nsum g(c)=0, nsum cg(c)=0, nsum c^2g(c)=0 phiReg <- lm(gc ~ 1 + c + I(c^2), na.action = na.omit) phi <- coef(phiReg) gc <- gc - phi[1] - phi[2] * c - phi[3] * c^2 kt[2, ] <- kt[2, ] + 2 * phi[3] * t kt[1, ] <- kt[1, ] + phi[2] * t + phi[3] * (t^2 - 2 * xbar * t) ax <- ax + phi[1] - phi[2] * x + phi[3] * x^2 #nsum kt[i, ] = 0 ci <- rowMeans(kt, na.rm = TRUE) ax <- ax + ci[1] + ci[2] * (xbar - x) kt[1, ] <- kt[1, ] - ci[1] kt[2, ] <- kt[2, ] - ci[2] list(ax = ax, bx = bx, kt = kt, b0x = b0x, gc = gc) } PLAT <- StMoMo(link = "log", staticAgeFun = TRUE, periodAgeFun = c("1", f2), cohortAgeFun = "1", constFun = constPlat) plot(fit(PLAT, data = EWMaleData, ages.fit = 55:89)) #Models not supported ## Not run: MnotSup1 <- StMoMo(periodAgeFun = c(f2, "NP")) MnotSup1 <- StMoMo(periodAgeFun = f2, cohortAgeFun = "NP") ## End(Not run)