Learn R Programming

LEdecomp (version 1.0.4)

sen_arriaga_instantaneous: Estimate sensitivity of life expectancy for a set of mortality rates

Description

This implementation gives a good approximation of the sensitivity of life expectancy to perturbations in mortality rates (central death rates). Since the Arriaga approach requires two versions of mortality rates mx1, mx2, we create these by slightly perturbing mx up and down. Then we calculate the Arriaga sensitivity in each direction and take the average. Specifically, we create mx1 and mx2 as $$m_{x}^{1} = m_x \cdot \left(\frac{1}{1 - h}\right)$$ $$m_{x}^{2} = m_x \cdot \left(1 - h\right)$$ where h is small value given by the argument perturb.

Usage

sen_arriaga_instantaneous(
  mx,
  age = 0:(length(mx1) - 1),
  sex = "t",
  nx = rep(1, length(mx)),
  perturb = 1e-06,
  closeout = TRUE
)

Value

numeric vector of sensitivity of life expectancy to perturbations in mx.

Arguments

mx

numeric vector of mortality rates (central death rates)

age

integer vector of the lower bound of each age group (currently only single ages supported)

sex

character Male ("m"), Female ("f"), or Total ("t")

nx

integer vector of age intervals, default 1.

perturb

numeric constant, a very small number

closeout

logical. Default TRUE. Shall we use the HMD Method Protocol to close out the ax and qx values? See details.

Details

A minor correction might be needed for the final age group for the case of the reverse-direction Arriaga sensitivity. Note also for values of perturb (h) that are less than 1e-7 we might lose stability in results.

Examples

Run this code
a   <- .001
b   <- .07
x   <- 0:100
mx1 <- a * exp(x * b)
mx2 <- a/2 * exp(x * b)
mx  <- (mx1 + mx2) / 2
s     <- sen_arriaga_instantaneous(mx, age = x)
s1    <- sen_arriaga_instantaneous(mx1, age = x)
s2    <- sen_arriaga_instantaneous(mx2, age = x)
s1_d  <- sen_arriaga(mx1, mx2, age = x)
s2_d  <- sen_arriaga(mx2, mx1, age = x)
delta <- mx2 - mx1
# dots give our point estimate of sensitivity at the average of the rates,
# which is different from the

plot(x,s*delta, ylim = c(0,.3))
lines(x,s1*delta,col = "red")
lines(x,s2*delta,col = "blue")
# the sensitivity of the average is different
# from the average of the sensitivities!
lines(x, ((s1+s2)) / 2 * delta)
# and these are different from the directional sensitivities
# covering the whole space from mx1 to mx2:
lines(x, s1_d*delta, col = "red", lty =2)
lines(x, s2_d*delta, col = "blue", lty =2)

Run the code above in your browser using DataLab