Re: LDL Cholesterol calculation
- Posted by ghaberek (admin) 1 month ago
- 1176 views
Here's my version, which bakes the decision-making values into the table:
constant factor_table= { { -1, 100, 130,160,190,220,999}, { 50, 3.5, 3.4,3.3,3.3,3.2,3.1}, { 57, 4.0, 3.9,3.7,3.6,3.6,3.4}, { 62, 4.3, 4.1,4.0,3.9,3.8,3.6}, { 67, 4.5, 4.3,4.1,4.0,3.9,3.9}, { 72, 4.7, 4.4,4.3,4.2,4.1,3.9}, { 76, 4.8, 4.6,4.4,4.2,4.2,4.1}, { 80, 4.9, 4.6,4.5,4.3,4.3,4.2}, { 84, 5.0, 4.8,4.6,4.4,4.3,4.2}, { 88, 5.1, 4.8,4.6,4.5,4.4,4.3}, { 93, 5.2, 4.9,4.7,4.6,4.4,4.3}, { 97, 5.3, 5.0,4.8,4.7,4.5,4.4}, { 101, 5.4, 5.1,4.8,4.7,4.5,4.3}, { 106, 5.5, 5.2,5.0,4.7,4.6,4.5}, { 111, 5.6, 5.3,5.0,4.8,4.6,4.5}, { 116, 5.7, 5.4,5.1,4.9,4.7,4.5}, { 121, 5.8, 5.5,5.2,5.0,4.8,4.6}, { 127, 6.0, 5.5,5.3,5.0,4.8,4.6}, { 133, 6.1, 5.7,5.3,5.1,4.9,4.7}, { 139, 6.2, 5.8,5.4,5.2,5.0,4.7}, { 147, 6.3, 5.9,5.6,5.3,5.0,4.8}, { 155, 6.5, 6.0,5.7,5.4,5.1,4.8}, { 164, 6.7, 6.2,5.8,5.4,5.2,4.9}, { 174, 6.8, 6.3,5.9,5.5,5.3,5.0}, { 186, 7.0, 6.5,6.0,5.7,5.4,5.1}, { 202, 7.3, 6.7,6.2,5.8,5.5,5.2}, { 221, 7.6, 6.9,6.4,6.0,5.6,5.3}, { 248, 8.0, 7.2,6.6,6.2,5.9,5.4}, { 293, 8.5, 7.6,7.0,6.5,6.1,5.6}, { 400, 9.5, 8.3,7.5,7.0,6.5,5.9}, {13975,11.9,10.0,8.8,8.1,7.5,6.7} } -- CT, TG, HDL en g/L function martin_hopkins(atom CT, atom TG, atom HDL) integer lig=2, col=2, tg=floor(TG*100) -- tg, nonhdl en mg/dL atom factor=5.0, nonhdl=(CT-HDL)*100 while lig <= length(factor_table) and factor_table[lig][1] < tg do lig += 1 end while while col <= length(factor_table[1]) and factor_table[1][col] < nonhdl do col += 1 end while factor = factor_table[lig][col] return CT - HDL - (TG/factor) end function
-Greg