Learn R Programming

LEdecomp (version 1.0.4)

lopez_ruzicka_sym: Symmetric Lopez-Ruzicka decomposition

Description

Implements a symmetric version of the Lopez-Ruzicka decomposition by averaging the results from the forward and reverse directions. That is, lopez_ruzicka_sym(mx1, mx2) returns $$ \frac{1}{2} \left( \text{lopez\_ruzicka}(mx1, mx2) - \text{lopez\_ruzicka}(mx2, mx1) \right) $$ This symmetric adjustment ensures that the decomposition is directionally neutral.

Usage

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

Value

Numeric vector of contributions by age group that sum to the total difference in life expectancy between the two mortality schedules.

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 symmetric version gives numerically identical results to arriaga_sym(), chandrasekaran_II(), and chandrasekaran_III().

References

Ponnapalli2005LEdecomp

See Also

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

# compare to arriaga_sym()
d2 <- arriaga_sym(mx1, mx2, age = x)
all.equal(d, d2)

Run the code above in your browser using DataLab