Learn R Programming

LEdecomp (version 1.0.4)

sen_arriaga: the sensitivity implied by a classic Arriaga decomposition

Description

The sensitivity of life expectancy to a perturbation in mortality rates can be derived by dividing the Arriaga decomposition result \(\Delta\) by the difference mx2-mx1. $$s_{x} = \frac{\Delta}{_{n}M^{2}_x - _{n}M^{1}_x}$$

Usage

sen_arriaga(
  mx1,
  mx2,
  age = 0:(length(mx1) - 1),
  nx = rep(1, length(mx1)),
  sex1 = "t",
  sex2 = sex1,
  closeout = TRUE
)

Value

s numeric vector with one element per age group, and which gives the sensitivity values for each age.

Arguments

mx1

numeric vector of the mortality rates (central death rates) for population 1

mx2

numeric vector of the mortality rates (central death rates) for population 2

age

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

nx

integer vector of age intervals, default 1.

sex1

character either the sex for population 1: Male ("m"), Female ("f"), or Total ("t")

sex2

character either the sex for population 2: Male ("m"), Female ("f"), or Total ("t") assumed same as sex1 unless otherwise specified.

closeout

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

References

arriaga1984measuringLEdecomp preston2000demographyLEdecomp

See Also

arriaga

Examples

Run this code
a <- .001
b <- .07
x <- 0:100
mx1 <- a * exp(x * b)
mx2 <- a/2 * exp(x * b)
cc <- arriaga(mx1, mx2, age = x)
# examples can come from above too
s <- sen_arriaga(mx1, mx2, age = x)
# \donttest{
plot(x, s)
# }
cc_check <- s * (mx2 - mx1)
# \donttest{
plot(x,cc)
lines(x,cc_check)
# }

Run the code above in your browser using DataLab