Learn R Programming

ilc (version 1.0)

dd.rfp: Artificial (stratified) mortality experience (with Poisson error) for testing the SLC regression

Description

It transforms a base age-period (2-dimensional) experience of mortality rates into artificially 'stratified' (3-dimensional) mortality rates by overlaying an extra random effect (i.e. other than age and period). Thus, it augments the log of the 2-dimensional mortality rates by an additive effect (with any number of levels) having Poisson distribution with means specified in the rfp argument of the function. It also randomises the base central exposures by a similar additive effect having a normal distribution with mean 0 and a constant age-specific standard deviation, which is calculated arbitrarily as the square root of the age-specific standard errors of the observed exposures. The latter adjustment is applied in order to further randomize the artificially created data. The purpose of the artificial data is to test the Stratified Lee-Carter regression method.

Usage

dd.rfp(ddata, rfp)

Arguments

ddata
mortality data object of class demogdata
rfp
vector of the means of the artificial additive effect, whereas the length of this argument determines the number of levels of the extra factor.

Value

Multidimensional mortality data object of rhdata class with the following components:
age
vector of ages
year
vector of years
covariates
names of covariates
deaths
3-dimensional array of death counts
pop
3-dimensional array of exposure
mu
3-dimensional array of force of mortality
label
data label
name
data name

Details

Consider a cross-classified mortality experience observed over age (x) and period (t) made up of $k\times n$ data cells. This function will augment the observed data with Poisson distributed random 'noise' (reduction factors) corresponding to an extra covariate (g) having $l$ levels with means specified in the rfp vector. That is, it creates an artificial data object made up by $k\times n\times l$ data cells containing the number of deaths corresponding to each subgroup of the stratified mortality experience.

See Also

elca.rh

Examples

Run this code
# vector of means of the additional effect (other than age and period):
rfp <- c(0.5, 1.2, -0.7, 2.5)
# create artificial stratified mortality experience of rhdata class:
rfp.cmi <- dd.rfp(dd.cmi.pens, rfp)
# print stratified rhdata data summary:
rfp.cmi
# plot the base level experience in the stratified rhdata
# a. central exposures:
matplot(rfp.cmi$age, rfp.cmi$pop[,,1], type='l', xlab='Age', ylab='Ec', main='Base Level')
# b. deaths:
matplot(rfp.cmi$age, rfp.cmi$deaths[,,1], type='l', xlab='Age', ylab='D', main='Base Level')
# c. log mortality rates:
matplot(rfp.cmi$age, log(rfp.cmi$mu[,,1]), type='l', xlab='Age', ylab='log(mu)', main='Base Level')

Run the code above in your browser using DataLab