Learn R Programming

LEdecomp (version 1.0.4)

sen_arriaga_instantaneous2: Estimate sensitivity of life expectancy for a set of mortality rates by perturbing in the log space.

Description

This is a second approach for estimating the sensitivity for a single set of rates. Here, rather than directly expanding and contracting rates to convert mx into mx1 and mx2 we instead shift the logged mortality rates up and down by the factor perturb = h. Specifically: $$m_{x}^{1} = e^{\ln\left(m_x\right) + h}$$ $$m_{x}^{2} = e^{\ln\left(m_x\right) - h}$$

Usage

sen_arriaga_instantaneous2(
  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.

See Also

sen_arriaga_instantaneous

Examples

Run this code
a   <- .001
b   <- .07
x   <- 0:100
mx <- a * exp(x * b)
# the multiplicative perturbation:
s1 <- sen_arriaga_instantaneous(mx)
s2 <- sen_arriaga_instantaneous2(mx)
plot(x,
     s1 - s2,
     pch = 16,
     cex=.5,
     main = "very similar")

Run the code above in your browser using DataLab