Skip to main content
Cancer Management and Research logoLink to Cancer Management and Research
. 2026 Sep 24;18:643647. doi: 10.2147/CMAR.S643647

Machine Learning Prediction of Prolonged Length of Stay in Older Patients with Lung Cancer: A Multicenter Study Using XGBoost with SHAP Interpretation

Xiao Li 1, Shuying Liu 1, Yating Gao 1, Dongfeng Zhang 1, Xiao Zhang 2, Kaining Zhang 1, Xia Wang 1, Huijuan Zhang 1, Xiaofei Li 1, Jierong Yin 1,✉
PMCID: PMC13618627  PMID: 42807629

Abstract

Background

Prolonged length of stay (PLOS) is common among older patients with lung cancer and is associated with increased risks of adverse outcomes, greater healthcare resource utilization, and reduced treatment efficiency. However, reliable risk stratification tools specifically designed for this population, particularly in the Chinese healthcare context, remain lacking.

Methods

This multicenter retrospective study included patients aged 65 years or older with primary lung cancer from two Chinese hospitals. PLOS was defined as a length of stay exceeding the 75th percentile of the overall cohort. After least absolute shrinkage and selection operator‑based feature selection from 34 candidate variables, six machine learning models were developed in the training set and validated using both internal and external validation sets. Model performance was assessed using discrimination, calibration, and clinical utility metrics. The optimal model was interpreted using SHapley Additive exPlanations (SHAP).

Results

A total of 5,836 patients were included. Among the six models, XGBoost achieved the highest discriminative performance, with area under the receiver operating characteristic curve values of 0.821 (95% CI: 0.806–0.837) in the training set, 0.773 in internal validation, and 0.727 in external validation. Calibration curves and decision curve analysis demonstrated satisfactory agreement and net clinical benefit. SHAP analysis identified pneumonia, hypoproteinemia, C‑reactive protein (CRP), uric acid (UA), and admission pathway as the top five predictors. Pneumonia, hypoproteinemia, CRP, admission pathway, and systolic blood pressure were positively associated with PLOS, whereas UA and total protein showed negative associations.

Conclusion

The XGBoost model provided robust and generalizable predictions of PLOS in older Chinese patients with lung cancer. Its interpretability may facilitate early identification of high‑risk individuals and support targeted perioperative interventions in geriatric oncology care.

Keywords: PLOS, lung cancer, multicenter, SHAP, XGBoost

Introduction

Lung cancer remains the leading cause of cancer-related mortality worldwide, with a median age at diagnosis exceeding 70 years.1,2 Prolonged length of stay (PLOS) is increasingly recognized as a critical indicator of healthcare efficiency and patient safety in geriatric oncology.3 A retrospective real-world study of 20,650 older cancer patients reported a median length of stay of 9 days, with older age, diabetes, and malnutrition independently associated with PLOS.4 Given that older patients frequently present with diminished physiological reserve and multiple comorbidities, they are particularly vulnerable to PLOS.5 Timely identification of high-risk individuals using PLOS as a monitoring metric may facilitate early intervention.

PLOS in older adults with lung cancer imposes substantial economic and clinical burdens.6 A prospective study demonstrated that older non-small cell lung cancer (NSCLC) patients with cachexia experienced significantly longer cumulative length of stay (80.7 vs 38.5 days) and higher costs (¥3.5 vs ¥2.1 million per person).7 A cohort study found that infection-related hospitalization was associated with immediate and persistent cognitive decline among nursing home residents.8 In lung cancer, PLOS has been independently associated with increased 30-day readmission rates and worse overall survival.9 PLOS also predisposes older patients to a spectrum of hospitalization-associated harms, including nosocomial infections, delirium, falls, and functional decline.10 With lung cancer accounting for nearly 1.8 million deaths annually worldwide, accurate PLOS prediction is essential for personalized care of this vulnerable population.11,12

Machine learning (ML) methods have gained traction in predicting PLOS, offering advantages over conventional regression in handling high-dimensional and nonlinear data.13 A Japanese study employing five algorithms to predict PLOS in 480 patients undergoing lung cancer surgery found that ridge regression achieved area under the receiver operating characteristic curve (AUC) values of 0.84 and 0.82 in the derivation and test cohorts, respectively.14 A deep learning study in 953 NSCLC patients achieved an AUC of 0.82 for predicting PLOS.15 ML has also successfully predicted 5-year survival in older NSCLC (AUC = 0.79) and timeliness of care (AUC = 0.89).16,17 However, existing models predominantly rely on admission data, lack integration of dynamic in-hospital data, and have limited interpretability (the “black-box” problem). Moreover, prediction tools specifically developed for older Chinese lung cancer patients remain scarce. To address these gaps, this study leverages real-world clinical data from a Chinese cohort to develop and validate multiple ML models for predicting PLOS in older patients with lung cancer. While we acknowledge that our model is also based on static admission data due to the inherent limitations of retrospective data extraction, a key advantage of our study is the deliberate prioritization of clinically accessible baseline features within the first 24 hours, coupled with a strong emphasis on model interpretability via Shapley additive explanations (SHAP). This ensures our model is highly actionable for early risk stratification at the point of admission.

Methods

Study Design and Participants

This was a multicenter retrospective study. We initially collected medical records from patients with lung cancer who received inpatient care at the Affiliated Banan Hospital of Chongqing Medical University between January 2020 and December 2025. After applying predefined eligibility criteria, data from this center were randomly allocated into a training set and an internal validation set at a ratio of 7:3. In addition, we collected data from patients with lung cancer hospitalized at Linfen Central Hospital between January 2018 and December 2025 to serve as an external validation set. The inclusion criterion was a confirmed diagnosis of primary lung cancer requiring inpatient treatment. This broad cohort included both surgical and non-surgical lung cancer patients, encompassing diverse treatment pathways such as surgery, chemotherapy, radiotherapy, and palliative care. Given the primary aim of developing a generalizable bedside risk stratification tool for older patients at admission, we deliberately did not restrict the cohort to specific treatment modalities. The exclusion criteria were as follows: (1) age < 65 years; (2) treatment discontinuation due to in-hospital death or discharge against medical advice; and (3) presence of a severe psychiatric disorder. Ultimately, a total of 5,836 eligible patients were enrolled across the two centers, comprising 3,347 in the training set, 1,435 in the internal validation set, and 1,054 in the external validation set. The detailed participant selection process is illustrated in Figure 1. This study was approved by the ethics committees of both the Affiliated Banan Hospital of Chongqing Medical University (approval no. BNLL-KY-2026-027) and Linfen Central Hospital (approval no. LY2026-35-01), and was conducted in accordance with the Declaration of Helsinki. Owing to the retrospective nature of the study and the use of de-identified data, the requirement for informed consent was waived by the institutional review boards of both participating centers.

Figure 1.

A flowchart of primary lung cancer inpatient study participant selection and allocation process. The flowchart illustrates the selection and allocation process for primary lung cancer inpatients across two centers. Center 1, from January 2020 to December 2025, initially included 11,153 patients. Exclusion criteria were age less than 65 years (5,212 patients), treatment discontinuation due to in-hospital death or discharge against medical advice (974 patients) and presence of a severe psychiatric disorder (185 patients). This resulted in 4,782 participants included in the analysis, divided into a training set of 3,347 and an internal validation set of 1,435. Center 2, from January 2018 to December 2025, initially included 2,815 patients. Exclusion criteria were age less than 65 years (1,528 patients), treatment discontinuation due to in-hospital death or discharge against medical advice (186 patients) and presence of a severe psychiatric disorder (47 patients). This resulted in 1,054 participants included in the analysis, allocated to an external validation set of 982.

Study participant flow diagram.

Data Collection

A total of 34 potential variables that may influence PLOS in older patients with primary lung cancer were identified, consisting of 27 baseline variables and 7 derived parameters. The 27 baseline variables included age, sex, marital status, admission pathway, smoking history, drinking history, surgical history, diabetes mellitus (DM), hypertension, coronary heart disease (CHD), chronic gastritis, hypoproteinemia, pneumonia, systolic blood pressure (SBP), diastolic blood pressure (DBP), international normalized ratio (INR), D-dimer, mean platelet volume (MPV), platelet distribution width (PDW), white blood cell (WBC) count, C-reactive protein (CRP), blood urea nitrogen (BUN), creatinine (CREA), uric acid (UA), total protein (TP), sodium (Na), and calcium (Ca).

