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.
Insights
Machine learning accurately predicts depression risk in heart disease patients. Key factors include pain, rural residence, sleep duration, and grip strength, aiding early intervention.
Area of Science:
- Cardiology
- Geriatrics
- Psychiatry
- Machine Learning
Background:
- Heart disease is a major cause of mortality and morbidity in older adults.
- Depression frequently co-occurs with heart disease, worsening patient outcomes and quality of life.
Purpose of the Study:
- To develop and validate a machine learning (ML)-based model for predicting depression risk in middle-aged and elderly individuals with heart disease.
- To identify key predictors of depression in this patient population using data from the China Health and Retirement Longitudinal Study (CHARLS).
Main Methods:
- Utilized data from 947 CHARLS participants (2015) with heart disease.
- Employed random forest for missing data imputation and rigorous variable selection techniques (univariate analysis, Lasso, RFE, feature importance).
- Constructed and evaluated 11 ML models, selecting logistic regression (LR) for its superior performance, validated using cross-validation and SHAP values.
Main Results:
- A parsimonious 4-variable LR model (pain, address, sleep time, grip strength) achieved an AUC of 0.788.
- Pain emerged as the strongest predictor (69% vs. 26.9% in depressed vs. non-depressed groups).
- Increased depression risk was associated with rural residence, shorter sleep duration, and lower grip strength.
Conclusions:
- The simplified LR model demonstrates strong predictive accuracy and clinical utility for identifying high depression risk in cardiac patients.
- The developed web-based calculator offers a practical tool for clinical application and early risk assessment.
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.