Clinical validation · Research feature

Development and External Validation of Machine Learning Models for Ionized Calcium Estimation in Hypoalbuminemia

The findings suggest that while machine learning models offer useful estimates, they do not surpass unadjusted total calcium in hypocalcemia discrimination and should be used as complementary tools rather than replacements for measured ionized calcium.

Adapted from research by Deniz L, Solar T, Deveci Kocakoc I and colleagues.

Journal publication · 2026-10-17 · Attribution & reuse
In this article
Editorial illustration of a sheet of visual frames.

Editor’s introduction

The study developed and externally validated XGBoost and ordinary least squares models to estimate ionized calcium in adults with hypoalbuminemia. These models outperformed classical correction formulas in the development cohort, with XGBoost showing the highest AUC-ROC and F1-score for detecting hypocalcemia. The findings suggest that while machine learning models offer useful estimates, they do not surpass unadjusted total calcium in hypocalcemia discrimination and should be used as complementary tools rather than replacements for measured ionized calcium.

Introduction

Calcium is a mineral that is tightly controlled and important for many bodily functions, including bone mineralization, neuromuscular excitability, and intracellular signal transduction. Problems in calcium homeostasis can have serious health effects and may even be fatal. Therefore, it is important to accurately estimate calcium levels, correctly identify imbalances, and quickly treat low or high calcium levels to ensure appropriate clinical treatment. Calcium in blood is made up of three main components: about 50% is in free (ionized) form, about 40% is bound to plasma proteins, mostly albumin, and about 10% is combined with small anions, such as bicarbonate, phosphate, lactate, and citrate. Ionized calcium is a biologically active calcium component. In contrast, the protein-bound fraction acts as a dynamic reservoir that maintains a stable concentration of ionized calcium over short periods. Albumin is the most abundant protein in circulation and has a high ligand-binding capacity; therefore, changes in albumin concentration can significantly affect the measured total calcium levels without affecting the physiologically active ionized fraction. This situation forms the basis of the phenomenon of pseudohypocalcemia, which can lead to low measured total calcium levels despite normal ionized calcium levels. Therefore, albumin-adjusted calcium formulas are commonly used to estimate corrected calcium levels, particularly in hypoalbuminemic conditions. Recent evidence has raised substantial concerns regarding the clinical utility of albumin-adjusted calcium formulas, suggesting that these correction equations do not consistently outperform unadjusted total calcium and may introduce systematic bias. In recent years, data-driven modeling approaches have been proposed as alternative strategies for improving the estimation of ionized calcium.

Recent studies have demonstrated that while conventional methods, such as albumin-adjusted calcium, often fall short in accuracy, particularly in patients with hypoalbuminemia or acid-base disorders, machine learning algorithms show promise in enhancing their predictive capabilities. Previous studies have suggested that incorporating additional biochemical variables, along with total calcium and albumin levels, may improve the discrimination of ionized calcium abnormalities. This shift underscores the need for more sophisticated approaches to assess calcium status and supports further investigation of data-driven models as complementary approaches for estimating ionized calcium levels and identifying calcium abnormalities. Although recent studies by Bancal et al. and Kumari et al. applied machine learning approaches to calcium estimation and reported promising results, both evaluated the model performance within their respective single-center datasets, and the transportability of these approaches to an independent external cohort remained uncertain. Recent guidance has become more critical of routine albumin adjustment: a 2026 joint IOF/IFCC/EFLM position statement recommended against routine reporting of albumin-adjusted (“corrected”) calcium. In parallel, a large retrospective study of 84,410 patients reported that machine learning models based on routinely available biochemical measurements outperformed the conventional correction formulas evaluated in that study for ionized-calcium prediction.

This study aimed to develop and evaluate machine learning models for directly predicting measured ionized calcium levels in patients with hypoalbuminemia, compare their performance with that of unadjusted total calcium and conventional calcium correction formulas, and assess their transportability in an independent external cohort. In addition, the diagnostic performance of these approaches in identifying hypocalcemia was evaluated using the measured ionized calcium level as a reference.