To eliminate potential temporal data leakage, all predictor variables were extracted strictly at a predefined baseline prediction time point: within the first 24 hours of hospital admission. Specifically, diagnoses of pneumonia and hypoproteinemia were based on findings present at admission or documented within the first 24 hours. Laboratory parameters (including CRP, WBC count, D-dimer, etc.) were measured upon admission or within the initial 24-hour window. All variables were available to clinicians at the time of the baseline prediction, and none of the variables reflect events or complications occurring later during the hospitalization. For missing values in quantitative variables, multiple imputation was performed. Specifically, the mice package in R was used to implement predictive mean matching for all quantitative variables with missing data. The specific proportions of missing data for all quantitative variables are detailed in Table S1. A total of m = 5 imputed datasets were generated for each dataset. To ensure the complete isolation of validation data, the imputation model included only the candidate predictor variables, and the imputation process was performed separately and independently within the training set and each validation set.

The remaining seven derived parameters included neutrophil-to-lymphocyte ratio (NLR), platelet-to-lymphocyte ratio (PLR), lymphocyte-to-monocyte ratio (LMR), pan-immune-inflammation value (PIV), prognostic nutritional index (PNI), albumin-to-globulin ratio (AGR), and fibrinogen-to-albumin ratio (FAR). The formulas for PIV and PNI were as follows: PIV = (absolute neutrophil count ×absolute monocyte count × absolute platelet count)/absolute lymphocyte count; PNI = albumin (g/L) + 5 × absolute lymphocyte count (10^9/L). All derived parameters were calculated after multiple imputation was completed.

Definition of PLOS

The primary outcome of this study was the presence of PLOS. Given the lack of a standardized definition for PLOS, it was defined as exceeding the 75th percentile of the training set, in accordance with previous relevant studies.18–21 Length of stay was defined as the duration from the day of admission to the day of discharge. In this study, PLOS was operationalized as a length of stay greater than 13 days. This specific threshold (>13 days) was exclusively derived from the training set and then applied unchanged to both the internal and external validation sets.

Feature Selection

First, univariate analysis was performed in the training set to identify variables significantly associated with PLOS. Given the relatively high dimensionality of candidate variables (n=34) relative to the number of outcome events in the training cohort, the two-stage strategy was adopted to prioritize clinically stable variables, minimize model overfitting, and ensure parsimonious model construction. Variables showing statistical significance were then entered into the least absolute shrinkage and selection operator (LASSO) regression for further dimension reduction.22 This entire feature selection pipeline was performed once, strictly on the full training set prior to any model training, and was not repeated during the cross-validation process. The final set of variables was locked before proceeding to internal and external validation, ensuring no validation cohort information influenced the variable selection. To address multicollinearity, variance inflation factor (VIF) analysis was conducted on all variables retained by LASSO; no significant multicollinearity was considered to exist when all VIF values were below 5. In addition, a heatmap was generated and correlation coefficients were calculated for continuous variables to illustrate pairwise relationships. Finally, restricted cubic spline (RCS) analysis was employed to explore potential nonlinear associations between continuous variables and PLOS.23

ML Model Development and Performance Evaluation

Based on the final variables selected by LASSO regression, six different ML models—namely extreme gradient boosting (XGBoost), light gradient boosting machine (LightGBM), random forest (RF), logistic regression (LR), decision tree (DT), and support vector machine (SVM)—were developed in the training set to predict the risk of PLOS among older patients with lung cancer. Prior to model training, all continuous variables were standardized (Z-score normalization). Importantly, the mean and standard deviation for standardization were calculated exclusively from the training set and then applied to the internal and external validation sets to prevent any information leakage from the validation cohorts. Given the inherent class imbalance (PLOS vs non-PLOS approximately 1:3), the Synthetic Minority Over-sampling Technique (SMOTE) was strictly applied within the training folds during 5-fold cross-validation to ensure that the resampling process did not incorporate validation data. To guarantee reproducibility, a fixed random seed (seed = 42) was set for all procedures. The final optimal values of the hyperparameters for each algorithm are presented in Table S2. Performance metrics for cross‑model comparison included AUC, sensitivity, specificity, Youden index, and F1 score, with AUC serving as the primary measure of discriminative ability. To quantify the precision of these estimates, 95% confidence intervals (CIs) for all performance metrics were calculated using 1,000 bootstrap resampling iterations across all three datasets. To assess calibration fidelity objectively, in addition to visual inspection of calibration curves, the calibration intercept, calibration slope, and Brier score were calculated for all models. To assess calibration fidelity and clinical utility, calibration curves and decision curve analysis (DCA) were performed. To enhance the interpretability of the ML models, the best‑performing model among the six was selected. SHAP methodology was then applied for explanation, including ranking feature importance, calculating SHAP values for each feature, and visualizing these values to clarify the specific associations between features and the risk of PLOS.24

Statistical Analysis

All statistical analyses were performed using R software (version 4.3.3) and Python software (version 3.12.3). Continuous variables following a normal distribution were presented as mean ± standard deviation and compared between groups using Student’s t‑test. Continuous variables with a non‑normal distribution were summarized as median (interquartile range) and compared using the Mann‑Whitney U-test. Categorical variables were expressed as counts (percentages) and analyzed using the chi‑square test. A two‑sided p‑value < 0.05 was considered statistically significant.

Results

Baseline Characteristics of the Study Cohort

A total of 5,836 eligible participants were ultimately included in this study. The median age in both the training and internal validation sets was 71 years (interquartile range: 68–76 years), with males accounting for 72% of the cohort and married individuals representing the vast majority (92.18%) (Table 1). In contrast, the external validation cohort (n = 1,054, from Linfen Central Hospital) exhibited notable clinical differences compared to the derivation cohort (n = 4,782, from the Affiliated Banan Hospital). Specifically, patients in the external cohort were older, presented with a higher proportion of emergency admissions, and had higher baseline levels of CRP and D-dimer. These observed differences reflect the inherent dataset shift across different healthcare settings. Regarding comorbidities, the three most prevalent conditions were hypertension (33.81%), pneumonia (18.03%), and DM (15.85%). The prevalence of PLOS was 25.5% (n = 853) in the training set, 26.1% (n = 375) in the internal validation set, and 34.6% (n = 365) in the external validation set. The median length of stay was 7 days (IQR: 4–13) in both the training set and internal validation set and 10 days (IQR: 7–15) in the external validation set. The results of variable imputation for the training and internal validation sets are presented in Tables S3 and S4, respectively. For most variables, no statistically significant differences were observed before and after imputation (P > 0.05), suggesting a satisfactory imputation performance.

Table 1.

Baseline Characteristics of the Training and Internal Validation Sets

Variables Total (n = 4,782) Training Set (n = 3,347) Internal Validation Set (n = 1,435) P value
Age (years) 71 (68, 76) 71 (68, 76) 71 (68, 76) 0.631
Sex 0.282
 Male 3,443 (72) 2,394 (71.53) 1,049 (73.1)
 Female 1,339 (28) 953 (28.47) 386 (26.9)
Marital status 0.868
 Married 4,408 (92.18) 3,084 (92.14) 1,324 (92.26)
 Unmarried 225 (4.71) 156 (4.66) 69 (4.81)
 Divorced/widowed 149 (3.12) 107 (3.2) 42 (2.93)
Admission pathway 0.370
 Emergency 2,297 (48.03) 1,593 (47.59) 704 (49.06)
 Outpatient 2,485 (51.97) 1,754 (52.41) 731 (50.94)
Smoking history 0.205
 No 2,348 (49.1) 1,664 (49.72) 684 (47.67)
 Yes 2,434 (50.9) 1,683 (50.28) 751 (52.33)
Drinking history 0.993
 No 3,801 (79.49) 2,661 (79.5) 1,140 (79.44)
 Yes 981 (20.51) 686 (20.5) 295 (20.56)
Surgical history 0.667
 No 3,762 (78.67) 2,627 (78.49) 1,135 (79.09)
 Yes 1,020 (21.33) 720 (21.51) 300 (20.91)
DM 0.012
 No 4,024 (84.15) 2,846 (85.03) 1,178 (82.09)
 Yes 758 (15.85) 501 (14.97) 257 (17.91)
Hypertension 0.360
 No 3,165 (66.19) 2,201 (65.76) 964 (67.18)
 Yes 1,617 (33.81) 1,146 (34.24) 471 (32.82)
CHD 0.353
 No 4,120 (86.16) 2,873 (85.84) 1,247 (86.9)
 Yes 662 (13.84) 474 (14.16) 188 (13.1)
Chronic gastritis 0.640
 No 4,200 (87.83) 2,945 (87.99) 1,255 (87.46)
 Yes 582 (12.17) 402 (12.01) 180 (12.54)
Hypoproteinemia 0.211
 No 4,210 (88.04) 2,960 (88.44) 1,250 (87.11)
 Yes 572 (11.96) 387 (11.56) 185 (12.89)
Pneumonia 0.332
 No 3,920 (81.97) 2,756 (82.34) 1,164 (81.11)
 Yes 862 (18.03) 591 (17.66) 271 (18.89)
SBP (mmHg) 126 (115, 138) 126 (115, 138) 126 (115, 138) 0.619
DBP (mmHg) 77 (70, 85) 77 (70, 85) 77 (70, 85) 0.522
INR 1.01 (0.95, 1.07) 1.01 (0.95, 1.07) 1.01 (0.95, 1.07) 0.712
D-dimer (mg/L) 0.51 (0.34, 1.03) 0.51 (0.34, 1.03) 0.52 (0.34, 1.03) 0.926
MPV (fL) 9.4 (8.6, 10.4) 9.4 (8.6, 10.3) 9.5 (8.6, 10.5) 0.125
PDW (%) 16 (15.6, 16.4) 16 (15.6, 16.4) 16 (15.6, 16.3) 0.123
WBC count (×109/L) 6.1 (4.7, 8.2) 6.1 (4.7, 8.1) 6.2 (4.7, 8.4) 0.773
CRP (mg/L) 5.25 (2.93, 19.45) 5.11 (2.95, 18.76) 5.76 (2.89, 21.77) 0.179
BUN (mmol/L) 2.46 (2, 3.08) 2.46 (2, 3.11) 2.46 (1.96, 3.08) 0.711
CREA (μmol/L) 66 (55, 79) 66 (55, 79) 66 (54, 79) 0.481
UA (μmol/L) 323 (262, 388) 322 (262, 386) 326 (263, 389) 0.482
TP (g/L) 67 (63.2, 71) 67 (63.2, 71) 67.2 (63.05, 71) 0.642
Na (mmol/L) 139 (137, 141) 139 (137, 141) 139 (137, 141) 0.944
Ca (mmol/L) 2.24 (2.15, 2.32) 2.24 (2.15, 2.32) 2.23 (2.15, 2.32) 0.382
NLR 4.32 (2.74, 7.08) 4.3 (2.74, 6.96) 4.41 (2.75, 7.37) 0.462
PLR 211.89 (145.96, 315.71) 210.68 (144.44, 314.49) 214.29 (149.3, 318.63) 0.391
LMR 2.26 (1.49, 3.36) 2.26 (1.51, 3.35) 2.24 (1.45, 3.38) 0.686
PIV 396.71 (195.58, 894.38) 395.92 (194.07, 876.48) 397.31 (199.4, 930.14) 0.677
PNI 44.61 (40.9, 47.95) 44.63 (41.05, 48.02) 44.58 (40.61, 47.89) 0.302
AGR 1.42 (1.23, 1.61) 1.43 (1.24, 1.61) 1.41 (1.22, 1.61) 0.097
FAR 0.11 (0.08, 0.14) 0.11 (0.08, 0.14) 0.11 (0.09, 0.14) 0.307

Abbreviations: DM, diabetes mellitus; CHD, coronary heart disease; SBP, systolic blood pressure; DBP, diastolic blood pressure; INR, international normalized ratio; MPV, mean platelet volume; PDW, platelet distribution width; WBC, white blood cell; CRP, C-reactive protein; BUN, blood urea nitrogen; CREA, creatinine; UA, uric acid; TP, total protein; Na, sodium; Ca, calcium; NLR, neutrophil-to-lymphocyte ratio; PLR, platelet-to-lymphocyte ratio; LMR, lymphocyte-to-monocyte ratio; PIV, pan-immune-inflammation value; PNI, prognostic nutritional index; AGR, albumin-to-globulin ratio; FAR, fibrinogen-to-albumin ratio.

LASSO-Driven Variable Selection and Multicollinearity Diagnostics

In the training set, all variables except sex (P = 0.750), marital status (P = 0.055), smoking history (P = 0.358), drinking history (P = 0.342), surgical history (P = 0.334), DBP (P = 0.231), PDW (P = 0.195), and BUN (P = 0.783) showed statistically significant differences between the PLOS and non-PLOS groups (P < 0.05, Table 2). These significantly different variables were then subjected to LASSO regression for feature selection. Under ten-fold cross-validation, the optimal penalty coefficient lambda (lambda.1se = 0.01902102) yielded 13 variables with non-zero coefficients: admission pathway, hypertension, CHD, chronic gastritis, hypoproteinemia, pneumonia, SBP, D-dimer, MPV, WBC count, CRP, UA, and TP (Figure 2).

Table 2.

Comparison of Variables Between PLOS and Non-PLOS Groups in the Training Set

Variables Total (n = 3,347) PLOS Group (n = 853) Non-PLOS Group (n = 2,494) P value
Age (years) 71 (68, 76) 72 (68, 77) 71 (68, 76) < 0.001
Sex 0.750
 Male 2,394 (71.53) 606 (71.04) 1,788 (71.69)
 Female 953 (28.47) 247 (28.96) 706 (28.31)
Marital status 0.055
 Married 3,084 (92.14) 770 (90.27) 2,314 (92.78)
 Unmarried 156 (4.66) 51 (5.98) 105 (4.21)
 Divorced/widowed 107 (3.2) 32 (3.75) 75 (3.01)
Admission pathway < 0.001
 Emergency 1,593 (47.59) 354 (41.5) 1,239 (49.68)
 Outpatient 1,754 (52.41) 499 (58.5) 1,255 (50.32)
Smoking history 0.358
 No 1,664 (49.72) 412 (48.3) 1,252 (50.2)
 Yes 1,683 (50.28) 441 (51.7) 1,242 (49.8)
Drinking history 0.342
 No 2,661 (79.5) 668 (78.31) 1,993 (79.91)
 Yes 686 (20.5) 185 (21.69) 501 (20.09)
Surgical history 0.334
 No 2,627 (78.49) 659 (77.26) 1,968 (78.91)
 Yes 720 (21.51) 194 (22.74) 526 (21.09)
DM 0.021
 No 2,846 (85.03) 704 (82.53) 2,142 (85.89)
 Yes 501 (14.97) 149 (17.47) 352 (14.11)
Hypertension < 0.001
 No 2,201 (65.76) 511 (59.91) 1,690 (67.76)
 Yes 1,146 (34.24) 342 (40.09) 804 (32.24)
CHD < 0.001
 No 2,873 (85.84) 657 (77.02) 2,216 (88.85)
 Yes 474 (14.16) 196 (22.98) 278 (11.15)
Chronic gastritis < 0.001
 No 2,945 (87.99) 699 (81.95) 2,246 (90.06)
 Yes 402 (12.01) 154 (18.05) 248 (9.94)
Hypoproteinemia < 0.001
 No 2,960 (88.44) 621 (72.8) 2,339 (93.79)
 Yes 387 (11.56) 232 (27.2) 155 (6.21)
Pneumonia < 0.001
 No 2,756 (82.34) 550 (64.48) 2,206 (88.45)
 Yes 591 (17.66) 303 (35.52) 288 (11.55)
SBP (mmHg) 126 (115, 138) 127 (116, 140) 126 (114, 138) 0.003
DBP (mmHg) 77 (70, 85) 77 (71, 85) 77 (70, 85) 0.231
INR 1.01 (0.95, 1.07) 1.03 (0.96, 1.1) 1 (0.95, 1.06) < 0.001
D-dimer (mg/L) 0.51 (0.34, 1.03) 0.65 (0.39, 1.41) 0.47 (0.33, 0.92) < 0.001
MPV (fL) 9.4 (8.6, 10.3) 9.7 (8.8, 10.6) 9.4 (8.6, 10.3) < 0.001
PDW (%) 16 (15.6, 16.4) 16 (15.5, 16.4) 16 (15.7, 16.4) 0.195
WBC count (×109/L) 6.1 (4.7, 8.1) 6.8 (5.4, 9.3) 6 (4.6, 7.8) < 0.001
CRP (mg/L) 5.11 (2.95, 18.76) 11.35 (3.98, 46.22) 4.45 (2.81, 13.44) < 0.001
BUN (mmol/L) 2.46 (2, 3.11) 2.46 (1.96, 3.13) 2.46 (2, 3.08) 0.783
CREA (μmol/L) 66 (55, 79) 64 (53, 80) 67 (55, 79) 0.022
UA (μmol/L) 322 (262, 386) 298 (231, 369) 330 (272, 392) < 0.001
TP (g/L) 67 (63.2, 71) 66 (61, 70) 67.9 (64, 71.3) < 0.001
Na (mmol/L) 139 (137, 141) 138.1 (135.5, 141) 139.05 (137, 141) < 0.001
Ca (mmol/L) 2.24 (2.15, 2.32) 2.22 (2.12, 2.31) 2.25 (2.17, 2.33) < 0.001
NLR 4.3 (2.74, 6.96) 5.15 (3.25, 9.51) 4.04 (2.62, 6.43) < 0.001
PLR 210.68 (144.44, 314.49) 223.53 (150, 357.3) 207.01 (142.88, 302.85) < 0.001
LMR 2.26 (1.51, 3.35) 2.03 (1.32, 3.17) 2.33 (1.57, 3.38) < 0.001
PIV 395.92 (194.07, 876.48) 514.14 (232.01, 1330.77) 372.2 (187.32, 761.09) < 0.001
PNI 44.63 (41.05, 48.02) 42.76 (38.74, 46.76) 45.16 (41.87, 48.32) < 0.001
AGR 1.43 (1.24, 1.61) 1.4 (1.18, 1.6) 1.44 (1.25, 1.62) < 0.001
FAR 0.11 (0.08, 0.14) 0.12 (0.09, 0.16) 0.1 (0.08, 0.13) < 0.001

Abbreviations: DM, diabetes mellitus; CHD, coronary heart disease; SBP, systolic blood pressure; DBP, diastolic blood pressure; INR, international normalized ratio; MPV, mean platelet volume; PDW, platelet distribution width; WBC, white blood cell; CRP, C-reactive protein; BUN, blood urea nitrogen; CREA, creatinine; UA, uric acid; TP, total protein; Na, sodium; Ca, calcium; NLR, neutrophil-to-lymphocyte ratio; PLR, platelet-to-lymphocyte ratio; LMR, lymphocyte-to-monocyte ratio; PIV, pan-immune-inflammation value; PNI, prognostic nutritional index; AGR, albumin-to-globulin ratio; FAR, fibrinogen-to-albumin ratio.

Figure 2.

Two graphs showing LASSO coefficient paths and cross-validation error versus log lambda. Panel A shows a multi-line graph with ′Log Lambda′ on the horizontal axis from -8 to -2 and ′Coefficients′ on the vertical axis from 0.0 to 2.5. It depicts coefficient shrinkage paths for thirteen predictors. As lambda increases, most coefficients decrease towards zero, with some dropping earlier than others. The numbers above indicate the count of nonzero coefficients, starting at 26 and decreasing to 0. Panel B presents a graph of ′Binomial Deviance′ on the vertical axis from 0.95 to 1.15 against ′Log(lambda)′ on the horizontal axis from -8 to -2. Red points with error bars show deviance remaining stable until Log(lambda) -5, then increasing. Vertical dashed lines mark the lambda minimizing error and one standard error from the minimum. The purpose is to illustrate how increasing regularization affects coefficients and to identify optimal lambda values for model selection.

Variable selection using LASSO regression. (A) Coefficient shrinkage paths of the thirteen selected predictors. Each curve shows how a variable’s coefficient changes as λ increases. (B) Cross‑validation error as a function of log(λ). Vertical dashed lines indicate the λ value that minimizes the error (left) and the λ value at one standard error from the minimum (right, lambda.1se = 0.01902102).

To thoroughly assess potential multicollinearity among the 13 selected variables, correlation analysis and collinearity diagnostics were performed. As shown in Figure 3, the absolute values of all correlation coefficients between continuous variables did not exceed 0.50. The strongest correlation was observed between WBC count and CRP (r = 0.41), followed by D-dimer and CRP (r = 0.26); the remaining pairs exhibited weak or negligible associations. According to Table S5, VIF values for all variables ranged from 1.025 to 1.241, well below the conventional threshold of 5. Collectively, these findings indicate no substantial multicollinearity among the 13 final predictors.

Figure 3.

A correlation heatmap of SBP, D dimer, MPV, WBC count, CRP, UA, TP; strongest value 0.41. Correlation heatmap matrix with 7 variables labeled on the diagonal: SBP, D dimer, MPV, WBC count, CRP, UA, TP. The heatmap uses a diverging gradient where negative correlation coefficients map toward the minus 1 end of the scale and positive correlation coefficients map toward the 1 end of the scale; stronger shading indicates larger absolute correlation magnitude. A vertical legend at right is labeled from minus 1 to 1 with ticks at minus 0.8, minus 0.6, minus 0.4, minus 0.2, 0, 0.2, 0.4, 0.6, 0.8, 1. Circles appear in the upper triangle; some circles contain double asterisk, marking a subset of correlations as significant per the figure note. Key numeric values shown in the lower triangle: D dimer with SBP equals minus 0.08. MPV with SBP equals 0.10; MPV with D dimer equals minus 0.10. WBC count with SBP equals minus 0.01; WBC count with D dimer equals 0.17; WBC count with MPV equals 0.02. CRP with SBP equals minus 0.14; CRP with D dimer equals 0.26; CRP with MPV equals minus 0.03; CRP with WBC count equals 0.41. UA with SBP equals minus 0.02; UA with D dimer equals minus 0.03; UA with MPV equals 0.03; UA with WBC count equals minus 0.01; UA with CRP equals minus 0.10. TP with SBP equals 0.08; TP with D dimer equals minus 0.06; TP with MPV equals minus 0.03; TP with WBC count equals 0.00; TP with CRP equals minus 0.11; TP with UA equals 0.14. Overall pattern visible from the listed coefficients: the largest positive coefficient shown is 0.41 for WBC count with CRP; most other coefficients are between minus 0.14 and 0.26 and several are near 0. No x axis label or unit and no y axis label or unit are shown.

Correlation heatmap of continuous variables selected by LASSO. The circles represent the correlation coefficients (r) between variables, with the specific numerical values displayed. The color gradient from red to blue indicates negative to positive correlations, respectively (as shown by the color bar on the right). Notably, the ** symbol inside the circles indicates a statistically significant correlation (P < 0.01).

Dose-Response Relationships of Continuous Variables

To investigate the dose-response relationships between the seven continuous variables selected by LASSO and the risk of PLOS, RCS regression was performed. As shown in Figure 4, SBP (P for nonlinear = 0.076), MPV (P for nonlinear = 0.831), WBC count (P for nonlinear = 0.467), and TP (P for nonlinear = 0.070) exhibited approximately linear dose-response relationships with PLOS risk, with overall associations being statistically significant (all P for overall < 0.001). In contrast, D-dimer (P for nonlinear < 0.001), CRP (P for nonlinear < 0.001), and UA (P for nonlinear < 0.001) demonstrated significant nonlinear associations with PLOS risk. Specifically, the OR for D-dimer increased steeply at lower concentration ranges before reaching a plateau. CRP showed an approximately log-linear positive association, with a more pronounced risk increase at lower concentrations. UA exhibited a U-shaped pattern, with the risk decreasing initially and then increasing as UA levels rose.

Figure 4.

Seven line graphs showing odds ratio relationships for SBP, D-dimer, MPV, WBC count, CRP, UA and TP. The image A showing a histogram with a line and shaded band. Text: P for overall less than 0.001; P for nonlinear equals 0.076. X-axis label: SBP (millimeter of mercury), range 80 to 180. Left y-axis label: Odds Ratio (OR), range 0 to 4. Right y-axis label: density, range 0.000 to 0.020. The curve rises from about 0.6 at 80 to about 1.0 near 120, stays near 1.0 to about 150, then rises to about 2.5 near 180. The image B showing a histogram with a line and shaded band. Text: P for overall less than 0.001; P for nonlinear less than 0.001. X-axis label: D-dimer (milligram per liter), range 0 to 22. Left y-axis label: Odds Ratio (OR), range 0 to 30. Right y-axis label: density, range 0.0 to 0.6. The curve starts near 1.0 at 0, stays near 1.0 to about 2, then increases to about 8 near 22. The image C showing a histogram with a line and shaded band. Text: P for overall less than 0.001; P for nonlinear equals 0.831. X-axis label: MPV (femtoliter), range 7 to 14. Left y-axis label: Odds Ratio (OR), range 0 to 3. Right y-axis label: density, range 0.0 to 0.3. The curve increases from about 0.7 at 7 to about 1.0 near 9, then rises to about 1.7 near 14. The image D showing a histogram with a line and shaded band. Text: P for overall less than 0.001; P for nonlinear equals 0.467. X-axis label: WBC count (times 10 superscript 9 over liter), range 0 to 24. Left y-axis label: Odds Ratio (OR), range 0 to 12. Right y-axis label: density, range 0.00 to 0.15. The curve is near 1.0 at 0 to 2, then increases steadily to about 8 near 24. The image E showing a histogram with a line and shaded band. Text: P for overall less than 0.001; P for nonlinear less than 0.001. X-axis label: CRP (milligram per liter), range 0 to 160. Left y-axis label: Odds Ratio (OR), range 0 to 10. Right y-axis label: density, range 0.00 to 0.05. The curve rises from about 1.0 at 0 to about 3.0 near 40, then to about 6.0 near 160. The image F showing a histogram with a line and shaded band. Text: P for overall less than 0.001; P for nonlinear less than 0.001. X-axis label: UA (micromole per liter), range 100 to 700. Left y-axis label: Odds Ratio (OR), range 0 to 7.5. Right y-axis label: density, range 0.000 to 0.004. The curve starts near 6.5 at 100, declines to about 1.0 near 350, then rises to about 2.0 near 700. The image G showing a histogram with a line and shaded band. Text: P for overall less than 0.001; P for nonlinear equals 0.070. X-axis label: TP (gram per liter), range 40 to 80. Left y-axis label: Odds Ratio (OR), range 0 to 15. Right y-axis label: density, range 0.00 to 0.06. The curve decreases from about 12 at 40 to about 1.0 near 60, then stays near 1.0 to about 80.

RCS analysis for dose-response relationships. (A) SBP; (B) D-dimer; (C) MPV; (D) WBC count; (E) CRP; (F) UA; (G) TP.

Development and Validation of ML Models

A total of six ML models were constructed and systematically evaluated in the training set, internal validation set, and external validation set. The performance metrics of each model in the training set, including AUC, sensitivity, specificity, Youden index, and F1 score, are summarized in Table 3. Among the six models, XGBoost demonstrated the best overall performance, achieving an AUC of 0.821 (95% CI: 0.806–0.837) in the training set, with corresponding sensitivity, specificity, Youden index, and F1 score of 0.739 (95% CI: 0.709–0.768), 0.781 (95% CI: 0.765–0.796), 0.519 (95% CI: 0.485–0.554), and 0.621 (95% CI: 0.596–0.645), respectively. The DeLong test was employed to compare the AUCs between XGBoost and the other five models across all three datasets. In the training set, XGBoost achieved significantly higher AUCs than LR (P < 0.001), RF (P < 0.001), LightGBM (P < 0.001), and DT (P < 0.001); however, the difference between XGBoost and SVM did not reach statistical significance (P = 0.478). In the internal validation set, XGBoost was significantly superior to DT (P < 0.001) and RF (P < 0.001), but not significantly different from SVM (P = 0.194). Similarly, in the external validation set, XGBoost significantly outperformed DT (P < 0.001), LightGBM (P = 0.017), and SVM (P = 0.013). The performance metrics for the internal and external validation sets are presented in Tables S6 and S7, respectively. The prevalence of PLOS was 25.5% (n = 853) in the training set, 26.1% (n = 375) in the internal validation set, and notably higher at 34.6% (n = 365) in the external validation set, which may partially contribute to the observed decrease in external discriminative performance. XGBoost consistently achieved the highest discrimination among the six models across all datasets, with AUCs of 0.821, 0.773, and 0.727 in the training, internal validation, and external validation sets, respectively. Regarding calibration, the XGBoost model demonstrated excellent agreement between predicted and observed outcomes, with a calibration intercept of −1.057, slope of 1.225, and Brier score of 0.175 in the training set; −1.010, 0.961, and 0.191 in the internal validation set; and −0.916, 1.010, and 0.230 in the external validation set, respectively. The detailed calibration metrics for all models are provided in Table S8.

Table 3.

Performance Metrics of Six ML Models in the Training Set

Model AUC (95% CI) Sensitivity (95% CI) Specificity (95% CI) Youden Index (95% CI) F1 Score (95% CI)
XGBoost 0.821 (0.806–0.837) 0.739 (0.709–0.768) 0.781 (0.765–0.796) 0.519 (0.485–0.554) 0.621 (0.596–0.645)
LightGBM 0.805 (0.790–0.822) 0.679 (0.648–0.711) 0.789 (0.774–0.805) 0.468 (0.433–0.504) 0.591 (0.565–0.618)
RF 0.775 (0.758–0.792) 0.655 (0.626–0.689) 0.778 (0.762–0.794) 0.433 (0.398–0.472) 0.569 (0.543–0.596)
LR 0.789 (0.772–0.806) 0.658 (0.626–0.691) 0.782 (0.768–0.799) 0.440 (0.406–0.477) 0.573 (0.547–0.600)
DT 0.771 (0.753–0.790) 0.750 (0.722–0.779) 0.704 (0.687–0.723) 0.454 (0.420–0.489) 0.574 (0.549–0.598)
SVM 0.820 (0.803–0.836) 0.747 (0.717–0.778) 0.736 (0.720–0.753) 0.483 (0.450–0.516) 0.593 (0.569–0.617)

Abbreviations: AUC, area under the ROC curve; CI, confidence interval; XGBoost, extreme Gradient Boosting; LightGBM, light gradient boosting machine; RF, random forest; LR, logistic regression; DT, decision tree; SVM, support vector machine.

All six models were further evaluated through visualization. Figures 5A–C present the ROC curves of the six models for the training, internal validation, and external validation sets, respectively. Figures 6A–C show the corresponding calibration curves, where XGBoost consistently exhibited the closest alignment with the ideal diagonal, indicating better calibration than the other models. Figures 7A–C display the DCA, in which XGBoost demonstrated the highest net benefit across a wide range of threshold probabilities in all three datasets, suggesting superior clinical utility.

Figure 5.

A set of three receiver operating characteristic line graphs comparing six machine learning models. Three ROC graphs (A, B, C) display model performance with axes: False Positive Rate (0.0-1.0) and True Positive Rate (0.0-1.0). Each graph includes a diagonal reference line from (0.0, 0.0) to (1.0, 1.0) and curves rising towards (1.0, 1.0). Image A: XGBoost (AUC 0.8227), LightGBM (AUC 0.8537), Random Forest (AUC 0.8055), Logistic Regression (AUC 0.7799), Decision Tree (AUC 0.7709), SVM (AUC 0.8196). Image B: XGBoost (AUC 0.7733), LightGBM (AUC 0.7561), Random Forest (AUC 0.7662), Logistic Regression (AUC 0.7612), Decision Tree (AUC 0.7069), SVM (AUC 0.7649). Image C: XGBoost (AUC 0.7935), LightGBM (AUC 0.7708), Random Forest (AUC 0.7739), Logistic Regression (AUC 0.7639), Decision Tree (AUC 0.6730), SVM (AUC 0.7087).

ROC curves of six ML models in the training and validation sets. (A) Training set; (B) Internal validation set; (C) External validation set.

Figure 6.

Multi-line graphs showing calibration curves for six machine learning models across three datasets. The images A, B and C depict multi-line graphs of calibration curves. Each graph has an X-axis labeled ′Mean Predicted Probability (Platt Scaled)′ and a Y-axis labeled ′Fraction of Positives (Actual)′, both ranging from 0.0 to 1.0. A dotted diagonal line represents perfect calibration from (0.0, 0.0) to (1.0, 1.0). The legend includes models: Perfectly calibrated, XGBoost, LightGBM, Logistic Regression, Random Forest, Decision Tree and SVM. In Image A, model curves closely follow the diagonal with minor deviations, one showing a dip in the upper midrange. Image B′s curves mostly align with the diagonal, except one that sharply drops near high predicted probabilities. In Image C, curves generally rise with predicted probability; one exceeds the diagonal in the mid-high range, while another sharply descends near x=0.8. Different line styles and markers distinguish models, but numeric coordinates are unreadable.

Calibration curves of six ML models in the training and validation sets. (A) Training set; (B) Internal validation set; (C) External validation set.

Figure 7.

A line graph set showing decision curve analysis net benefit versus threshold probability for six models. The image A showing a line graph with x-axis label Threshold Probability and range 0.0 to 0.6 and y-axis label Net Benefit and range 0.00 to 0.30. Legend: Treat None Net Benefit equals 0, Treat All, XGBoost, LightGBM, Random Forest, Logistic Regression, Decision Tree, SVM. Treat None: (0.0, 0.00), (0.6, 0.00). Treat All is a descending line starting near (0.0, 0.25) and crossing Net Benefit 0 near Threshold Probability about 0.27. Model curves descend from about Net Benefit 0.24 to 0.25 near Threshold Probability 0.0 to about 0.01 to 0.03 near 0.6. The image B showing a line graph with x-axis label Threshold Probability and range 0.0 to 0.6 and y-axis label Net Benefit and range 0.00 to 0.30. Same legend entries. Treat None: (0.0, 0.00), (0.6, 0.00). Treat All starts near (0.0, 0.26) and reaches Net Benefit 0 near Threshold Probability about 0.28. Model curves descend from about 0.25 to 0.26 at Threshold Probability 0.0 to about negative 0.01 to 0.02 near 0.6. The image C showing a line graph with x-axis label Threshold Probability and range 0.0 to 0.6 and y-axis label Net Benefit and range 0.00 to 0.35. Same legend entries. Treat None: (0.0, 0.00), (0.6, 0.00). Treat All starts near (0.0, 0.34) and reaches Net Benefit 0 near Threshold Probability about 0.33. Model curves descend from about 0.33 to 0.34 at Threshold Probability 0.0 to about 0.00 to 0.08 near 0.6, with one curve showing a small rise around Threshold Probability about 0.45 to 0.50 near Net Benefit about 0.10 to 0.12.

DCA of six ML models in the training and validation sets. (A) Training set; (B) Internal validation set; (C) External validation set.

SHAP-Based Visualization of the Optimal ML Model

In the optimal XGBoost model, we evaluated the key factors influencing the predicted probability of PLOS using both feature importance (Figure 8A) and SHAP summary plots (Figure 8B). Figure 8A identifies the top five predictors: pneumonia, hypoproteinemia, CRP, UA, and admission pathway. To further clarify the direction of their effects, Figure 8B presents the SHAP values, where each dot corresponds to an individual patient, and colors ranging from red to blue represent high to low feature values. The SHAP value on the horizontal axis is positively associated with the model’s predicted probability of PLOS. Notably, features such as pneumonia, hypoproteinemia, CRP, admission pathway, and SBP were positively associated with higher predicted risk of PLOS, whereas UA and TP were negatively associated with predicted risk. It is important to note that these SHAP contributions reflect the importance of these variables within the XGBoost model’s predictive framework and represent predictive associations derived from the model’s internal decision-making process. They do not imply independent or causal associations with PLOS.

Figure 8.

Two plots showing SHAP feature importance bars and a SHAP summary dot plot for an XGBoost model. The image A showing a horizontal bar chart of feature importance. The x axis label, mean open parenthesis SHAP value close parenthesis open parenthesis Average impact on model output magnitude close parenthesis, ranges from 0.00 to 0.35. The y axis lists Pneumonia, Hypoproteinemia, CRP, UA, Admission pathway, TP, SBP, D dimer, MPV, CHD, Chronic gastritis, WBC count, Hypertension. Bar endpoints are approximately: Pneumonia 0.37, Hypoproteinemia 0.32, CRP 0.27, UA 0.23, Admission pathway 0.17, TP 0.16, SBP 0.16, D dimer 0.13, MPV 0.13, CHD 0.13, Chronic gastritis 0.08, WBC count 0.07, Hypertension 0.06. The image B showing a SHAP summary dot plot. The x axis label, SHAP value open parenthesis Impact on model output close parenthesis, ranges from negative 0.75 to 1.25. The y axis lists the same features as image A. A vertical reference line is at 0. Dots for Pneumonia extend from about negative 0.2 to about 0.9. Hypoproteinemia extends from about negative 0.1 to about 1.1. CRP extends from about negative 0.3 to about 0.7. UA extends from about negative 0.2 to about 0.6. Admission pathway extends from about negative 0.2 to about 0.3. TP extends from about negative 0.6 to about 0.3. SBP extends from about negative 0.6 to about 0.4. D dimer extends from about negative 0.3 to about 0.4. MPV extends from about negative 0.2 to about 0.4. CHD extends from about negative 0.1 to about 0.5. Chronic gastritis extends from about negative 0.1 to about 0.4. WBC count extends from about negative 0.2 to about 0.2. Hypertension extends from about negative 0.1 to about 0.1. A right-side vertical scale is labeled Feature value with High at the top and Low at the bottom.

SHAP-based interpretation of the XGBoost model. (A) Feature importance bar chart; (B) Summary dot plot of SHAP values. Red and blue colors indicate high and low feature values, respectively. SHAP values to the left of the vertical axis reduce the predicted risk of PLOS, whereas values to the right increase it.

Discussion

In this multicenter retrospective study of 5,836 older Chinese patients with primary lung cancer, we developed and externally validated six ML models to predict PLOS. Among these, the XGBoost model demonstrated the highest discriminative performance across all three datasets, achieving AUCs of 0.821, 0.773, and 0.727 in the training, internal, and external validation sets, respectively. The moderate external discrimination (AUC = 0.727) and the observed performance decay from the training set reflect the inherent challenges in generalizing prediction models across different healthcare settings and patient populations. Therefore, while the model offers clinically acceptable risk stratification, its transportability requires further prospective refinement and validation in broader cohorts. Our findings align with several recent investigations demonstrating the utility of ML methods for PLOS prediction in lung cancer populations. A study of 6,767 lung cancer patients undergoing video-assisted thoracoscopic surgery reported that RF achieved an AUC of 0.792 for predicting postoperative PLOS, with surgical duration and age emerging as the most critical features.25 Similarly, an explainable ML framework using the MIMIC-III dataset reported that RF achieved an AUC of 0.98 for lung cancer length of stay prediction after addressing class imbalance.26 More recently, a study of 105 lung cancer patients undergoing pulmonary resection identified total lung capacity, maximal inspiratory pressure, and peak expiratory flow as independent predictors of PLOS, together accounting for 47% of the variance in PLOS.27 Notably, the present study provides external validation—a critical but often omitted step in predictive modeling research—thereby strengthening the evidence for model generalizability beyond the derivation institution.

Beyond model development and comparison, our study leveraged RCS regression to explore dose-response relationships between seven continuous predictors and PLOS risk, revealing nuanced non-linear patterns that would have been obscured by conventional linear modeling. RCS analysis demonstrated that D-dimer, CRP, and UA exhibited significant non-linear associations with PLOS (all P for nonlinearity < 0.001). Specifically, CRP showed an approximately log-linear positive association, with a more pronounced risk increase at lower concentration ranges—a pattern consistent with findings from a study of gastrointestinal cancer patients, where CRP levels at ICU admission demonstrated a non-linear relationship with prolonged ICU stay, with an inflection point at 2.6 (log-transformed mg/L).28 Additionally, a study in internal medicine wards found that each 80 mg/L increment in admission CRP was associated with a 2.09-fold increased risk of PLOS.29 The U-shaped relationship observed for UA in our study—where PLOS risk decreased initially and then increased with rising UA levels—suggests a more complex biological interplay that warrants further investigation. This biphasic pattern is consistent with emerging evidence from cardiovascular research. A large cohort study of 33,096 patients examining long-term stable serum UA levels reported a U-shaped association between UA and all-cause mortality in both sexes, with both low and high UA levels conferring elevated risk.30 Converging evidence from a study of 1,109 geriatric patients with respiratory failure further showed that elevated serum UA levels correlated with PLOS and increased ventilation requirements.31 These findings underscore the methodological advantage of RCS over traditional approaches that assume linearity, as falsely imposing linear constraints may lead to underestimation of risk at extreme biomarker values or failure to identify protective ranges.

Among the 13 predictors selected by LASSO regression, pneumonia emerged as the most important feature in the XGBoost model, followed by hypoproteinemia and CRP. The predominance of pneumonia as a predictor is clinically plausible, as respiratory infections in older patients with lung cancer often trigger a cascade of adverse events including respiratory failure, sepsis, and functional decline, each contributing independently to PLOS.32 This finding is further supported by recent thoracic surgical evidence demonstrating that a higher comorbidity burden significantly predicts postoperative pulmonary complications in patients undergoing lung cancer surgery, thereby prolonging recovery and hospitalization.33 However, it must be emphasized that these SHAP-based findings represent predictive associations within our model and should be interpreted cautiously, rather than establishing independent risk factors or causal relationships. The clinical utility of these markers lies in their ability to flag high-risk patients for early intervention, but they should not be interpreted as definitive etiological pathways without further confirmatory studies. Hypoproteinemia, reflecting poor nutritional status, has been consistently associated with delayed recovery and increased complication risk in geriatric oncology populations.34 A narrative review on nutritional support in lung cancer surgery concluded that hypoalbuminemia and reduced body mass index are strongly associated with increased postoperative complications and PLOS, emphasizing the prognostic importance of preoperative nutritional assessment.35 The elevated CRP levels observed in high-risk patients in our cohort corroborate evidence from patients with resected NSCLC, where postoperative CRP levels at week 6 were independently associated with worse overall survival and recurrence-free survival (HR 2.23, 95% CI not reported, P < 0.001), reinforcing CRP’s role as a prognostic biomarker reflecting systemic inflammation in lung cancer.36 Collectively, these findings suggest that the triad of active infection (pneumonia), nutritional depletion (hypoproteinemia), and systemic inflammation (CRP) forms a synergistic risk constellation for PLOS in older lung cancer patients.

Beyond identifying risk factors, the ultimate value of a prediction model lies in its ability to inform actionable clinical decisions. Our XGBoost-based model, coupled with SHAP visualization, offers individualized risk estimates that may potentially guide future targeted interventions for older lung cancer patients at high risk of PLOS. For instance, patients flagged with high predicted probability—particularly those exhibiting the triad of pneumonia, hypoproteinemia, and elevated CRP—might be prioritized for enhanced nutritional support, early infectious workup, or closer respiratory monitoring in future clinical practice. Conversely, in patients with favorable feature profiles (eg, low CRP, normal UA, elective admission), a streamlined care pathway with reduced observation intensity might be safely considered, thereby optimizing resource allocation in bed-constrained settings. However, it is important to emphasize that these proposed interventions (including nutritional support, infection management, respiratory monitoring, and discharge planning) have not been tested in this retrospective study, and should be considered as potential future applications. This risk-stratified approach aligns with the principles of precision medicine in geriatric oncology, where one-size-fits-all protocols are increasingly replaced by individualized care plans.37 Nevertheless, future prospective clinical-impact studies are necessary to determine whether model-guided care actually reduces PLOS incidence or improves patient outcomes.

Nevertheless, several barriers must be addressed before clinical deployment. First, seamless integration with electronic health record systems is technically challenging but essential for real-time risk calculation without disrupting clinical workflows.38 Second, clinician acceptance and training are critical, as SHAP outputs—while interpretable—require basic data literacy to be correctly acted upon. Third, prospective implementation studies are needed to determine whether model-assisted risk stratification actually reduces PLOS incidence or merely identifies high-risk patients without improving outcomes. A recent cluster randomized trial of a ML-based early warning system for sepsis demonstrated that providing risk scores alone did not improve outcomes without accompanying decision support and protocolized responses.39 Thus, our model should be embedded within a broader intervention bundle—including pre-admission optimization for elective cases, early geriatric consultation for high-risk admissions, and structured discharge planning—rather than deployed as a standalone prediction tool.

Several limitations warrant consideration. First, the retrospective design inherently carries the risk of selection bias and unmeasured confounding, despite our efforts to include a comprehensive set of clinical variables. Second, all data were derived from two Chinese hospitals; although external validation was performed, broader generalization to other healthcare systems or ethnic populations requires further prospective, multicenter validation. Third, PLOS was defined based on the 75th percentile of the cohort (13 days), which may limit comparability with studies adopting different cutoffs, and the lack of a universally accepted definition remains a challenge in this field. Fourth, dynamic in-hospital parameters, such as daily changes in inflammatory markers or treatment-related events, were not incorporated into the current models, potentially omitting time-varying influences that could further refine real-time risk prediction. Fifth, we acknowledge that crucial oncological determinants of length of stay, including cancer stage, histological subtype, treatment modality (eg, surgery, chemotherapy, or radiotherapy), performance status, and specific admission indications, were not available in our retrospectively extracted database. Although our cohort included a mixed population of surgical and non-surgical patients, we were unable to adjust for these treatment-related factors. The absence of these clinically significant variables may limit the interpretability of our model regarding why certain patients are at risk, and its transportability to centers with different treatment protocols. Future prospective studies should integrate these essential oncological parameters to enhance the model’s clinical utility and generalizability.

Conclusions

In conclusion, older patients with lung cancer face a substantially elevated risk of PLOS, which in turn predisposes them to a cascade of adverse outcomes and strains healthcare resources. The XGBoost model developed in this study offers a promising and externally validated tool with moderate discrimination for early identification of high-risk individuals in the Chinese geriatric population. By translating electronic health record data into an actionable risk estimate with transparent feature contributions, this approach may hold potential for future integration into clinical decision support systems to guide targeted perioperative and supportive care strategies. However, the clinical utility and impact of this model on patient outcomes remain to be established through prospective implementation and impact assessment studies. Future efforts should focus on validating the model in broader, more diverse cohorts and evaluating whether model-assisted risk stratification genuinely improves patient-centered and economic outcomes in real-world geriatric oncology settings.

Acknowledgments

We extend our heartfelt gratitude to all the participants and investigators involved in this project for their invaluable contributions to data collection.

Funding Statement

This study was funded by Linfen Central Hospital (LFSZXYY-KJK-YJ-2026006).

Data Sharing Statement

The datasets used and/or analyzed in the current study are available from the corresponding authors upon reasonable request.

Ethics Approval and Consent to Participate

This study was approved by the ethics committees of both the Affiliated Banan Hospital of Chongqing Medical University (approval no. BNLL-KY-2026-027) and Linfen Central Hospital (approval no. LY2026-35-01). Because the study employed a retrospective design, informed consent in written form was not deemed necessary, and this requirement was formally waived by the ethics committee. The entire study was conducted in strict observance of the ethical standards set forth in the Declaration of Helsinki (1964) as well as its subsequent amendments. Furthermore, all methodologies and procedures strictly conformed to pertinent ethical guidelines and statutory regulations.

Author Contributions

All authors made a significant contribution to the work reported, whether that is in the conception, study design, execution, acquisition of data, analysis and interpretation, or in all these areas; took part in drafting, revising or critically reviewing the article; gave final approval of the version to be published; have agreed on the journal to which the article has been submitted; and agree to be accountable for all aspects of the work.

Disclosure

All authors declare no conflictS of interest.

References

  • 1.Cao W, You Z, Wang Z, et al. Risk factors behind the global lung cancer burden: a pan-database exploration. Transl Lung Cancer Res. 2025;14(7):2452–17. doi: 10.21037/tlcr-2025-131 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 2.Siegel RL, Miller KD, Wagle NS, Jemal A. Cancer statistics, 2023. CA Cancer J Clin. 2023;73(1):17–48. doi: 10.3322/caac.21763 [DOI] [PubMed] [Google Scholar]
  • 3.Siddique SM, Tipton K, Leas B, et al. Interventions to reduce hospital length of stay in high-risk populations: a systematic review. JAMA Network Open. 2021;4(9):e2125846. doi: 10.1001/jamanetworkopen.2021.25846 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Huang L, Shi Y, Wang L, et al. Characteristics and in-hospital outcomes of elderly patients with cancer in a top-ranked hospital in China, 2016-2020. Cancer Med. 2022;12(3):2885–2905. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Deng W, Zhang LY, Yue JR, Huang XL. The future of multimorbidity management in the older adults: transforming AI-enabled precision medicine. Front Public Health. 2026;13:1691682. doi: 10.3389/fpubh.2025.1691682 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 6.Le V-H, Kha Q-H, Hung TNK, Le NQ. Risk score generated from CT-Based radiomics signatures for overall survival prediction in non-small cell lung cancer. Cancers. 2021;13(14):3616. doi: 10.3390/cancers13143616 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7.Naito T, Okayama T, Aoyama T, et al. Unfavorable impact of cancer cachexia on activity of daily living and need for inpatient care in elderly patients with advanced non-small-cell lung cancer in Japan: a prospective longitudinal observational study. BMC Cancer. 2017;17(1):800. doi: 10.1186/s12885-017-3795-2 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Gracner T, Agarwal M, Murali KP, et al. Association of infection-related hospitalization with cognitive impairment among nursing home residents. JAMA Network Open. 2021;4(4):e217528. doi: 10.1001/jamanetworkopen.2021.7528 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Kong W, Wang H, Chen Y, et al. Association between length of stay and postoperative survival in patients with lung cancer: a propensity score matching analysis based on National Cancer Database. J Thorac Dis. 2023;15(4):1785–1793. doi: 10.21037/jtd-23-407 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10.Schattner A. The spectrum of hospitalization-associated harm in the elderly. Eur J Intern Med. 2023;115:29–33. doi: 10.1016/j.ejim.2023.05.025 [DOI] [PubMed] [Google Scholar]
  • 11.Bray F, Laversanne M, Sung H, et al. Global cancer statistics 2022: GLOBOCAN estimates of incidence and mortality worldwide for 36 cancers in 185 countries. CA Cancer J Clin. 2024;74(3):229–263. doi: 10.3322/caac.21834 [DOI] [PubMed] [Google Scholar]
  • 12.Le VH, Minh TNT, Kha QH, Le NQ. Deep learning radiomics for survival prediction in non-small-cell lung cancer patients from ct images. J Med Syst. 2025;49(1):22. doi: 10.1007/s10916-025-02156-5 [DOI] [PubMed] [Google Scholar]
  • 13.Askar M, Tafavvoghi M, Småbrekke L, Bongo LA, Svendsen K. Using machine learning methods to predict all-cause somatic hospitalizations in adults: a systematic review. PLoS One. 2024;19(8):e0309175. doi: 10.1371/journal.pone.0309175 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14.Tou S, Matsumoto K, Hashinokuchi A, et al. Identifying key variances in clinical pathways associated with prolonged hospital stays using machine learning and ePath real-world data: model development and validation study. JMIR Med Inform. 2025;13:e71617. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Işık GÖ, Özçıbık OS, Yıldırım T, et al. Can artificial intelligence models predict hospital stays following non-small cell lung carcinoma surgery? Kardiochir Torakochirurgia Pol. 2025;22(3):163–168. doi: 10.5114/kitp.2025.155014 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 16.Hsu JC, Nguyen P-A, Phuc PT, et al. Development and validation of novel deep-learning models using multiple data types for lung cancer survival. Cancers. 2022;14(22):5562. doi: 10.3390/cancers14225562 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 17.Earnest A, Tesema GA, Stirling RG. Machine learning techniques to predict timeliness of care among lung cancer patients. Healthcare. 2023;11(20):2756. doi: 10.3390/healthcare11202756 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Gao B, Dai J, Yu X, et al. The prediction of extended hospital length of stay in patients after endoscopic endonasal transsphenoidal surgery for the resection of non-functioning pituitary adenomas: a dual-center retrospective analysis. Cancers. 2026;18(10):1582. doi: 10.3390/cancers18101582 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 19.Wang Q, Wang S, Wang P, Lu S. Machine learning approaches for predicting prolonged hospital length of stay after lumbar fusion surgery in patients aged 75 years and older: a retrospective cohort study based on comprehensive geriatric assessment. Neurosurg Focus. 2025;59(1):E16. doi: 10.3171/2025.4.FOCUS24614 [DOI] [PubMed] [Google Scholar]
  • 20.Zheng Z, Peng G, Xiao Y. Severe malnutrition identified by the Controlling Nutritional Status (CONUT) score is associated with prolonged Intensive Care Unit (ICU) stay in pneumonia complicated with respiratory failure patients who underwent invasive mechanical ventilation. J Clin Lab Anal. 2025;39(21):e70109. doi: 10.1002/jcla.70109 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Tan J, Zhang Z, He Y, et al. A novel model for predicting prolonged stay of patients with type-2 diabetes mellitus: a 13-year (2010-2022) multicenter retrospective case-control study. J Transl Med. 2023;21(1):91. doi: 10.1186/s12967-023-03959-1 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22.Pi L, Halabi S. Combined performance of screening and variable selection methods in ultra-high dimensional data in predicting time-to-event outcomes. Diagn Progn Res. 2018;2:21. doi: 10.1186/s41512-018-0043-4 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 23.Discacciati A, Palazzolo MG, Park JG, Melloni GEM, Murphy SA, Bellavia A. Estimating and presenting non-linear associations with restricted cubic splines. Int J Epidemiol. 2025;54(4):dyaf088. doi: 10.1093/ije/dyaf088 [DOI] [PubMed] [Google Scholar]
  • 24.Ain SQU, Rather KUI. Integrated statistical modeling and machine learning techniques with SHAP for epidemiological data analysis. Ann Epidemiol. 2025;108:85–91. doi: 10.1016/j.annepidem.2025.06.012 [DOI] [PubMed] [Google Scholar]
  • 25.Zhang G, Liu X, Hu Y, et al. Development and comparison of machine-learning models for predicting prolonged postoperative length of stay in lung cancer patients following video-assisted thoracoscopic surgery. Asia Pac J Oncol Nurs. 2024;11(6):100493. doi: 10.1016/j.apjon.2024.100493 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 26.Alsinglawi B, Alshari O, Alorjani M, et al. An explainable machine learning framework for lung cancer hospital length of stay prediction. Sci Rep. 2022;12(1):607. doi: 10.1038/s41598-021-04608-7 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27.Kendall F, Silva G, Drummond M, et al. Predictors of prolonged hospital stay in patients undergoing lung resection. Disabil Rehabil. 2024;46(22):5220–5226. doi: 10.1080/09638288.2023.2297936 [DOI] [PubMed] [Google Scholar]
  • 28.Yan Y-M, Gao J, Jin P-L, Lu -J-J, Yu Z-H, Hu Y. C-reactive protein as a non-linear predictor of prolonged length of intensive care unit stay after gastrointestinal cancer surgery. World J Clin Cases. 2022;10(31):11381–11390. doi: 10.12998/wjcc.v10.i31.11381 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 29.Goltzman G, Perl S, Cohen L, Avivi E, Rapoport MJ. Single admission C-reactive protein levels as a sole predictor of patient flow and clinical course in a general internal medicine department. Isr Med Assoc J. 2019;21(10):686–691. [PubMed] [Google Scholar]
  • 30.Chien H-T, Lin Y-W, Shen L-J, et al. Sex-specific associations between prolonged serum uric acid levels and risk of major adverse cardiovascular events. Int J Cardiol Cardiovasc Risk Prev. 2024;22:200302. doi: 10.1016/j.ijcrp.2024.200302 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 31.Yıldız M, Çelik D, Özdemir T, et al. The importance of uric acid levels in geriatric patients with respiratory failure under noninvasive mechanical ventilation in the respiratory intensive care unit. BMC Pulm Med. 2025;25(1):143. doi: 10.1186/s12890-025-03603-2 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32.Uematsu H, Yamashita K, Kunisawa S, Imanaka Y. Prediction model for prolonged length of stay in patients with community-acquired pneumonia based on Japanese administrative data. Respir Investig. 2020;59(2):194–203. doi: 10.1016/j.resinv.2020.08.005 [DOI] [PubMed] [Google Scholar]
  • 33.Caushi F, Tashi E, Dhimitri A, et al. Comorbidities as predictors of postoperative pulmonary complications after lung cancer surgery. J Cardiothorac Surg. 2026;21(1):384. doi: 10.1186/s13019-026-04229-z [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 34.Werblińska A, Zielińska D, Szlanga L, et al. The impact of nutritional support on outcomes of lung cancer surgery—narrative review. J Clin Med. 2025;14(9):3197. doi: 10.3390/jcm14093197 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 35.Ellenberger C, Schorer R, Bedat B, et al. How can we minimize the risks by optimizing patient’s condition shortly before thoracic surgery? Saudi J Anaesth. 2021;15(3):264–271. doi: 10.4103/sja.sja_1098_20 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Shinohara S, Otsuki R, Onitsuka T, et al. Postoperative C-reactive protein is a predictive biomarker for survival after non-small cell lung cancer resection. Anticancer Res. 2019;39(4):2193–2198. doi: 10.21873/anticanres.13334 [DOI] [PubMed] [Google Scholar]
  • 37.Li CJ, Gong SM, Shi YJ, et al. Application of comprehensive geriatric assessment in oncology nursing: a literature review on optimizing treatment decisions and patient outcomes. World J Clin Oncol. 2025;16(4):104785. doi: 10.5306/wjco.v16.i4.104785 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 38.Kuo Z-M, Chen K-F, Tseng Y-J. MoCab: a framework for the deployment of machine learning models across health information systems. Comput Methods Programs Biomed. 2024;255:108336. doi: 10.1016/j.cmpb.2024.108336 [DOI] [PubMed] [Google Scholar]
  • 39.Kijpaisalratana N, Saoraya J, Nhuboonkaew P, Vongkulbhisan K, Musikatavorn K. Real-time machine learning-assisted sepsis alert enhances the timeliness of antibiotic administration and diagnostic accuracy in emergency department patients with sepsis: a cluster-randomized trial. Intern Emerg Med. 2024;19(5):1415–1424. doi: 10.1007/s11739-024-03535-5 [DOI] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

The datasets used and/or analyzed in the current study are available from the corresponding authors upon reasonable request.


Articles from Cancer Management and Research are provided here courtesy of Dove Press

RESOURCES