Created
May 26, 2023 05:53
-
-
Save timriffe/b12bb93c6fb2ceb483452627ee864ec9 to your computer and use it in GitHub Desktop.
Cause-deleted lifetables can only result in an equal gap (before and after) if the deleted causes are *not* proportional
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(HMDHFDplus) | |
library(tidyverse) | |
mlt <- readHMDweb("ESP","mltper_1x1",username = Sys.getenv("us"),password = Sys.getenv("pw")) | |
# 1950 Spanish males | |
mx1 <- c(0.08382, 0.01361, 0.00764, 0.00464, 0.0032, 0.00245, 0.00222, | |
0.00177, 0.00156, 0.00141, 0.00149, 0.00137, 0.0012, 0.00137, | |
0.00155, 0.00184, 0.00176, 0.00202, 0.00291, 0.00292, 0.00324, | |
0.003, 0.00339, 0.00369, 0.00398, 0.00407, 0.00417, 0.00395, | |
0.00403, 0.00374, 0.00438, 0.004, 0.00421, 0.00425, 0.00426, | |
0.00459, 0.00436, 0.00435, 0.00507, 0.00452, 0.00561, 0.00492, | |
0.00629, 0.00622, 0.0064, 0.00756, 0.00716, 0.00801, 0.00897, | |
0.00846, 0.01257, 0.00921, 0.01205, 0.01244, 0.01418, 0.01493, | |
0.01645, 0.0172, 0.02093, 0.0186, 0.02561, 0.02031, 0.02754, | |
0.02943, 0.02963, 0.03569, 0.03683, 0.04137, 0.04593, 0.04097, | |
0.06245, 0.05064, 0.07113, 0.07384, 0.07546, 0.08916, 0.09797, | |
0.10053, 0.13222, 0.09951, 0.15648, 0.10813, 0.1549, 0.15988, | |
0.19702, 0.20494, 0.22352, 0.22641, 0.26305, 0.257, 0.30614, | |
0.20722, 0.33845, 0.27717, 0.27676, 0.3711, 0.39205, 0.41341, | |
0.4351, 0.45704, 0.47914, 0.50133, 0.52352, 0.54561, 0.56752, | |
0.58918, 0.61049, 0.63139, 0.6518, 0.67168, 0.69095) | |
# 2000 Spanish males | |
mx2 <- c(0.00472, 0.00045, 0.00029, 0.00022, 0.00017, 0.00019, 0.00019, | |
0.00016, 0.00015, 0.00015, 0.00015, 0.00013, 0.00015, 0.00019, | |
0.00032, 0.00035, 0.00052, 7e-04, 7e-04, 0.00073, 0.00086, 0.00085, | |
8e-04, 0.00083, 0.00091, 9e-04, 0.00098, 9e-04, 0.00106, 0.00101, | |
0.00105, 0.00122, 0.00127, 0.00135, 0.00138, 0.00164, 0.00167, | |
0.00174, 0.00191, 0.00191, 0.00221, 0.00217, 0.00244, 0.00266, | |
0.00292, 0.00309, 0.00315, 0.00378, 0.00383, 0.00419, 0.0049, | |
0.00492, 0.00544, 0.00592, 0.00637, 0.00678, 0.00774, 0.00815, | |
0.00879, 0.00969, 0.01044, 0.0119, 0.01274, 0.01409, 0.01554, | |
0.01716, 0.01797, 0.0205, 0.02162, 0.02436, 0.02678, 0.02972, | |
0.0328, 0.03627, 0.03961, 0.04446, 0.04931, 0.0549, 0.06143, | |
0.06833, 0.07615, 0.08362, 0.09272, 0.10069, 0.11235, 0.12252, | |
0.1417, 0.15362, 0.17027, 0.18321, 0.20229, 0.23436, 0.24819, | |
0.27569, 0.29697, 0.31857, 0.34459, 0.37157, 0.39938, 0.42785, | |
0.45681, 0.48606, 0.51541, 0.54466, 0.57359, 0.60204, 0.62981, | |
0.65675, 0.68271, 0.70759, 0.73128) | |
mx2ex <- function(mx){ | |
sum(exp(-cumsum(mx))) + .5 | |
} | |
# sizeable gap | |
(gap <- mx2ex(mx2) - mx2ex(mx1)) | |
# proportional reduction = gap shrinks (entropy) | |
(gap <- mx2ex(mx2*.9) - mx2ex(mx1*.9)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment