Evaluation of principal component–based and synthetic feature representations in machine learning prediction of hospital length of stay in COVID-19 patients using XGBoost algorithm
DOI:
https://doi.org/10.69139/j5e22841Keywords:
COVID-19, Principal Component Analysis, Machine Learning, Length of Stay, BiomarkersAbstract
Background: The COVID-19 pandemic highlighted limitations of healthcare systems and the need for early identification of patients at risk of prolonged hospitalization. This study aimed to develop a machine learning model for predicting the length of hospital stay in patients with non-severe COVID-19 and to identify key predictive factors using SHAP and PCA analyses.
Material and methods: Anonymized data from 1,027 patients hospitalized due to SARS-CoV-2 infection between November 2020 and May 2021 were retrospectively analyzed. After exclusion of severe COVID-19 cases, 786 patients were included in the predictive analysis. A total of 58 biological variables, including baseline, mean, and median values of 19 laboratory parameters, were used. XGBoost regression models with quantile regression were developed using different data representations: RAW variables, PCA_FULL, PCA reduced to 10 components, and synthetic variables. Model performance was assessed using RMSE, MAE, and interval classification agreement.
Results: The RAW model achieved the best predictive performance (RMSE 6.66 days, MAE 4.49 days, agreement 0.276). PCA-based dimensionality reduction significantly reduced prediction accuracy. SHAP analysis identified inflammatory and tissue injury markers, particularly CRP, D-dimer, IL-6, PCT, and AST, as the strongest predictors. PCA revealed biologically interpretable axes associated with inflammatory response, cardio-renal dysfunction, and coagulation abnormalities.
Conclusion: Machine learning models based on raw laboratory data enabled moderately effective prediction of hospitalization length in non-severe COVID-19 patients. Although PCA preserved clinically interpretable biological patterns, it reduced predictive performance. Hospitalization duration appears to be a multifactorial phenomenon requiring broader clinical context in future predictive models.
Downloads
References
Kufel, J., Bargieł-Łączek, K., Kocot, S., Koźlik, M., Bartnikowska, W., Janik, M., Czogalik, Ł., Dudek, P., Magiera, M., Lis, A., Paszkiewicz, I., Nawrat, Z., Cebula, M., & Gruszczyńska, K. (2023). What Is Machine Learning, Artificial Neural Networks and Deep Learning?—Examples of Practical Applications in Medicine. Diagnostics, 13(15), 2582. https://doi.org/10.3390/diagnostics13152582
Jolliffe IT, Cadima J. Principal component analysis: a review and recent developments. Philos Trans A Math Phys Eng Sci. 2016;374(2065):20150202. doi:10.1098/rsta.2015.0202
Barbour DL. Precision medicine and the cursed dimensions. NPJ Digit Med. 2019;2:4. Published 2019 Feb 4. doi:10.1038/s41746-019-0081-5
XGBoost Documentation. (n.d.). XGBoost documentation. Retrieved May 9, 2026, from https://xgboost.readthedocs.io/en/release_3.2.0/
SHAP Documentation. (n.d.). SHAP documentation. Retrieved May 9, 2026, from https://shap.readthedocs.io/en/latest/
Rutledge, A. C., Choi, Y.-H., Karp, I., Bhayana, V., & Stevic, I. (2021)., Biochemistry tests in hospitalized COVID-19 patients: Experience from a Canadian tertiary care centre., Clinical Biochemistry, 95, 41–48., https://doi.org/10.1016/j.clinbiochem.2021.05.008
Zanza C, Romenskaya T, Manetti AC, et al. Cytokine Storm in COVID-19: Immunopathogenesis and Therapy. Medicina (Kaunas). 2022;58(2):144. Published 2022 Jan 18. doi:10.3390/medicina58020144
Ebinger J, Wells M, Ouyang D, et al. A Machine Learning Algorithm Predicts Duration of hospitalization in COVID-19 patients. Intell Based Med. 2021;5:100035. doi:10.1016/j.ibmed.2021.100035
Mahboub B, Bataineh MTA, Alshraideh H, Hamoudi R, Salameh L, Shamayleh A. Prediction of COVID-19 Hospital Length of Stay and Risk of Death Using Artificial Intelligence-Based Modeling. Front Med (Lausanne). 2021;8:592336. Published 2021 May 4. doi:10.3389/fmed.2021.592336
Olivato, M., Rossetti, N., Gerevini, A. E., Chiari, M., Putelli, L., & Serina, I. (2022). Machine learning models for predicting short-long length of stay of COVID-19 patients. Procedia Computer Science, 207, 1232-1241.
Amiri P, Montazeri M, Ghasemian F, et al. Prediction of mortality risk and duration of hospitalization of COVID-19 patients with chronic comorbidities based on machine learning algorithms. Digit Health. 2023;9:20552076231170493. Published 2023 Jun 6. doi:10.1177/20552076231170493
Orooji, A., Shanbehzadeh, M., Mirbagheri, E., & Kazemi-Arpanahi, H. (2022). Comparing artificial neural network training algorithms to predict length of stay in hospitalized patients with COVID-19. BMC Infectious Diseases, 22(1), 923.
Downloads
Published
Data Availability Statement
No new data were created or analyzed in this study. Data sharing is not applicable to this article.
Issue
Section
Categories
License
Copyright (c) 2026 Jacek Jankowski, Joanna Bargieł-Kostuj, Marcin Rojek, Jakub Kufel (Author)

This work is licensed under a Creative Commons Attribution 4.0 International License.
