$$\rightleftharpoonup{xx}$$
$$\longleftharp{xx}$$,
$$\longrightharp{xx}$$,
Patient characteristics
A total of 161 patients were included in this study. Execution of the GBTM protocol (step 2) successfully identified three distinct lymphocyte trajectories, as visualized in Figure 1. This outcome confirms successful model convergence and valid subgroup separation, which is a key checkpoint for proceeding to prognostic modeling. This decision was based on a balance of statistical fit (Supplementary Table 1) and clinical interpretability: while models with four or five classes showed marginally better AIC/BIC values, the three-class model provided clearly distinct, clinically actionable trajectories—representing persistent immunosuppression, moderate recovery, and rapid immune reconstitution—with sufficient group size and stability for robust prognostic analysis. Trajectory 1, the continuous-rising class, included 62 patients (38.5%) and was characterized by a steady, almost linear increase in lymphocyte counts from day 1 through day 7. But the starting point was very low. Trajectory 2, the U-shaped class, included 36 patients (22.3%) and exhibited an early decline in lymphocyte counts over the 1st 3 days, followed by gradual recovery thereafter. Trajectory 3, the early-dip then rapid-rise class, included 63 patients (39.1%) who showed a modest decrease in lymphocyte counts during days 1–3 and a pronounced upward trend from day 4 onward. At the same time, the starting point is close to the normal value. Baseline characteristics varied significantly across these trajectories, validating their clinical relevance (Table 1). Patients in trajectory 1 were older and demonstrated greater illness severity (higher APS III and SOFA scores), the lowest baseline lymphocyte counts, and the highest 28-day mortality rate (24.2%). As shown in Table 2, several baseline characteristics differed significantly between survivors and non-survivors. Non-survivors were older and more frequently belonged to the high–mortality lymphocyte trajectory. They also experienced longer ICU stays, a higher prevalence of hypertension, and more severe illness on admission (higher APS III scores and greater comorbidity burden). Finally, non-survivors presented with elevated heart rates and increased blood urea nitrogen.
Multivariate logistic regression
The logistic regression protocol (step 4) was executed to identify independent predictors of 28-day mortality in patients with ARDS complicated by pneumonia. In the unadjusted mode (Model 1), and using Trajectory 1 as the reference, neither Trajectory 2 (OR 0.51; 95% CI 0.15–1.45; p = 0.228) nor Trajectory 3 (OR 0.10; 95% CI 0.02–0.39; p = 0.003) proved significant except for the latter, which was associated with a marked reduction in odds of 28-day mortality. After adjusting for confounders (Model 3), Trajectory 3 remained an independent predictor of lower mortality (OR 0.06; 95% CI 0.01–0.36; p = 0.006; Table 3). Hospital length of stay retained a protective effect (OR 0.59 per day; 95% CI 0.40–0.78; p = 0.002), whereas each ICU day further increased mortality risk (OR 1.75; 95% CI 1.32–2.57; p < 0.001). Higher APS III scores (OR 1.04 per point; 95% CI 1.00–1.08; p = 0.047) and elevated admission heart rate (OR 1.05 per bpm; 95% CI 1.01–1.10; p = 0.019) were also significant, while sex, Charlson index and BUN did not reach significance. These results confirm the protocol's ability to derive a strong and adjusted association between immune trajectories and outcomes. Forest plots were used for visualization simultaneously (Figure 2). Model performance metrics (step 4) demonstrated the robustness of our approach. The model showed excellent discriminative ability (AUC = 0.932; Figure 3). This high value, significantly above the 0.5 benchmark of random chance, indicates that the model derived from the protocol effectively distinguishes between survivors and non-survivors. The calibration curve (Figure 4) indicated good agreement between predicted and observed probabilities, with minimal miscalibration at the extremes, supporting the model's reliability. Decision curve analysis (Figure 5) showed a consistent net benefit across threshold probabilities of 5%–45%, with peak benefit near 10%, indicating the model's potential for clinical decision-making.
Multivariate Cox regression
The Cox regression protocol (step 4) yielded results consistent with the logistic model. Compared with Trajectory 1, patients in Trajectory 2 showed a non-significant trend toward lower 28-day mortality (HR 0.54; 95% CI 0.20–1.48; p = 0.232), whereas those in Trajectory 3 had a markedly reduced hazard of death (HR 0.12; 95% CI 0.03–0.52; p = 0.005; Model 1). After adjusting for confounders (Model 3), Trajectory 3 remained independently associated with lower mortality (HR 0.13; 95% CI 0.03–0.64; p = 0.012; Table 4). Hospital days was protective (HR 0.68 per day; 95% CI 0.54–0.87; p = 0.002), whereas each additional ICU day increased hazard by 51% (HR 1.51; 95% CI 1.19–1.91; p < 0.001). Higher APS III scores (HR 1.02; 95% CI 1.00–1.05; p = 0.026) and elevated admission heart rate (HR 1.03; 95% CI 1.00–1.07; p = 0.041) were also modest but significant predictors of mortality, while Charlson index and BUN did not reach statistical significance. The stability of this association across both regression frameworks underscores the robustness of the lymphocyte trajectory as a prognostic marker. The proportional hazards assumption was verified using Schoenfeld residuals, with no significant violations detected. Forest plots were used for visualization simultaneously (Figure 6).

Figure 1: Lymphocyte trajectories identified by 3-class GBTM. Generated using the R gbmt package. Successful replication should show three distinct trajectories representing persistent immunosuppression, moderate recovery, and rapid immune reconstitution. Please click here to view a larger version of this figure.

Figure 2: Forest plot for multivariable logistic regression. Created with R ggplot2. Statistically significant predictors should show confidence intervals not crossing OR = 1. Please click here to view a larger version of this figure.

Figure 3: ROC curve for logistic model discrimination. Generated using the R pROC package. AUC = 0.932 indicates excellent performance; the replicated curve should rise sharply to the top-left. Please click here to view a larger version of this figure.

Figure 4: Calibration curve (bootstrap 200). Created with the R rms package. Good calibration is confirmed by a close fit of the bias-corrected curve to the ideal line. Please click here to view a larger version of this figure.

Figure 5: Decision curve analysis for clinical utility. Generated using the R rmda package. The model should show net benefit over treat-all/none strategies across a 5%-45% threshold range. Please click here to view a larger version of this figure.

Figure 6: Forest plot for Cox proportional hazards model. Created with the R survminer package. Successful replication should clearly distinguish protective (HR < 1) and risk (HR > 1) factors. Please click here to view a larger version of this figure.
| variable | Trajectory 1 (N=62) | Trajectory 2 (N=36) | Trajectory 3 (N=63) | p |
| Age, years | 71 (62.2–81) | 72 (58–78.2) | 62 (45.5–81) | 0.0204 |
| SOFA | 5 (4–6) | 4 (3–6) | 4 (3–6) | 0.0333 |
| GCS | 15 (15–15) | 15 (15–15) | 15 (15–15) | 0.803 |
| APSIII | 52 (45–63) | 40 (28.8–57.5) | 49 (33.5–57) | 0.0107 |
| Charlson index | 5 (3–6) | 4.5 (3–5) | 3 (2–6) | 0.213 |
| COPD | 14 (22.6%) | 11 (30.6%) | 14 (22.2%) | 0.602 |
| Hypertension | 42 (67.7%) | 22 (61.1%) | 31 (49.2%) | 0.104 |
| Diabetes | 18 (29%) | 13 (36.1%) | 16 (25.4%) | 0.529 |
| Heart disease | 32 (51.6%) | 19 (52.8%) | 28 (44.4%) | 0.638 |
| Cerebrovascular | 12 (19.4%) | 5 (13.9%) | 7 (11.1%) | 0.425 |
| CKD | 9 (14.5%) | 7 (19.4%) | 8 (12.7%) | 0.659 |
| CLD | 0 (0%) | 0 (0%) | 4 (6.3%) | 0.0412 |
| Ventilation | 11 (17.7%) | 5 (13.9%) | 13 (20.6%) | 0.701 |
| Respiratory rate | 22 (19–25) | 19.5 (16–24) | 22 (18–24) | 0.0753 |
| Heart rate | 93 (82.2–101) | 84 (76.8–98.2) | 93 (88.5–106) | 0.0371 |
| SBP | 126 (114.2–138.5) | 126 (116–134) | 126 (115–130) | 0.518 |
| DBP | 75 (66–84.8) | 75 (63–79.8) | 75 (66–81) | 0.921 |
| WBC | 10.2 (6.8–16.3) | 11.8 (9.2–13.9) | 12.5 (8.8–15) | 0.208 |
| Hemoglobin | 10.8 (10–12) | 11.4 (10.5–13.1) | 11.7 (10.7–12.9) | 0.117 |
| Platelets | 223.5 (169.8–279) | 223.5 (175.8–264.2) | 226 (192–282) | 0.775 |
| Lymphocyte | 0.6 (0.4–0.7) | 1.4 (1.3–1.6) | 1.1 (0.6–1.9) | <0.001 |
| Creatinine | 0.9 (0.8–1.4) | 0.9 (0.8–1.2) | 0.8 (0.6–1.2) | 0.0652 |
| BUN | 23 (17–38) | 20 (14.5–33.2) | 18 (12.5–24.5) | 0.0167 |
| Potassium | 4 (3.6–4.7) | 4 (3.8–4.5) | 4.1 (3.5–4.4) | 0.488 |
| Sodium | 140 (136–143) | 139 (136–143.2) | 139 (137–141) | 0.444 |
| Length of hospital, days | 11.5 (7.2–20.8) | 11 (6.8–14.2) | 12 (8–16) | 0.557 |
| Length of ICU, days | 7 (4.2–12) | 6 (4–10.2) | 6 (3–11) | 0.603 |
| 28-day mortality | 15 (24.2%) | 5 (13.9%) | 2 (3.2%) | 0.0029 |
Table 1: Baseline characteristics by lymphocyte trajectories. The significance tests used were Fisher's exact test, Pearson's Chi-squared test, and Wilcoxon rank sum test.
| Characteristic | Overall  | Survive | Death | p-value |
| N = 161 | N = 139 | N = 22 |
| trajetory, n (%) | | | | 0.001 |
| 1 | 62.0 (38.5%) | 47.0 (33.8%) | 15.0 (68.2%) | |
| 2 | 36.0 (22.4%) | 31.0 (22.3%) | 5.0 (22.7%) | |
| 3 | 63.0 (39.1%) | 61.0 (43.9%) | 2.0 (9.1%) | |
| sex, n (%) | | | | 0.446 |
| Female | 83.0 (51.6%) | 70.0 (50.4%) | 13.0 (59.1%) | |
| Male | 78.0 (48.4%) | 69.0 (49.6%) | 9.0 (40.9%) | |
| age, Median (Q1, Q3) | 69.00 (55.00, 81.00) | 66.00 (52.00, 78.00) | 79.00 (70.00, 87.00) | 0.001 |
| hospital days, Median (Q1, Q3) | 12.00 (8.00, 17.00) | 12.00 (8.00, 17.00) | 11.00 (5.00, 18.00) | 0.303 |
| ICU days, Median (Q1, Q3) | 6.00 (4.00, 12.00) | 6.00 (3.00, 11.00) | 11.00 (5.00, 14.00) | 0.033 |
| Ventilation admission, n (%) | | | | >0.999 |
| No | 132.0 (82.0%) | 114.0 (82.0%) | 18.0 (81.8%) | |
| Yes | 29.0 (18.0%) | 25.0 (18.0%) | 4.0 (18.2%) | |
| COPD, n (%) | | | | 0.719 |
| No | 122.0 (75.8%) | 106.0 (76.3%) | 16.0 (72.7%) | |
| Yes | 39.0 (24.2%) | 33.0 (23.7%) | 6.0 (27.3%) | |
| Hypertension, n (%) | | | | 0.019 |
| NO | 66.0 (41.0%) | 62.0 (44.6%) | 4.0 (18.2%) | |
| Yes | 95.0 (59.0%) | 77.0 (55.4%) | 18.0 (81.8%) | |
| Diabetes, n (%) | | | | 0.771 |
| No | 114.0 (70.8%) | 99.0 (71.2%) | 15.0 (68.2%) | |
| Yes | 47.0 (29.2%) | 40.0 (28.8%) | 7.0 (31.8%) | |
| Heart disease, n (%) | | | | 0.312 |
| No | 82.0 (50.9%) | 73.0 (52.5%) | 9.0 (40.9%) | |
| Yes | 79.0 (49.1%) | 66.0 (47.5%) | 13.0 (59.1%) | |
| Cerebrovascular, n (%) | | | | 0.104 |
| No | 137.0 (85.1%) | 121.0 (87.1%) | 16.0 (72.7%) | |
| Yes | 24.0 (14.9%) | 18.0 (12.9%) | 6.0 (27.3%) | |
| CKD, n (%) | | | | 0.534 |
| No | 137.0 (85.1%) | 117.0 (84.2%) | 20.0 (90.9%) | |
| Yes | 24.0 (14.9%) | 22.0 (15.8%) | 2.0 (9.1%) | |
| CLD, n (%) | | | | >0.999 |
| No | 157.0 (97.5%) | 135.0 (97.1%) | 22.0 (100.0%) | |
| Yes | 4.0 (2.5%) | 4.0 (2.9%) | 0.0 (0.0%) | |
| SOFA admission, Median (Q1, Q3) | 5.00 (3.00, 6.00) | 5.00 (3.00, 6.00) | 5.50 (3.00, 7.00) | 0.241 |
| APSIII admission, Median (Q1, Q3) | 49.00 (35.00, 60.00) | 48.00 (32.00, 57.00) | 61.50 (50.00, 69.00) | <0.001 |
| GCS, Median (Q1, Q3) | 15.00 (15.00, 15.00) | 15.00 (15.00, 15.00) | 15.00 (14.00, 15.00) | 0.367 |
| Charlson Comorbidity Index, Median (Q1, Q3) | 5.00 (3.00, 6.00) | 4.00 (2.00, 6.00) | 5.00 (4.00, 6.00) | 0.047 |
| Respiratory rate, Median (Q1, Q3) | 22.00 (18.00, 24.00) | 22.00 (18.00, 24.00) | 23.00 (19.00, 26.00) | 0.091 |
| Heart rate, Median (Q1, Q3) | 93.00 (82.00, 103.00) | 93.00 (81.00, 101.00) | 101.00 (93.00, 110.00) | 0.01 |
| SBP, Median (Q1, Q3) | 126.00 (115.00, 135.00) | 126.00 (115.00, 135.00) | 126.00 (117.00, 136.00) | 0.919 |
| DBP, Median (Q1, Q3) | 75.00 (65.00, 83.00) | 75.00 (65.00, 83.00) | 75.00 (63.00, 84.00) | 0.963 |
| Cr, Median (Q1, Q3) | 0.90 (0.70, 1.30) | 0.90 (0.70, 1.30) | 0.95 (0.70, 1.40) | 0.582 |
| BUN, Median (Q1, Q3) | 20.00 (15.00, 30.00) | 19.00 (14.00, 27.00) | 33.50 (20.00, 54.00) | 0.002 |
| Potassium, Median (Q1, Q3) | 4.00 (3.70, 4.50) | 4.00 (3.60, 4.50) | 4.25 (3.80, 5.10) | 0.133 |
| Sodium, Median (Q1, Q3) | 139.00 (136.00, 142.00) | 139.00 (136.00, 142.00) | 140.50 (136.00, 143.00) | 0.483 |
| WBC, Median (Q1, Q3) | 11.50 (7.80, 15.20) | 11.40 (7.70, 15.20) | 12.10 (9.10, 18.20) | 0.321 |
| HBG, Median (Q1, Q3) | 11.30 (10.30, 12.70) | 11.50 (10.30, 12.80) | 10.60 (9.80, 11.70) | 0.072 |
| PLT, Median (Q1, Q3) | 226.00 (175.00, 279.00) | 225.00 (174.00, 278.00) | 236.00 (200.00, 358.00) | 0.208 |
| Lymphocyte, Median (Q1, Q3) | 0.83 (0.52, 1.44) | 0.88 (0.53, 1.45) | 0.67 (0.45, 0.93) | 0.111 |
Table 2: Survivors and non-survivors characteristic. The significance tests used were Fisher's exact test, Pearson's Chi-squared test, and Wilcoxon rank sum test.
| Group | Characteristic | OR | 95% CI | p-value |
| model 1 | trajetory | | | |
| 1 | — | — | |
| 2 | 0.51 | 0.15, 1.45 | 0.228 |
| 3 | 0.1 | 0.02, 0.39 | 0.003 |
| model 2 | trajetory | | | |
| 1 | — | — | |
| 2 | 0.46 | 0.12, 1.59 | 0.236 |
| 3 | 0.1 | 0.01, 0.44 | 0.007 |
| age | 1.08 | 1.03, 1.13 | 0.003 |
| sex | | | |
| F | — | — | |
| M | 0.5 | 0.15, 1.50 | 0.222 |
| hosp_days | 0.69 | 0.52, 0.86 | 0.005 |
| ICU_days | 1.51 | 1.22, 2.01 | 0.001 |
| model 3 | trajetory | | | |
| 1 | — | — | |
| 2 | 0.56 | 0.12, 2.32 | 0.435 |
| 3 | 0.06 | 0.01, 0.36 | 0.006 |
| age | 1.06 | 1.00, 1.14 | 0.049 |
| sex | | | |
| F | — | — | |
| M | 0.42 | 0.11, 1.47 | 0.187 |
| hosp_days | 0.59 | 0.40, 0.78 | 0.002 |
| ICU_days | 1.75 | 1.32, 2.57 | <0.001 |
| APS III_admission | 1.04 | 1.00, 1.08 | 0.047 |
| charlson_comorbidity_index | 0.89 | 0.63, 1.20 | 0.49 |
| heart_rate_admission | 1.05 | 1.01, 1.10 | 0.019 |
| BUN_adm | 1 | 1.00, 1.01 | 0.209 |
Table 3: Multivariate logistic regression. Abbreviations: CI = Confidence Interval, OR = Odds Ratio.
| Group | Characteristic | N | Event N | HR | 95% CI | p-value |
| model 1 | trajetory | 161 | 22 | | | |
| 1 | 62 | | — | — | |
| 2 | 36 | | 0.54 | 0.20, 1.48 | 0.232 |
| 3 | 63 | | 0.12 | 0.03, 0.52 | 0.005 |
| model 2 | trajetory | 161 | 22 | | | |
| 1 | 62 | | — | — | |
| 2 | 36 | | 0.51 | 0.18, 1.42 | 0.197 |
| 3 | 63 | | 0.16 | 0.03, 0.70 | 0.016 |
| age | 161 | 22 | 1.06 | 1.02, 1.10 | 0.004 |
| sex | 161 | 22 | | | |
| F | 83 | | — | — | |
| M | 78 | | 0.62 | 0.26, 1.46 | 0.274 |
| hosp_days | 161 | 22 | 0.73 | 0.58, 0.91 | 0.005 |
| ICU_days | 161 | 22 | 1.41 | 1.14, 1.73 | 0.001 |
| model 3 | trajetory | 161 | 22 | | | |
| 1 | 62 | | — | — | |
| 2 | 36 | | 0.65 | 0.22, 1.91 | 0.437 |
| 3 | 63 | | 0.13 | 0.03, 0.64 | 0.012 |
| age | 161 | 22 | 1.05 | 1.00, 1.10 | 0.063 |
| sex | 161 | 22 | | | |
| F | 83 | | — | — | |
| M | 78 | | 0.67 | 0.26, 1.74 | 0.411 |
| hosp_days | 161 | 22 | 0.68 | 0.54, 0.87 | 0.002 |
| ICU_days | 161 | 22 | 1.51 | 1.19, 1.91 | <0.001 |
| APS III_admission | 161 | 22 | 1.02 | 1.00, 1.05 | 0.026 |
| charlson_comorbidity_index | 161 | 22 | 0.92 | 0.71, 1.18 | 0.493 |
| heart_rate_admission | 161 | 22 | 1.03 | 1.00, 1.07 | 0.041 |
| BUN_adm | 161 | 22 | 1 | 1.00, 1.00 | 0.293 |
Table 4: Multivariate Cox regression. Abbreviations: CI = Confidence Interval, HR = Hazard Ratio.
Supplementary Table 1: Summary statistics for each lymphocyte trajectory group. Abbreviations: AIC = Akaike information criterion; BIC = Bayesian information criterion; CAIC = Consistent AIC; AvePP = Average posterior probability. Please click here to download this file.
Supplementary File 1: Codes and script for steps 1-3. Please click here to download this file.