Learn R Programming

LEdecomp (version 1.0.4)

arriaga_sym: Estimate sensitivity of life expectancy using a symmetrical Arriaga approach.

Description

This approach conducts a classic Arriaga decomposition in both directions, averaging the (sign-adjusted) result, i.e. a_avg = (arriaga(mx1,mx2, ...) - arriaga(mx2, mx1, ...)) / 2. #@note The final age group's contribution from the reversed decomposition is halved before averaging. This empirical adjustment ensures symmetry and numeric stability, though the theoretical basis requires further exploration.

Usage

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

Value

numeric vector of contributions summing to the gap in life expectancy implied by mx1 and mx2.

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.

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)
d <- arriaga_sym(mx1, mx2, age = x)

e01 <- mx_to_e0(mx1,age=x)
e02 <- mx_to_e0(mx2,age=x)
(Delta <- e02 - e01)
sum(d)

d12 <- arriaga(mx1, mx2, age = x)
d21 <- arriaga(mx2, mx1, age = x) # direction opposite
# \donttest{
plot(x, d, type= 'l')
  lines(x, d12, col = "red")
  lines(x, -d21, col = "blue")
# }

Run the code above in your browser using DataLab