Predicting Length of Stay using machine learning for total joint replacements performed at a rural community hospital

Thumbnail Image



Journal Title

Journal ISSN

Volume Title


Plos One


Background. Predicting patient’s Length of Stay (LOS) before total joint replacement (TJR) surgery is vital for hospitals to optimally manage costs and resources. Many hospitals including in rural areas use publicly available models such as National Surgical Quality Improvement Program (NSQIP) calculator which, unfortunately, performs suboptimally when predicting LOS for TJR procedures. Objective. The objective of this research was to develop a Machine Learning (ML) model to predict LOS for TJR procedures performed at a Perioperative Surgical Home implemented rural community hospital for better accuracy and interpretation than the NSQIP calculator. Methods. A total of 158 TJR patients were collected and analyzed from a rural community hospital located in Montana. A random forest (RF) model was used to predict patient’s LOS. For interpretation, permuted feature importance and partial dependence plot methods were used to identify the important variables and their relationship with the LOS. Results. The root mean square error for the RF model (0.7) was lower than the NSQIP calculator (1.21). The five most important variables for predicting LOS were BMI, Duke Activity Status-Index, diabetes, patient’s household income, and patient’s age. Conclusion. This pilot study is the first of its kind to develop an ML model to predict LOS for TJR procedures that were performed at a small scale rural community hospital. This pilot study contributes an approach for rural hospitals, making them more independent by developing their own predictions instead of relying on public models.


This is an open access article, free of all copyright, and may be freely reproduced, distributed, transmitted, modified, built upon, or otherwise used by anyone for any lawful purpose. The work is made available under the Creative Commons CC0 public domain dedication.


joint replacements, rural community, rural community hospital, length of stay


Sridhar S, Whitaker B, Mouat-Hunter A, McCrory B (2022) Predicting Length of Stay using machine learning for total joint replacements performed at a rural community hospital. PLoS ONE 17(11): e0277479. journal.pone.0277479
Copyright (c) 2002-2022, LYRASIS. All rights reserved.