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