Skip to content

Instantly share code, notes, and snippets.

@timriffe
Created April 19, 2023 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timriffe/1aa6e922d3dd53f6f7df879f1aba92e6 to your computer and use it in GitHub Desktop.
Save timriffe/1aa6e922d3dd53f6f7df879f1aba92e6 to your computer and use it in GitHub Desktop.
Does the dudel discount work for single-decrement lifetables? Looks like it's not a bad approximation.
ex = c(84.18, 83.55, 82.58, 81.59, 80.6, 79.61, 78.62, 77.62,
76.63, 75.64, 74.64, 73.64, 72.65, 71.66, 70.67, 69.68, 68.7,
67.71, 66.72, 65.74, 64.76, 63.78, 62.8, 61.81, 60.83, 59.85,
58.88, 57.89, 56.91, 55.94, 54.96, 53.98, 53, 52.03, 51.06,
50.08, 49.11, 48.14, 47.17, 46.2, 45.24, 44.27, 43.3, 42.34,
41.39, 40.44, 39.48, 38.53, 37.59, 36.65, 35.72, 34.79, 33.87,
32.95, 32.03, 31.12, 30.22, 29.32, 28.43, 27.54, 26.66, 25.79,
24.92, 24.06, 23.21, 22.37, 21.53, 20.7, 19.88, 19.06, 18.27,
17.47, 16.68, 15.92, 15.18, 14.44, 13.71, 12.99, 12.28, 11.59,
10.93, 10.29, 9.65, 9.03, 8.44, 7.88, 7.33, 6.81, 6.32, 5.85,
5.41, 5.01, 4.64, 4.3, 3.98, 3.68, 3.41, 3.16, 2.93, 2.72,
2.53, 2.36, 2.2, 2.07, 1.94, 1.83, 1.74, 1.65, 1.58, 1.53,
1.49)
lx = c(100000L, 99562L, 99533L, 99521L, 99508L,
99497L, 99486L, 99475L, 99469L, 99460L, 99454L, 99448L, 99440L,
99433L, 99417L, 99396L, 99376L, 99360L, 99340L, 99313L, 99283L,
99254L, 99223L, 99196L, 99164L, 99131L, 99094L, 99063L, 99027L,
98989L, 98954L, 98908L, 98868L, 98816L, 98765L, 98721L, 98663L,
98603L, 98541L, 98472L, 98399L, 98322L, 98244L, 98154L, 98051L,
97932L, 97819L, 97692L, 97550L, 97390L, 97208L, 97016L, 96796L,
96560L, 96305L, 96031L, 95733L, 95413L, 95053L, 94664L, 94251L,
93791L, 93292L, 92770L, 92186L, 91554L, 90868L, 90161L, 89372L,
88519L, 87548L, 86565L, 85490L, 84244L, 82873L, 81432L, 79889L,
78230L, 76437L, 74459L, 72239L, 69883L, 67372L, 64685L, 61697L,
58479L, 55106L, 51492L, 47669L, 43668L, 39533L, 35221L, 30925L,
26679L, 22607L, 18842L, 15340L, 12197L, 9453L, 7128L, 5220L,
3705L, 2546L, 1691L, 1084L, 671L, 400L, 230L, 127L, 68L, 35L)
lx <- lx/1e5
dx <- -diff(c(lx,0))
qx <- dx / lx
px <- 1 - qx
lt1 <-cbind(rbind(0,diag(px)),0)
I <- diag(length(px)+1)
plot(colSums(solve(I - lt1))[1:length(ex)] - ex)
plot(colSums(solve(I - lt1))[1:length(ex)] - .5 - ex)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment