Learn R Programming

LEdecomp (version 1.0.4)

sen_lopez_ruzicka: Sensitivity from Lopez-Ruzicka decomposition

Description

Computes the sensitivity of life expectancy to changes in age-specific mortality rates using the Lopez-Ruzicka decomposition approach. The sensitivity is calculated by dividing the age-specific contributions (from lopez_ruzicka()) by the differences in mortality rates (mx2 - mx1). This gives a pointwise estimate of the derivative of life expectancy with respect to each age-specific mortality rate, evaluated at an imagined midpoint between the two input rate schedules.

Usage

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

Value

A numeric vector of sensitivity values by age group.

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.

Details

This method gives numerically identical results to sen_arriaga().

References

Ponnapalli2005LEdecomp

See Also

lopez_ruzicka, sen_arriaga, sen_chandrasekaran_III

Examples

Run this code
a <- 0.001
b <- 0.07
x <- 0:100
mx1 <- a * exp(x * b)
mx2 <- a / 2 * exp(x * b)
s <- sen_lopez_ruzicka(mx1, mx2, age = x)

# Check that multiplying sensitivity by rate difference reproduces the decomposition
cc_check <- s * (mx2 - mx1)
cc <- lopez_ruzicka(mx1, mx2, age = x)
# \donttest{
plot(x, cc, type = "l")
lines(x, cc_check, col = "red", lty = 2)
# }

Run the code above in your browser using DataLab