Predicting dyscalcemia using machine learning models based on routine laboratory data
Main Article Content
Abstract
Background: Dyscalcemia is associated with significant clinical complications, and the demand for calcium testing is rising disproportionately.
Objectives: This study aimed to develop machine learning (ML) models to predict total calcium abnormalities using routine available demographic and laboratory data to optimize laboratory test utilization.
Materials and Methods: This retrospective study analyzed data from 7,951 patients at Siriraj Hospital between April 2023 and March 2024. Feature selection identified ten predictors, including patient status, absolute lymphocyte count, albumin, bicarbonate, hematocrit, hemoglobin, platelet count, potassium, red blood cell count, and total protein. Seven ML algorithms were developed and validated using an 80:20 training-testing split with 10-fold cross-validation and hyperparameter tuning. The Synthetic Minority Oversampling Technique was applied to address class imbalance. Additionally, model calibration was evaluated using Brier scores, and Platt scaling was applied to ensure the reliability of predicted probabilities.
Results: XGBoost achieved the highest AUC (0.84), indicating slightly better discriminative performance, and the highest specificity (0.86), reflecting a stronger ability to correctly identify normal cases. Random forest yielded the highest F1 score (0.71) and recall (0.76), indicating a better balance between precision and recall, with higher sensitivity for detecting abnormal cases.
Following Platt scaling, the calibrated models achieved robust Brier scores (e.g., 0.1496 for random forest and 0.1497 for XGBoost), demonstrating highly accurate probability risk estimation. SHAP analysis identified albumin as the most influential feature, followed by total protein and hemoglobin.
Conclusion: ML models utilizing demographic and laboratory data can accurately predict plasma total calcium status, and probability calibration ensures reliable risk estimates. XGBoost and random forest demonstrated robust performance with complementary strengths. These models show promise as screening tools for identifying high-risk patients and optimizing rational laboratory utilization.
Article Details

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
Personal views expressed by the contributors in their articles are not necessarily those of the Journal of Associated Medical Sciences, Faculty of Associated Medical Sciences, Chiang Mai University.
References
Zhi M, Ding EL, Theisen-Toupal J, Whelan J, Arnaout R. The landscape of inappropriate laboratory testing: a 15-year meta-analysis. PLoS One. 2013; 8(11): e78962. doi: 10.1371/journal.pone.0078962.
Walker MD, Shane E. Hypercalcemia: A Review. JAMA. 2022; 328(16): 1624-36. doi: 10.1001/jama.2022.18331.
Bilezikian JP. Hypoparathyroidism. J Clin Endocrinol Metab. 2020; 105(6): 1722-36. doi: 10.1210/clinem/dgaa113.
Lidbury BA, Richardson AM, Badrick T. Assessment of machine-learning techniques on large pathology data sets to address assay redundancy in routine liver function test profiles. Diagnosis (Berl). 2015; 2(1): 41-51. doi: 10.1515/dx-2014-0063.
Pawuś D, Porażko T, Paszkiel S. Automated biomedical measurements analysis: Innovative models based on machine learning for predicting laboratory results in nephrology. Expert Syst Appl. 2025; 270: 126568. doi: 10.1016/j.eswa.2025.126568.
Luo Y, Szolovits P, Dighe AS, Baron JM. Using machine learning to predict laboratory test results. Am J Clin Pathol. 2016; 145(6): 778-88. doi: 10.1093/ajcp/aqw064.
Kurstjens S, de Bel T, van der Horst A, Kusters R, Krabbe J, van Balveren J. Automated prediction of low ferritin concentrations using a machine learning algorithm. Clin Chem Lab Med. 2022; 60(12): 1921-8. doi: 10.1515/cclm-2021-1194.
Efros O, Soffer S, Mudrik A, Robinson R, Kenet G, Nadkarni GN, et al. Predictive machine-learning model for screening iron deficiency without anaemia: a retrospective cohort study. BMJ Open. 2025; 15(8): e097016. doi: 10.1136/bmjopen-2024-097016.
Varekha NV, Stuklov NI, Gordienko KV, Gimadiev RR, Shchegolev OB, Kislaya SN, et al. Development of a method for differential diagnosis of iron deficiency anemia and anemia of chronic disease based on demographic data and routine laboratory tests using machine learning technologies. Oncohem. 2025; 20(1): 171-81. doi: 10.17650/1818-8346-2025-20-1-171-181.
Li W, Su CY, Meulenbeld A, Jagirdar H, Janssen MP, Swanevelder R, et al. Machine-learning models to predict iron recovery after blood donation: a model development and external validation study. Lancet Haematol. 2025; 12(6): e431-e41. doi: 10. 1016/S2352-3026(25)00068-7.
Yang HS, Pan W, Wang Y, Zaydman MA, Spies NC, Zhao Z, et al. Generalizability of a machine learning model for improving utilization of parathyroid hormone-related peptide testing across multiple clinical centers. Clin Chem. 2023; 69(11): 1260-9. doi: 10.1093/clinchem/hvad141.
Bancal C, Salipante F, Hannas N, Lumbroso S, Cavalier E, De Brauwere DP. A new approach to assessing calcium status via a machine learning algorithm. Clin Chim Acta. 2023; 539: 198-205. doi: 10.1016/j.cca.2022.12.018.
Kumari S, Nayak S, Mangaraj M. A new machine learning approach for actual calcium measurement. Indian J Clin Biochem. 2025; 40(2): 300-6. doi: 10.1007/s12291-024-01182-3.
Hung WL, Huang CF, Tsai MH, Liou HH, Liu PY, Fang YW. A new predictive equation for estimating serum ionized calcium levels in patients on chronic hemodialysis. Med Sci Monit. 2023; 29: e941321. doi: 10.12659/MSM.941321.
Yap E, Ouyang J, Puri I, Melaku Y, Goldwasser P. Novel methods of predicting ionized calcium status from routine data in critical care: External validation in MIMIC-III. Clin Chim Acta. 2022; 531: 375-81. doi: 10.1016/j.cca.2022.05.003.
Chawla NV, Bowyer KW, Hall LO, Kegelmeyer WP. SMOTE: synthetic minority over-sampling technique. J Artif Intell Res. 2002; 16: 321-57. doi: 10.1613/jair.953.
Fraser WD, Alter DN. Bone and mineral metabolism. In: Rifai N, Chiu RW, Young I, Burnham C-AD, Wittwer CT, editors. Tietz Textbook of Laboratory Medicine. 7th Ed. St. Louis: Elsevier; 2023. pp 766-e85.
Payne RB, Little AJ, Williams RB, Milner JR. Interpretation of serum calcium in patients with abnormal serum proteins. Br Med J. 1973; 4(5893): 643-6. doi: 10.1136/bmj.4.5893.643.
Wang Z, Chen X, Chen Y, Yang L, Wang H, Jiang W, et al. Association between admission serum calcium and hemoglobin in older patients with hip fracture: a cross-sectional study. Eur Geriatr Med. 2022; 13(2): 445-52. doi: 10.1007/s41999-021-00569-2.
Haji S, Atta A, Sagir Ahmad J, Farrukh Zia T, Javed N, Muhammad N, et al. An analysis of anaemia and serum calcium levels in chronic kidney disease as an indicator of severity and progression of disease in patients of South Punjab, Pakistan: Anemia and calcium in CKD severity. J Health Rehabil Res. 2024; 4(3): 1-9. doi: 10.61919/jhrr.v4i3.1261.
Şahin S, Yıldız N, Esenülkü G, Özkan Kart P, Kamasak T, Özkaya AK, et al. Serum calcium levels, erythrocyte indices, and associated factors in children with febrile seizures. Farabi Tıp Dergisi. 2025; 4(2): 17-26. doi: 10.59518/farabimedj.1590060.