Fit a Renshaw and Haberman (Lee-Carter with cohorts) mortality model using the iterative Newton-Raphson procedure presented in Algorithm 1 of Hunt and Villegas (2015). This approach helps solve the well-known robustness and converges issues of the Lee-Carter model with cohort-effects.
# S3 method for rh
fit(object, data = NULL, Dxt = NULL, Ext = NULL,
ages = NULL, years = NULL, ages.fit = NULL, years.fit = NULL,
oxt = NULL, wxt = NULL, start.ax = NULL, start.bx = NULL,
start.kt = NULL, start.b0x = NULL, start.gc = NULL, verbose = TRUE,
tolerance = 1e-04, iterMax = 10000, ...)
an object of class "rh"
created with function
rh
.
an optional object of type StMoMoData containing information on
deaths and exposures to be used for fitting the model. This is typically created
with function StMoMoData
. If this is not provided then the fitting
data is taken from arguments, Dxt
, Ext
, ages
, years
.
optional matrix of deaths data.
optional matrix of observed exposures of the same dimension of
Dxt
.
optional vector of ages corresponding to rows of Dxt
and
Ext
.
optional vector of years corresponding to rows of Dxt
and
Ext
.
optional vector of ages to include in the fit. Must be a
subset of ages
.
optional vector of years to include in the fit. Must be a
subset of years
.
optional matrix/vector or scalar of known offset to be used in fitting the model. This can be used to specify any a priori known component to be added to the predictor during fitting.
optional matrix of 0-1 weights to be used in the fitting process.
This can be used, for instance, to zero weight some cohorts in the data.
See genWeightMat
which is a helper function for defining
weighting matrices.
optional vector with starting values for \(\alpha_x\).
optional matrix with starting values for \(\beta_x^{(i)}\).
optional matrix with starting values for \(\kappa_t^{(i)}\).
optional vector with starting values for \(\beta_x^{(0)}\).
optional vector with starting values for \(\gamma_c\).
a logical value. If TRUE
progress indicators are
printed as the model is fitted. Set verbose = FALSE
to silent the
fitting and avoid progress messages.
a positive numeric value specifying the tolerance level for convergence.
a positive integer specifying the maximum number of iterations to perform.
arguments to be passed to or from other methods.
the object of class "rh"
defining the fitted
stochastic mortality model.
vector with the fitted values of the static age function
\(\alpha_x\). If the model does not have a static age function or
failed to fit this is set to NULL
.
matrix with the values of the period age-modulating functions
\(\beta_x^{(i)}, i=1, ..., N\). If the \(i\)-th age-modulating
function is non-parametric (e.g. as in the Lee-Carter model)
bx[, i]
contains the estimated values. If the model does not have
any age-period terms (i.e. \(N=0\)) or failed to fit this is set to
NULL
.
matrix with the values of the fitted period indexes
\(\kappa_t^{(i)}, i=1, ..., N\). kt[i, ]
contains the estimated
values of the \(i\)-th period index. If the model does not have any
age-period terms (i.e. \(N=0\)) or failed to fit this is set to
NULL
.
vector with the values of the cohort age-modulating function
\(\beta_x^{(0)}\). If the age-modulating function is non-parametric
b0x
contains the estimated values. If the model does not have a
cohort effect or failed to fit this is set to NULL
.
vector with the fitted cohort index \(\gamma_{c}\).
If the model does not have a cohort effect or failed to fit this is set
to NULL
.
StMoMoData object provided for fitting the model.
matrix of deaths used in the fitting.
matrix of exposures used in the fitting.
matrix of known offset values used in the fitting.
matrix of 0-1 weights used in the fitting.
vector of ages used in the fitting.
vector of years used in the fitting.
vector of cohorts used in the fitting.
output from the iterative fitting algorithm.
log-likelihood of the model. If the fitting failed to
converge this is set to NULL
.
deviance of the model. If the fitting failed to
converge this is set to NULL
.
effective number of parameters in the model. If the fitting
failed to converge this is set to NULL
.
number of observations in the model fit. If the fitting
failed to converge this is set to NULL
.
TRUE
if a model could not be fitted and
FALSE
otherwise.
TRUE
if the model fitting converged and
FALSE
if it didn't.
Hunt, A., & Villegas, A. M. (2015). Robustness and convergence in the Lee-Carter model with cohorts. Insurance: Mathematics and Economics, 64, 186-202.
# NOT RUN {
LCfit <- fit(lc(), data = EWMaleData, ages.fit = 55:89)
wxt <- genWeightMat(55:89, EWMaleData$years, clip = 3)
RHfit <- fit(rh(), data = EWMaleData, ages.fit = 55:89,
wxt = wxt, start.ax = LCfit$ax,
start.bx = LCfit$bx, start.kt = LCfit$kt)
plot(RHfit)
#Impose approximate constraint as in Hunt and Villegas (2015)
# }
# NOT RUN {
RHapprox <- rh(approxConst = TRUE)
RHapproxfit <- fit(RHapprox, data = EWMaleData, ages.fit = 55:89,
wxt = wxt)
plot(RHapproxfit)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab