# Length of postoperative stay prediction in elderly patients with hip fractures based on machine learning

**Authors:** Yanli Hu, Hong Qu, Feifan Wang, Fangfang Deng, Qun Luo, Tingting Gong

PMC · DOI: 10.3389/fmed.2025.1728645 · Frontiers in Medicine · 2026-01-14

## TL;DR

This study uses machine learning to predict hospital stay length for elderly hip fracture patients, improving resource planning and clinical decisions.

## Contribution

A novel machine learning model (BP-NN) is developed to predict length of postoperative stay without dichotomizing the variable.

## Key findings

- The BP-NN model achieved an R2 of 0.83 and 90% of predictions within a 30% error threshold.
- Age and age-adjusted Charlson comorbidity index were identified as the main predictors of length of postoperative stay.
- The model outperformed SVM and random forest in predicting LOPS with lower RMSE, MAE, and MAPE.

## Abstract

Length of postoperative stay (LOPS) is an important indicator for resource allocation and clinical management in elderly patients with hip fractures. However, previous studies have mostly dichotomized this continuous variable to determine whether it is prolonged, a practice that inherently reduces information and introduces limitations. This study aimed to develop and validate a machine learning (ML) model to accurately predict the specific LOPS in elderly patients with hip fractures.

This retrospective cohort study included electronic health records (EHRs) of elderly patients with hip fractures admitted to Yichang Central People’s Hospital from January 2016 to December 2022, with a total of 734 patients. Variables commonly measured preoperatively were extracted based on a review of previous studies, and features were selected using Pearson correlation coefficients combined with LASSO regression to construct a backpropagation neural network (BP-NN) model. For comparative evaluation, support vector machine (SVM) and random forest (RF) regression models were developed under the same dataset split (8:2), feature set, and hyperparameter optimization strategy. Model performance was assessed by comparing predicted values versus actual LOPS and calculating root mean square error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE), and error thresholds (20%, 30%). The feature importance of the BP-NN model was analyzed via SHapley Additive exPlanations (SHAP) values.

Among 734 elderly patients with hip fractures, 503 (68.53%) were female, with an average LOPS of 17.42± 3.77 days. Femoral neck fracture (59.26%) and hemiarthroplasty (41.96%) were the most common fracture type and surgical type, respectively. Pearson correlation analysis and LASSO regression showed that age, age-adjusted Charlson comorbidity index (ACCI), and surgical type were the predictors of LOPS. Further sensitivity analysis adjusting for confounding factors revealed that the very old elderly group (aged or above 90 years) had the longest LOPS (15.84± 0.15 days vs. 17.85± 0.14 days vs. 21.99 ± 0.66 days), with no statistically significant difference in LOPS between different surgical type subgroup (P > 0.05). The predicted values of the BP-NN were consistent with the trend of actual LOPS (R2 = 0.83), with the vast majority of prediction results falling within 30% clinically acceptable error threshold. Its RMSE, MAE and MAPE of 1.23 days, 1.57 days and 7.69% respectively. SHAP analysis revealed that ACCI and age were the main factors influencing LOPS.

The BP-NN model, enhanced by multimethod feature selection, rigorous parameter tuning, and SHAP based interpretability, provides early and accurate LOPS prediction for elderly hip fracture patients. It can be used as a tool to assist in clinical decision-making, resource planning, and discharge preparation, without increasing the clinical burden. Future external validation across multiple centers is needed to confirm generalizability.

## Full-text entities

- **Diseases:** fracture (MESH:D050723), Femoral neck fracture (MESH:D005265), hip fracture (MESH:D006620)
- **Species:** Homo sapiens (human, species) [taxon 9606]

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/PMC12847269/full.md

## Figures

5 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12847269/full.md

## References

49 references — full list in the complete paper: https://tomesphere.com/paper/PMC12847269/full.md

---
Source: https://tomesphere.com/paper/PMC12847269