Skip to content

Instantly share code, notes, and snippets.

@timriffe
Created August 8, 2024 03:44
Show Gist options
  • Save timriffe/cfc07c610a53a40dc33c6a16f95272fd to your computer and use it in GitHub Desktop.
Save timriffe/cfc07c610a53a40dc33c6a16f95272fd to your computer and use it in GitHub Desktop.
checking consistency between LTabr() and Mxc2e0abr()
Mxc <- structure(c(1.93e-05, 1.02e-05, 5.84e-07, 7.03e-07, 5.57e-07,
3.75e-06, 8.07e-06, 1.21e-05, 2.24e-05, 3.27e-05, 5.34e-05, 6.14e-05,
8.53e-05, 0.000137, 0.000166, 0.000221, 0.000257, 0.000337, 0.000445,
0.000825, 0.000991, 0.001587473, 0.000106, 4.83e-06, 5.85e-07,
2.84e-07, 2.02e-07, 1.19e-06, 2.89e-06, 2.86e-06, 9.94e-06, 1.02e-05,
2.21e-05, 3.92e-05, 7.44e-05, 0.000113, 0.000183, 0.000312, 0.000458,
0.000939, 0.00176391, 0.003744596, 0.006769298, 0.011084971,
0, 0, 0, 0, 0, 3.12e-07, 3.89e-07, 6.73e-08, 6.58e-07, 2.9e-06,
8.29e-06, 1.8e-05, 5.81e-05, 0.000141, 3e-04, 0.000607, 0.00120023,
0.002377745, 0.004082495, 0.00780333, 0.014229324, 0.021679745,
2.84e-08, 2.33e-08, 1.32e-07, 1.09e-07, 1.69e-07, 5.19e-07, 1.68e-06,
3.02e-06, 8.06e-06, 9.91e-06, 2.57e-05, 5.14e-05, 9.81e-05, 0.000139,
0.000206, 0.00031, 0.000432, 0.000745, 0.001219471, 0.002394238,
0.002992933, 0.004222715, 0, 0, 0, 0, 0, 6.74e-07, 2.58e-06,
8.27e-06, 3.2e-05, 7.66e-05, 0.000182, 0.000333, 0.000645, 0.000984,
0.001429208, 0.002180854, 0.003181628, 0.006152687, 0.011167017,
0.024641197, 0.043381675, 0.07166473, 0.002185736, 1.23e-05,
1e-06, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1.89e-05, 5.03e-05, 9.85e-06, 1.59e-05, 1.45e-05, 0.000124,
0.000166, 0.000126, 0.000131, 0.00011, 0.000112, 0.000104, 0.000133,
0.000116, 0.000113, 0.000126, 0.000116, 0.000143, 0.000218, 0.000308,
0.000382, 0.000348, 0, 0, 0, 0, 1.53e-05, 0.000148, 0.000239,
0.000207, 0.000237, 0.000218, 0.000233, 0.000229, 0.000272, 0.000225,
0.000168, 0.000145, 0.000144, 0.000157, 0.000213, 0.000302, 0.00038,
0.000291, 3.29e-06, 8.56e-07, 1.1e-07, 9.93e-08, 6.96e-07, 1.51e-06,
3.23e-06, 5.49e-06, 1.14e-05, 2.06e-05, 4.29e-05, 7.22e-05, 0.000101,
0.000177, 0.000295, 0.000514, 0.000963, 0.002141326, 0.004349674,
0.010280175, 0.019338192, 0.029744677, 0, 0, 0, 0, 0, 6.59e-08,
1.12e-07, 6.87e-07, 3.46e-06, 1.2e-05, 3.58e-05, 9.4e-05, 0.000247,
0.000448, 0.000726, 0.001179673, 0.001811458, 0.002212284, 0.003101151,
0.004110558, 0.00390096, 0.003189884, 0.002248336, 0.000378,
6.13e-05, 4.99e-05, 6.89e-05, 0.000161, 0.000237, 0.000269, 0.000426,
0.000524, 0.000767, 0.001045144, 0.001792423, 0.002774225, 0.003925336,
0.006403428, 0.010228946, 0.01779068, 0.03149649, 0.063076862,
0.108666734, 0.168855705), dim = c(22L, 11L), dimnames = list(
c("0", "1", "2", "5", "10", "15", "20", "25", "30", "35",
"40", "45", "50", "55", "60", "65", "70", "75", "80", "85",
"90", "95"), c("Cardiomyopathy", "CKD", "COPD", "Diabetes", "IHD", "Neonatal", "Road", "Self_harm", "Stroke", "Lung_Cancer",
"all_other")))
Mxc1 <- as.matrix(Mxc)
plot(rowSums(Mxc1), log='y')
library(DemoDecomp)
LTabr(rowSums(Mxc1))
# 85.59036
Mxc2e0abr(Mxc1)
# 85.59036
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment