RDM | R Documentation |
Take two survival curves, use them to calculate 5-year survival ratios, then again take the consecutive age-ratios of these. Finally, take the mean absolute difference between ratios, with optional age trimming. Based on LIFIT program from the MPCDA code base.
RDM(
lx1,
lx2,
Age1,
Age2 = Age1,
ageMin = max(c(min(Age1), min(Age2))),
ageMax = min(c(max(Age1), max(Age2)))
)
lx1 |
numeric. Vector of the first survival function, any radix size. |
lx2 |
numeric. Vector of the first survival function, any radix size. |
Age1 |
integer. A vector of ages of the lower integer bound of the age groups corresponding to |
Age2 |
integer. A vector of ages of the lower integer bound of the age groups corresponding to |
ageMin |
integer. Optional lower age bound for calculations. |
ageMax |
integer. Optional upper age bound for calculations. |
lx1
and lx2
can be of different lengths and grouped differently.
For example, either or both input vectors could be in single or five-year age groups
for this function. Results are selected internally for 5-year age groups, and vector lengths are matched.
If you want the age-group 70-74 to be included in calculations, then give ageMax = 70
, not 75.
The input vectors can also be of different lifetable radices. As with the original Fortran code,
the open age group must be included in input vectors, even though it is not included in calcs.
If your final age group is not open, then tack an extra element to it to simulate an open element,
and just make sure to match ages.
The mean absolute difference in survival ratios.
arriaga1976DemoTools
lx1 <-c(1, 0.94265, 0.93344, 0.92708, 0.923, 0.92023, 0.91796, 0.91601,
0.91431, 0.9128, 0.91145, 0.91025, 0.90914, 0.90805, 0.90692,
0.90566, 0.90419, 0.90251, 0.90063, 0.89858, 0.89642, 0.89417,
0.8918, 0.88923, 0.88647, 0.88356, 0.88046, 0.87721, 0.87386,
0.87047, 0.86706, 0.8636, 0.86008, 0.85649, 0.85276, 0.84882,
0.84465, 0.84027, 0.8357, 0.83102, 0.8264, 0.82193, 0.8175, 0.81296,
0.80827, 0.80343, 0.79845, 0.79329, 0.78788, 0.78218, 0.77617,
0.76982, 0.76309, 0.75596, 0.74837, 0.74029, 0.73182, 0.72307,
0.71396, 0.70434, 0.69402, 0.68295, 0.67102, 0.6581, 0.64442,
0.63012, 0.61486, 0.59811, 0.57943, 0.55896, 0.53739, 0.51528,
0.49248, 0.46826, 0.44272, 0.41631, 0.38876, 0.36037, 0.33157,
0.30217, 0.27334, 0.24599, 0.21948, 0.19412, 0.17029, 0.14826,
0.12771, 0.10909, 0.09241, 0.07763, 0.0647, 0.05363, 0.04403,
0.03578, 0.02877, 0.02289, 0.018, 0.01399, 0.01075, 0.00815,
0.0061, 0.00451, 0.00329, 0.00236, 0.00168, 0.00117, 0.00081,
0.00055, 0.00036, 0.00024, 0.00015)
lx2 <- c(1, 0.99361, 0.99315, 0.99284, 0.99264, 0.99246, 0.9923, 0.99216,
0.99201, 0.99189, 0.99176, 0.99164, 0.99149, 0.99135, 0.99118,
0.99096, 0.99069, 0.99033, 0.98993, 0.98946, 0.98902, 0.98857,
0.98809, 0.98763, 0.98717, 0.98672, 0.98623, 0.98574, 0.98521,
0.98468, 0.9841, 0.98351, 0.98285, 0.98213, 0.98134, 0.9805,
0.97959, 0.9786, 0.97748, 0.97628, 0.97495, 0.97353, 0.97197,
0.97032, 0.96847, 0.96655, 0.96443, 0.96225, 0.95984, 0.95724,
0.95446, 0.95142, 0.94822, 0.94469, 0.94058, 0.93651, 0.93187,
0.92678, 0.92112, 0.91508, 0.90846, 0.90128, 0.89336, 0.88466,
0.87543, 0.86532, 0.85442, 0.84265, 0.82993, 0.81641, 0.80212,
0.78656, 0.77024, 0.75237, 0.73333, 0.71304, 0.69102, 0.66797,
0.64371, 0.61749, 0.58998, 0.55953, 0.52836, 0.49505, 0.46051,
0.42472, 0.38756, 0.34995, 0.31203, 0.27485, 0.23825, 0.20292,
0.16979, 0.13867, 0.11131, 0.08713, 0.06679, 0.04989, 0.03626,
0.02561, 0.01755, 0.01165, 0.00749, 0.00466, 0.00281, 0.00163,
0.00092, 5e-04, 0.00026, 0.00013, 7e-05)
RDM(lx1, lx2, 0:110)
RDM(lx1, lx2, 0:110, ageMax = 80)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.