Related Experiment Video
Updated: May 20, 2026

Implementation of a Real-Time Psychosis Risk Detection and Alerting System Based on Electronic Health Records using CogStack
Published on: May 15, 2020
Development of a machine learning-based depression risk prediction model for middle-aged and elderly Chinese heart
Guangzhen Fu1, Yuhan Shen1, Jingjing Yang1
1Department of Clinical Laboratory, The First Affiliated Hospital of Zhengzhou University, Zhengzhou, China.
Objective:
Heart disease is a leading cause of death and disability among middle-aged and elderly populations. Depression is a common comorbidity that impairs prognosis and quality of life. This study aimed to develop a machine learning (ML)-based depression risk prediction model based on China Health and Retirement Longitudinal Study (CHARLS) data.
Methods:
A total of 947 middle-aged and elderly heart disease patients from CHARLS 2015 were included after applying missing data criteria. Missing values were filled using random forest (RF), and data were split 7:3 into training and validation cohorts. Variables selection in the training cohort using univariate analysis, Lasso regression, recursive feature elimination (RFE), and feature importance evaluation using RF and decision tree (DT). Variables appearing in at least three of these five methods were selected. Eleven ML models were constructed and evaluated by area under the curve (AUC), sensitivity, specificity, positive predictive value, negative predictive value, F1 score, calibration curve and decision curve analysis. Five-fold cross-validation enhanced stability and SHapley Additive exPlanation (SHAP) values interpreted feature importance.
Results:
Fifty-eight variables were extracted. After multi-step variable selection within the training cohort, nine variables (address, grip-max, arthritis rheumatism, Hope, sleep time, pain, Retire, ADL, IADL) were initially identified. Among 11 ML models, the logistic regression (LR) algorithm demonstrated the best overall performance with an AUC of 0.792 in the validation cohort. A 4-variable LR model (pain, address, sleep time, and grip-max) was optimized, achieving a comparable AUC of 0.788. SHAP analysis confirmed pain as the most critical predictor (69.0% of depressed patients reported pain versus 26.9% of non-depressed patients). Rural residence (86.5% vs. 66.7%), shorter sleep time (median 5.25(4.00, 7.00) vs. 6.00(5.00, 8.00) hours), and lower grip-max (24.50(20.00, 30.00) vs. 27.00(22.50, 33.40) increased depression risk. A user-friendly web-based calculator was developed for clinical applications.
Conclusions:
The simplified LR model exhibits robust predictive performance and clinical applicability for assessing high depression risk in middle-aged and elderly patients with heart disease.