Data Preprocessing and Outlier Handling

Extreme outlier values of the continuous predictor variables were identified using Tukey’s interquartile range (IQR) method and were defined as Q1 − 3 × IQR and Q3 + 3 × IQR. Instead of excluding observations beyond these thresholds, the values were winsorized by replacing them with the nearest boundary value, thereby preserving the observations while limiting their disproportionate influence on model training. This approach is particularly advantageous for clinical datasets where extreme measurements may correspond to severe disease states and thus provide important information. For nested cross-validation, winsorization bounds were estimated within each outer training fold and applied to the corresponding training and test folds to limit information leakage. Extremely high ionized calcium values in each outer training fold were capped at the corresponding training-fold 99.7th percentile. The measured ionized calcium values in the held-out test folds were not capped, winsorized, or otherwise modified, and all out-of-fold performance metrics were calculated against the original uncapped test outcomes. The lower ionized calcium values were left unchanged. For the final full-cohort model used for interpretability analyses and subsequent external validation, winsorization bounds were estimated from the complete hypoalbuminemia cohort. Within nested cross-validation, all preprocessing parameters were estimated exclusively from the corresponding training data and were subsequently applied unchanged to the held-out test fold.

Classification Performance

Reference calcium categories were defined from measured ionized calcium using the laboratory reference limits: hypocalcemia (<1.15 mmol/L), normocalcemia (≥1.15 to <1.35 mmol/L), and hypercalcemia (≥1.35 mmol/L). The continuous XGBoost out-of-fold predictions, which were on the ionized-calcium scale, were categorized using the same thresholds. Because the unadjusted total calcium and classical correction formulas are expressed on the total-calcium scale, they were categorized using the exact aligned total-calcium limits of 2.1956 and 2.6447 mmol/L (Section 2.3). The original code classified values below 2.1956 as hypocalcemic, values above 2.6447 as hypercalcemic, and values at either boundary as normocalcemic. The same exact thresholds were used in development and external validation; the routinely reported total-calcium interval was 2.20–2.65 mmol/L. The lower limit of 1.15 mmol/L was used because it is the laboratory reference limit for ionized calcium; it was not selected to maximize model performance.

External Validation

The external validation cohort consisted of adult patients with hypoalbuminemia (albumin < 35 g/L) evaluated at an independent center between February 2024 and December 2025. The external center used the same analytical platforms and measurement methodologies as the development center, with biochemical measurements performed using a Beckman Coulter AU5800 analyzer (Beckman Coulter, Brea, CA, USA) and ionized calcium measured using a Siemens RAPIDLab 1265 blood gas analyzer (Siemens Healthcare Diagnostics Inc., Tarrytown, NY, USA). Records were ordered according to patient identifier, collection date, and sample number, and only the first chronologically eligible measurement per patient was retained. The eligibility criteria, predictor definitions, and calcium reference intervals were consistent with those applied in the development cohort. Total calcium, albumin, total protein, creatinine, and ionized calcium levels were measured using the same analyzer models and analytical methodologies as in the development cohort.

The frozen XGBoost regression model and the full-cohort OLS equation, both developed for the hypoalbuminemia cohort described above, were subsequently evaluated in this independent external hypoalbuminemia cohort. Both models were applied without refitting, hyperparameter tuning, recalibration, or threshold optimization. For external applications, the XGBoost model was the single final fit for the complete development cohort (n = 14,745) using the hyperparameter set most frequently selected across the outer nested cross-validation folds: objective = reg:squarederror, max_depth = 4, learning_rate = 0.05, n_estimators = 100, subsample = 0.8, colsample_bytree = 1.0, and random_state = 42. During this full-cohort fit, the training target was capped at the development cohort 99.7th percentile of measured ionized calcium (quantile 0.997); values below this upper bound were left unchanged. The measured ionized calcium values in the external cohort were not capped, winsorized, or otherwise modified. Predictor winsorization limits were derived exclusively from the development cohort using Tukey’s 3 × IQR bounds (Section 2.5.1) and were applied unchanged to the external predictors (total calcium, albumin, total protein, and eGFR). The OLS model was applied using a previously reported full-development equation without re-estimation of the coefficients: ionized calcium = 0.339 + 0.438 × total calcium − 0.00441 × albumin − 0.00114 × total protein + 0.000051 × eGFR. The unadjusted total calcium level was included only as a routine clinical benchmark for calcium classification. Classical adjusted calcium formulas were not re-evaluated in the external cohort because the objective of this analysis was to assess the transportability of the newly developed prediction models rather than to re-validate the classical correction equations already characterized in the development cohort.

External regression performance was summarized using R2, MAE, RMSE, and bias, where bias was defined as the mean (predicted − observed) in mmol/L. External calibration was assessed by the linear model observed ionized calcium = intercept + slope × predicted ionized calcium and by Bland–Altman analysis of predicted minus measured ionized calcium. For hypocalcemia detection, the reference positive class was defined as measured ionized calcium < 1.15 mmol/L. Predicted hypocalcemia was defined as predicted ionized calcium < 1.15 mmol/L for XGBoost and OLS, and as unadjusted total calcium < 2.1956 mmol/L for the total-calcium benchmark (the exact code-defined cutoff). Three-class ionized-calcium categories used the development-cohort reference thresholds (hypocalcemia < 1.15 mmol/L; normocalcemia ≥ 1.15 to <1.35 mmol/L; hypercalcemia ≥ 1.35 mmol/L); for the total-calcium benchmark the exact code-defined limits were 2.1956 and 2.6447 mmol/L (Section 2.3). The diagnostic metrics included clinical sensitivity, clinical specificity, predictive values, F1-score, accuracy, and AUC-ROC. Because a lower predicted calcium indicates a higher likelihood of hypocalcemia, the AUC-ROC used the negative of the continuous calcium value as the ranking score (−predicted ionized calcium for XGBoost and OLS; −total calcium for the benchmark). Ninety-five percent confidence intervals for the regression metrics, AUC-ROC, and related continuous summaries were estimated using nonparametric bootstrap resampling (2000 resamples, percentile method, random seed 42). Ninety-five percent confidence intervals for the sensitivity, specificity, PPV, and NPV were calculated using the Wilson score method. For the paired external comparison of XGBoost and OLS, differences in R2, MAE, and RMSE were estimated using a patient-level nonparametric bootstrap (2000 resamples, seed 42). Both models were evaluated using identical patient indices for each resample, and 95% confidence intervals were calculated using the percentile method.

Model explainability in the independent external cohort was also assessed using the SHAP TreeExplainer applied to the saved final XGBoost model used for external prediction, without retraining or retuning. The SHAP values were calculated for all 2751 external observations after applying the development-derived 3 × IQR predictor winsorization bounds stored with the model. Global feature importance was summarized as the mean absolute SHAP value across patients. Relative shares were obtained by normalizing these means to sum to 100% and were descriptive only.

Discussion

This study evaluated the agreement and classification performance of unadjusted total calcium, adjusted formulas, and a machine learning-based approach against measured ionized calcium in patients with hypoalbuminemia. Total calcium and the Jain formula showed similar overall performance, with misclassification most notably reflected in the overestimation of hypocalcemia among normocalcemic individuals. Using nested cross-validation and hyperparameter tuning, the XGBoost model demonstrated the highest AUC-ROC and F1-score for hypocalcemia detection, although this was accompanied by an increased rate of false-positive classifications. The Simplified Payne formula demonstrated the weakest performance, primarily due to its markedly low clinical sensitivity for hypocalcemia, despite its relatively high clinical specificity.

In clinical practice, hypoalbuminemia is one of the most common causes of low total calcium levels, particularly in hospitalized patients. A decrease in albumin levels can lead to a decrease in the measured total calcium values, even though ionized calcium remains normal. Ionized calcium levels can be influenced by several factors, including acid–base status, citrate, heparin, and free fatty acids. These physiological relationships highlight the limitations of simple correction formulas based solely on total calcium and albumin levels. Although ionized calcium is accepted as the reference standard for evaluating physiological calcium status, it is not routinely measured in all patients in many clinical laboratories. The main reasons for this are preanalytical requirements, specific sampling conditions, and measurement requirements generally associated with blood gas analysis. As a practical and cost-effective reflex testing approach, the use of unadjusted total calcium as an initial screening test may be considered, with measurement of ionized calcium reserved for confirmation in cases where the results fall outside the reference range or are inconsistent with the clinical context, particularly in patients with low eGFR, hypoalbuminemia, or critical illness.

Our findings are consistent with those of recent large-scale studies questioning the added clinical value of albumin-corrected calcium formulas compared with uncorrected total calcium. Numerous studies have highlighted the limitations of albumin-corrected calcium formulations. Ladenson et al. assessed 13 calcium adjustment formulas, including those of Orrell, Berry, and Payne, in a cohort of hospitalized patients and controls, and demonstrated that none outperformed unadjusted total calcium in correlating with ionized calcium. Compared to ionized calcium, albumin-corrected calcium has been reported to accurately classify calcium status in only 57–66% of cases. A study by Desgagnés et al. showed that commonly used correction formulas do not consistently improve agreement with ionized calcium levels and may lead to systematic bias, particularly in patients with hypoalbuminemia. The use of total calcium and albumin-corrected calcium formulas often leads to misclassification of patients’ calcium status. In particular, when clinical conditions such as altered albumin levels, renal function, or blood pH are present, the formulas cannot reliably estimate the calcium status. In patients with low albumin levels (<35 g/L) or abnormal blood pH, calcium corrected by the Payne formula tends to overestimate the calcium status in up to 80% of cases. Because the Clase, Jain, and Ridefelt formulas contain lower albumin coefficients than the Payne formula, they demonstrate a significant improvement (higher agreement rate) compared to the Payne formula in patients with low albumin levels. Consistent with the literature, we observed that total calcium alone performed better than most classical formulas in the hypoalbuminemia subgroup. Many formulas, particularly those based solely on albumin correction, such as the Simplified Payne formula, exhibited a clinically significant positive bias (overestimation). Consistent with previous reports, the Jain formula showed a modest improvement over total calcium and reduced the misclassification of hypocalcemia compared to the Payne formula. These findings support the growing view that fixed- or rule-based correction equations may not adequately reflect multifactorial determinants of calcium homeostasis in different clinical settings, including renal function and acid–base status.

Recent literature further supports this direction. Kösem et al., in a large cohort of 84,410 patients, reported improved continuous ionized-calcium prediction with support vector machine, random forest, and gradient boosting models compared with conventional correction formulas. Notably, however, their machine-learning models showed a pronounced sensitivity–specificity trade-off for hypocalcemia detection, with sensitivities of 98.7–98.9% but specificities of only 24.5–26.0%. This pattern closely resembles our internal findings for XGBoost (sensitivity, 98.5%; specificity, 26.0%), suggesting that the high sensitivity observed with machine-learning approaches should be interpreted together with the associated false-positive burden rather than as evidence of uniformly improved classification performance. This study highlighted external validation, pH incorporation, and model interpretability as priorities for future research. The present study addresses these areas through independent external validation, pH sensitivity analysis, and external-cohort SHAP analysis; however, differences in population and study design preclude direct comparison of performance estimates.

The pH sensitivity analysis showed a small overall improvement in continuous ionized-calcium prediction when the recorded pH was added to the four routine serum predictors. In exploratory development-cohort strata, the original model tended to underestimate ionized calcium in acidemia and overestimate it in alkalemia; including pH brought the mean bias closer to zero in both groups. The absolute MAE reductions were small but numerically larger in the abnormal pH groups than in the normal pH group, without a formal test of effect modification. Lower continuous error did not translate into uniform fixed-threshold classification gains: in acidemia, adding pH reduced false positives but increased false negatives, while in alkalemia, the reverse trade-off was observed. These findings support the physiological relevance of pH but do not change the intended routine serum biochemistry use of the primary four-variable model. The pH-extended model and pH subgroup results have not been externally validated because the external cohort had no pH measurements.