Electrolyte trajectory-based subphenotypes and their association with hospital length of stay in prostate cancer patients Authors: Yujiao Shen, Haojie Xuan, Jie Wang, Yue Hu, Yanling Zhang Published: 2026 ABSTRACT BackgroundHospital length of stay (LOS) is an important indicator of postoperative recovery and healthcare efficiency, and prolonged LOS increases the risk of adverse events and healthcare burden. Electrolyte disturbances influence both complications and LOS. This study aimed to identify potential electrolyte trajectory subtypes in postoperative prostate cancer patients and to evaluate their association with LOS.MethodsA total of 818 prostate cancer patients who underwent surgery were extracted from the Medical Information Mart for Intensive Care IV (MIMIC-IV) database. Consensus clustering and group-based multi-trajectory modeling (GBMTM) were applied to classify patients based on electrolyte levels, and baseline characteristics across subphenotypes were compared. Key covariates related to LOS were screened using univariate regression and machine learning methods. Finally, regression models were constructed to analyze the association between subphenotypes and LOS.ResultsFour electrolyte trajectory subphenotypes were identified. Among these, Cluster 2 represented younger patients with favorable electrolyte homeostasis, while Cluster 4 consisted of older patients with multiple comorbidities, impaired renal function, and severe electrolyte disturbances. Compared with Cluster 2, patients in Clusters 1, 3, and 4 showed progressively prolonged LOS (β=0.174, 0.242, and 0.341, all P<0.001), and the results remained significant after multivariable adjustment.ConclusionsElectrolyte trajectory-based subtyping effectively identifies risk stratification in postoperative prostate cancer patients. Cluster 2 represents a low-risk group, whereas Cluster 4 is a high-risk group, suggesting that these subphenotypes may provide a valuable tool for perioperative management and prognosis prediction in postoperative prostate cancer patients. Highlight box Key findings • Four distinct postoperative electrolyte trajectory subphenotypes were identified, showing a clear and independent gradient association with prolonged hospital length of stay (LOS) in prostate cancer patients. What is known and what is new? • Electrolyte abnormalities are associated with postoperative complications and longer hospital stay, but most evidence is based on single-time-point measurements. • This study applies electrolyte trajectory-based subphenotyping using consensus clustering and group-based multi-trajectory modeling, demonstrating that dynamic electrolyte patterns provide superior risk stratification for LOS after prostate cancer surgery. What is the implication, and what should change now? • Dynamic electrolyte trajectory assessment may serve as a novel perioperative risk stratification tool, supporting earlier identification of high-risk patients and prompting targeted monitoring and intervention to reduce prolonged hospitalization. Introduction Prostate cancer is the most common malignancy among men worldwide and remains a leading cause of cancer-related mortality (1). This disease predominantly affects men in their 50s to 70s, and its incidence and burden continue to rise. By 2040, the global burden of prostate cancer is projected to increase to approximately 2.4 million new cases and 712,000 deaths (2). When the tumor is confined to the prostate and patients are generally in good health, surgical resection is often considered the preferred treatment option (3). In recent years, with the widespread adoption of minimally invasive and robot-assisted techniques, surgical management of prostate cancer has achieved remarkable progress in terms of oncological control and functional recovery (4,5). However, postoperative recovery remains highly variable among patients. Hospital length of stay (LOS) continues to serve as an important indicator of surgical quality, healthcare resource utilization, and patient outcomes (6). Prolonged LOS has been closely associated with higher risks of hospital-acquired infections, drug-related adverse events, and increased mortality, while also imposing a greater economic and societal burden (7). Therefore, identifying factors influencing LOS is critical for optimizing perioperative management, promoting enhanced recovery, and improving healthcare efficiency. Electrolytes, such as sodium, potassium, chloride, bicarbonate, and anion gap (AG), are fundamental for maintaining physiological processes such as nerve conduction, muscle contraction, acid-base balance, and fluid homeostasis (8,9). Disruptions in electrolyte balance can trigger metabolic emergencies and systemic dysfunction, and are regarded as some of the most urgent medical concerns in intensive care units (ICU) and hospitalized patients (10,11). Among patients undergoing major surgery, electrolyte disorders (e.g., hyponatremia, hypokalemia, hypocalcemia) are common and have been linked to increased postoperative complications, prolonged LOS, and higher mortality risk (12-16). Electrolyte homeostasis is primarily regulated by renal function and systemic hormonal mechanisms, while perioperative factors may further disturb this balance. Previous studies have reported significant changes in sodium and potassium levels following transurethral resection of the prostate (TURP) (17). In prostate cancer patients undergoing TURP, perioperative fluid shifts, blood loss, and medical interventions may substantially impact electrolyte stability (18). However, most prior studies have focused on single-time-point measurements of electrolytes or specific electrolyte abnormalities, with limited attention given to the clinical implications of dynamic changes. Trajectory analysis offers a novel approach for exploring longitudinal variations in biomarkers. Unlike static indicators, trajectory modeling captures temporal trends and can uncover latent phenotypic subgroups. This method has recently been applied in cardiovascular, renal, and critical care research, demonstrating significant clinical value (19-21). Given the central role of electrolyte homeostasis, trajectory-based subtyping of electrolytes holds promise for elucidating new patterns of postoperative recovery in prostate cancer. By classifying patients according to electrolyte trajectories, clinicians may better identify high-risk populations, predict complications in advance, and tailor perioperative interventions. Therefore, the present study aimed to identify distinct electrolyte trajectory subtypes in prostate cancer patients and to examine their association with LOS, to fill an important gap in current knowledge and provide a theoretical basis for incorporating dynamic biomarker monitoring into clinical practice. We present this article in accordance with the TRIPOD reporting checklist (available at https://tau.amegroups.com/article/view/10.21037/tau-2026-1-0060/rc). Methods Study population and endpoint This study was based on the publicly available clinical database, the Medical Information Mart for Intensive Care IV (MIMIC-IV) (https://mimic.mit.edu/docs/iv/). MIMIC-IV is a large single-center database that includes hospitalization records of patients at the Beth Israel Deaconess Medical Center from 2008 to 2019 (22). All data used in this study were derived from a de-identified database and did not involve direct patient information, in compliance with the ethical requirements for the use of MIMIC data. This study was conducted in accordance with the Declaration of Helsinki and its subsequent amendments. Patients were first identified in the MIMIC-IV database using the International Classification of Diseases Ninth/Tenth Revisions (ICD-9: 185; ICD-10: C61) to screen for those diagnosed with malignant neoplasm of prostate (23). A total of 1,576 cases were obtained. The following inclusion and exclusion criteria were applied (Figure S1): (I) patients who did not undergo surgery were excluded (n=515); (II) cases with LOS <1 day were excluded (n=54); (III) cases <18 years were excluded (n=0); (IV) cases without available measurements for all five electrolytes (AG, bicarbonate, potassium, sodium, and chloride) at any time point were excluded (n=189). Finally, 818 patients were included in the analysis, of whom 461 were >65 years and 357 were ≤65 years. The endpoint of this study was LOS. Variable extraction Data were extracted from the MIMIC-IV database using PostgreSQL and Navicat 16.3.3 software. The exposure variables were electrolyte levels, including sodium, potassium, chloride, bicarbonate, and AG. The AG was calculated using the following formula: AG = (sodium + potassium) − (chloride + bicarbonate) (24). In addition, demographic information was collected, including age, body mass index (BMI), race, marital status, tobacco, and alcohol consumption. Treatment-related variables included type of surgery [radical prostatectomy (RP), TURP, or others (“other surgeries” refer to procedures not directly related to prostate cancer; the specific information is shown in Table S1)], as well as the use of vasoactive drugs and anticoagulant drugs. The Charlson comorbidity index (CCI) was extracted to reflect disease severity. Laboratory indicators included blood urea nitrogen (BUN), creatinine, glucose, hemoglobin, hematocrit, red blood cell (RBC) count, white blood cell (WBC) count, platelet count, and red cell distribution width (RDW). All laboratory indicators were obtained from the first recorded values within 24 h after hospital admission. Consensus clustering Consensus clustering was applied to determine the appropriate number of clusters (k) within the overall dataset. The “ConsensusClusterPlus” package was used, with 1,000 resampling iterations and Euclidean distance as the distance metric. Cluster stability and interpretability were assessed using consensus matrix heatmaps, cumulative distribution function (CDF) curves, and delta area plots. Multivariate trajectory clustering Multivariate trajectory clustering was performed to identify prostate cancer subphenotypes. Group-based multi-trajectory modeling (GBMTM) is a statistical method that classifies individuals into distinct groups according to the patterns of multiple longitudinal trajectories (25). Five time points, including the first measurement during hospitalization and four subsequent consecutive measurements, were used to construct the multivariate trajectory model. GBMTM uses maximum likelihood estimation and can accommodate missing observations under the missing at random assumption, allowing individuals with incomplete measurements at some time points to be retained without the need for explicit imputation (26). Model fit was evaluated using the Akaike information criterion (AIC) and Bayesian information criterion (BIC), with smaller values indicating better model fit. To ensure stability and clinical interpretability, only models with each class accounting for more than 10% of the population were considered. Statistical analysis Baseline characteristics were compared between age groups (>65 vs. ≤65 years) and between different subphenotypes. Categorical variables were presented as n (%) and compared using the Chi-squared (χ²) test. Continuous variables with non-normal distribution were expressed as median [interquartile range (IQR)] and compared using the Mann-Whitney U test. Because of the skewed distribution, LOS was log-transformed (log-LOS). Candidate covariates were first screened using univariate regression analysis, with log-LOS as the dependent variable. Variables with P<0.05 were further evaluated for multicollinearity. Variance inflation factor (VIF) was used to assess multicollinearity, and those with VIF >5 were excluded (27). For the remaining candidate variables, two machine learning methods, random forest and Adaboost models, were applied to evaluate variable importance and generate rankings, which guided the selection of covariates. To examine the association between prostate cancer subphenotypes and LOS, regression models were constructed with log-LOS as the dependent variable, reporting regression coefficients (β) and 95% confidence intervals (CIs). The crude model included no adjustments. Model 1 was adjusted for age and CCI. Model 2 was adjusted for surgery, vasoactive drugs, and anticoagulant drugs. Model 3 was adjusted for WBC, RDW, BUN, glucose, and creatinine. Subgroup analysis was then conducted to evaluate the robustness of the association between electrolyte subphenotypes and LOS stratified by CCI, vasoactive drug use, anticoagulant drug use, and surgical type. All statistical analyses were conducted using R version 4.2.3 or SPSS version 25.0. A two-sided P<0.05 was considered statistically significant. Results Baseline characteristics of the study population A total of 818 patients were included in this study, of whom 357 (43.643%) were aged ≤65 years and 461 (56.357%) were aged >65 years (Table 1). There were no significant differences between the two groups in marital status, alcohol, or tobacco (P>0.05). However, patients older than 65 years were more likely to be White (P<0.001), less likely to undergo RP or TURP (P<0.001), and more likely to receive other surgical procedures (P<0.001). In addition, elderly patients had a higher proportion of vasoactive and anticoagulant drug use (P<0.001). Compared with younger patients, older patients had significantly lower BMI values (P=0.004). In terms of laboratory indicators, elderly patients had higher levels of BUN, creatinine, RDW, AG, and potassium, while hematocrit, hemoglobin, platelets, RBC, WBC, and bicarbonate were significantly lower (all P<0.05). No significant differences were observed in glucose, chloride, or sodium levels between the two groups. Further analysis showed that older patients had significantly higher CCI scores (P<0.001) and longer LOS (P<0.001). Table 1Baseline characteristics of patients stratified by ageVariablesTotal (n=818)≤65 years (n=357)>65 years (n=461)PMarital status Others279 (34.108)111 (31.092)168 (36.443)0.11 Married539 (65.892)246 (68.908)293 (63.557)Race Non-White266 (32.518)145 (40.616)121 (26.247)<0.001 White552 (67.482)212 (59.384)340 (73.753)Surgery RP225 (27.506)169 (47.339)56 (12.148)<0.001 TURP114 (13.936)86 (24.090)28 (6.074) Others479 (58.557)102 (28.571)377 (81.779)Alcohol No789 (96.455)343 (96.078)446 (96.746)0.61 Yes29 (3.545)14 (3.922)15 (3.254)Tobacco No704 (86.064)313 (87.675)391 (84.816)0.24 Yes114 (13.936)44 (12.325)70 (15.184)Vasoactive drugs No751 (91.809)343 (96.078)408 (88.503)<0.001 Yes67 (8.191)14 (3.922)53 (11.497)Anticoagulant drugs No242 (29.584)149 (41.737)93 (20.174)<0.001 Yes576 (70.416)208 (58.263)368 (79.826)Age (years)67.000 [61.000, 76.000]60.000 [55.000, 63.000]75.000 [69.000, 82.000]<0.001BMI (kg/m2)27.600 [24.500, 30.800]28.200 [25.100, 31.300]27.100 [24.000, 30.100]0.004BUN (mg/dL)17.000 [13.000, 24.000]14.000 [11.000, 18.000]20.000 [15.000, 29.000]<0.001Glucose (mg/dL)118.000 [100.000, 146.000]118.000 [102.000, 141.000]117.000 [99.000, 150.000]0.90Creatinine (mg/dL)1.000 [0.900, 1.300]1.000 [0.900, 1.200]1.100 [0.900, 1.400]<0.001Hematocrit (g/dL)34.800 [31.200, 38.000]35.900 [33.100, 38.400]33.900 [29.900, 37.400]<0.001Hemoglobin (g/dL)11.700 [10.300, 12.700]12.000 [11.100, 12.900]11.400 [9.700, 12.600]<0.001Platelets (K/µL)196.000 [156.000, 236.000]204.000 [167.000, 234.000]189.000 [149.000, 236.000]0.02RBC (M/µL)3.850 [3.420, 4.220]3.980 [3.670, 4.310]3.740 [3.260, 4.150]<0.001RDW (%)13.500 [12.900, 14.600]13.200 [12.700, 13.900]13.800 [13.100, 15.100]<0.001WBC (K/µL)9.000 [6.900, 12.100]9.400 [7.500, 12.100]8.600 [6.500, 12.100]0.01AG (mEq/L)13.000 [11.000, 15.000]12.000 [10.000, 14.000]14.000 [12.000, 16.000]<0.001Bicarbonate (mEq/L)26.000 [23.000, 28.000]27.000 [24.000, 29.000]25.000 [22.000, 27.000]<0.001Sodium (mEq/L)139.000 [138.000, 141.000]139.000 [138.000, 141.000]140.000 [137.000, 142.000]0.054Potassium (mEq/L)4.100 [3.800, 4.400]4.100 [3.800, 4.400]4.200 [3.900, 4.500]0.02Chloride (mEq/L)104.000 [102.000, 106.000]104.000 [102.000, 106.000]104.000 [101.000, 107.000]0.21 CCI7.000 [5.000, 9.000]5.000 [5.000, 7.000]8.000 [6.000, 10.000]<0.001LOS (day)3.175 [1.670, 6.869]2.060 [1.399, 3.417]4.681 [2.576, 8.042]<0.001Values are median [interquartile range] or n (%). AG, anion gap; BMI, body mass index; BUN, blood urea nitrogen; CCI, Charlson comorbidity index; LOS, hospital length of stay; RBC, red blood cell; RDW, red blood cell distribution width; RP, radical prostatectomy; TURP, transurethral resection of the prostate; WBC, white blood cell. Baseline characteristics of patients stratified by age Values are median [interquartile range] or n (%). AG, anion gap; BMI, body mass index; BUN, blood urea nitrogen; CCI, Charlson comorbidity index; LOS, hospital length of stay; RBC, red blood cell; RDW, red blood cell distribution width; RP, radical prostatectomy; TURP, transurethral resection of the prostate; WBC, white blood cell. Electrolyte trajectories and prostate cancer subphenotypes To explore potential patient subgroups based on electrolyte dynamics, consensus clustering was first performed. The consensus matrix heatmap indicated relatively high clustering stability when the number of clusters (k) was set to 2 or 4 (Figure 1A). The consensus index further supported superior within-cluster consistency at k=2 or 4 compared with other solutions (Figure 1B). Moreover, the CDF curves and their delta area plots suggested that k=2 or 4 achieved an optimal balance between stability and classification resolution (Figure 1C). On this basis, GBMTM was conducted (Table S2). Among the candidate models, the four-class solution (GBTM-4) demonstrated the best balance between statistical goodness-of-fit and clinical interpretability. The AIC (41,799.97) and BIC (42,147.19) values of GBTM-4 were lower than those of the two- and three-class models. Furthermore, in GBTM-4, each class accounted for more than 10% of the sample, fulfilling the requirement for stability. Therefore, four subphenotypes were finally identified. The proportions of each subphenotype were as follows: Cluster 1 (43.89%), Cluster 2 (25.92%), Cluster 3 (18.83%), and Cluster 4 (11.37%). Further analysis of electrolyte trajectories across subphenotypes revealed distinct dynamic patterns (Figure 2). Cluster 1 was characterized by relatively high but gradually decreasing AG and potassium levels, along with persistently low bicarbonate. Cluster 2 exhibited overall stability with minimal electrolyte fluctuations. Cluster 3 showed lower AG, sodium, and chloride levels, accompanied by a mild decline in bicarbonate. Cluster 4 was characterized by the lowest AG and potassium levels, together with the highest sodium and chloride concentrations. Consensus clustering analysis. (A) Consensus matrices for k=2 to k=6. Each block represents a consensus value, where darker colors indicate higher consensus within clusters. (B) Cluster-consensus scores across different k values, showing the stability of clusters at each k. (C) Consensus CDF plot and relative change in area under the CDF curve (delta area) for k=2 to k=6. CDF, cumulative distribution function. Longitudinal trajectories of electrolytes across different clusters. Trends of AG, bicarbonate, sodium, chloride, and potassium levels over five time points are shown for four identified clusters. Time is treated as the order of measurement, including 1st, 2nd, 3rd, 4th, and 5th assessments after admission. AG, anion gap. Comparison of clinical characteristics among subphenotypes To further investigate the clinical differences across electrolyte trajectory subphenotypes, baseline characteristics were compared among the four clusters. Significant variations were observed in age, surgery, medication use, laboratory indicators, and outcomes (Table 2). Overall, Cluster 2 patients were the youngest (median age 65 years), while Clusters 3 and 4 were older (71 and 70 years, respectively). With respect to surgery, Cluster 1 was predominantly treated with TURP, Cluster 2 was dominated by RP, whereas Clusters 3 and 4 more frequently underwent other types of surgery. Regarding medication use, Cluster 4 patients had the highest proportions of vasoactive and anticoagulant drugs, while Cluster 2 had the lowest. Laboratory indicators also differed across clusters. Cluster 2 patients exhibited relatively higher hemoglobin and hematocrit levels, indicating a better hematologic profile; Clusters 1 and 3 were intermediate; Cluster 4 showed the lowest hemoglobin and hematocrit levels, together with the highest RDW. For platelets, Cluster 1 had the highest levels, Clusters 2 and 3 were lower, and Cluster 4 fell in between. In terms of metabolic features, Cluster 2 demonstrated the most favorable profile, with the lowest BUN and creatinine, reflecting preserved renal function; stable electrolyte balance, characterized by higher sodium and chloride, the highest bicarbonate, and the lowest AG, indicating better acid-base homeostasis. Cluster 1 values were largely near the overall mean, but sodium and chloride were slightly lower. In contrast, Cluster 3 showed the highest sodium and chloride levels, combined with reduced bicarbonate and elevated AG. Cluster 4 displayed the most severe metabolic abnormalities, including markedly elevated creatinine and BUN, low bicarbonate, high potassium, and elevated AG, consistent with renal impairment and profound acid-base imbalance. Figure 3 visually illustrated the distributional differences of laboratory indices among four clusters, with Cluster 4 deviating most from the normal range. Table 2Clinical features across subclustersVariablesCluster 1 (n=359)Cluster 2 (n=212)Cluster 3 (n=154)Cluster 4 (n=93)PAge (years)67.000 [61.000, 76.000]65.000 [59.000, 71.000]71.000 [62.000, 80.000]70.000 [63.000, 81.000]<0.001BMI (kg/m2)27.900 [24.700, 31.300]27.300 [24.300, 30.100]27.600 [24.700, 31.100]27.000 [24.300, 29.400]0.43Race0.66 Non-White124 (34.540)63 (29.717)48 (31.169)31 (33.333) White235 (65.460)149 (70.283)106 (68.831)62 (66.667)Marital status0.457 Others121 (33.705)65 (30.660)57 (37.013)36 (38.710) Married238 (66.295)147 (69.340)97 (62.987)57 (61.290)Surgery<0.001 RP81 (22.563)112 (52.830)24 (15.584)8 (8.602) TURP59 (16.435)27 (12.736)20 (12.987)8 (8.602) Others219 (61.003)73 (34.434)110 (71.429)77 (82.796)Alcohol0.30 No349 (97.214)206 (97.170)147 (95.455)87 (93.548) Yes10 (2.786)6 (2.830)7 (4.545)6 (6.452)Tobacco0.71 No312 (86.908)179 (84.434)135 (87.662)78 (83.871) Yes47 (13.092)33 (15.566)19 (12.338)15 (16.129)Vasoactive drugs<0.001 No333 (92.758)202 (95.283)140 (90.909)76 (81.720) Yes26 (7.242)10 (4.717)14 (9.091)17 (18.280)Anticoagulant drugs<0.001 No100(27.855)102(48.113)30(19.481)10(10.753) Yes259(72.145)110(51.887)124(80.519)83(89.247)BUN (mg/dL)17.000 [13.000, 23.000]14.000 [12.000, 18.000]18.000 [14.000, 27.000]30.000 [15.000, 53.000]<0.001Glucose (mg/dL)119.000 [102.000, 149.000]118.000 [100.000, 140.000]118.000 [99.000, 146.000]114.000 [98.000, 150.000]0.47Creatinine (mg/dL)1.000 [0.900, 1.300]1.000 [0.900, 1.100]1.000 [0.900, 1.400]1.400 [1.000, 3.600]<0.001Hematocrit (g/dL)34.900 [31.000, 38.300]34.900 [32.500, 38.300]34.900 [31.100, 38.400]33.300 [29.600, 36.600]0.058Hemoglobin (g/dL)11.800 [10.300, 12.900]11.900 [10.900, 12.700]11.500 [10.200, 12.800]11.000 [9.400, 12.200]0.003Platelets (K/µL)207.000 [167.000, 246.000]185.000 [153.000, 220.000]184.000 [147.000, 229.000]200.000 [156.000, 244.000]<0.001RBC (M/µL)3.880 [3.460, 4.280]3.850 [3.540, 4.190]3.850 [3.420, 4.230]3.670 [3.160, 4.160]0.07RDW (%)13.500 [12.900, 14.500]13.300 [12.700, 14.100]13.600 [12.900, 14.800]14.700 [13.200, 16.100]<0.001WBC (K/µL)9.200 [7.000, 12.400]9.000 [6.900, 12.200]8.800 [6.300, 11.600]9.200 [7.100, 12.000]0.54AG (mEq/L)13.000 [12.000, 15.000]11.000 [10.000, 12.000]14.000 [12.000, 16.000]17.000 [14.000, 20.000]<0.001Bicarbonate (mEq/L)25.000 [23.000, 28.000]27.000 [25.000, 29.000]24.000 [22.000, 27.000]22.000 [18.000, 27.000]<0.001Sodium (mEq/L)138.000 [137.000, 140.000]140.000 [138.000, 141.000]141.000 [140.000, 143.000]139.000 [136.000, 142.000]<0.001Potassium (mEq/L)4.100 [3.900, 4.500]4.100 [3.800, 4.300]4.000 [3.800, 4.300]4.500 [3.900, 5.200]<0.001Chloride (mEq/L)103.000 [100.000, 105.000]105.000 [104.000, 106.000]106.000 [104.000, 108.000]102.000 [98.000, 106.000]<0.001CCI7.000 [5.000, 9.000]6.000 [5.000, 7.000]7.000 [6.000, 9.000]9.000 [7.000, 10.000]<0.001LOS (day)3.247 [1.675, 7.049]2.226 [1.372, 3.622]4.239 [2.246, 7.722]5.781 [2.906, 9.466]<0.001Values are median [interquartile range] or n (%). AG, anion gap; BMI, body mass index; BUN, blood urea nitrogen; CCI, Charlson comorbidity index; LOS, hospital length of stay; RBC, red blood cell; RDW, red blood cell distribution width; RP, radical prostatectomy; TURP, transurethral resection of the prostate; WBC, white blood cell. Clinical features across subclusters Values are median [interquartile range] or n (%). AG, anion gap; BMI, body mass index; BUN, blood urea nitrogen; CCI, Charlson comorbidity index; LOS, hospital length of stay; RBC, red blood cell; RDW, red blood cell distribution width; RP, radical prostatectomy; TURP, transurethral resection of the prostate; WBC, white blood cell. Comparison of laboratory indicators across different electrolyte trajectory-based subphenotypes. Radar-like line plots display the scaled values (Z-scores) of multiple variables among the four identified clusters. Each panel represents a pairwise comparison between two clusters. AG, anion gap; BMI, body mass index; BUN, blood urea nitrogen; CCI, Charlson comorbidity index; RBC, red blood cell; RDW, red blood cell distribution width; WBC, white blood cell. Outcome analysis further revealed that Cluster 2 had the shortest LOS (median 2.226 days), while Cluster 4 had the longest LOS (5.781 days) and the highest CCI (Table 2), reflecting the greatest disease burden. Taken together, Cluster 2 represents younger, metabolically stable, low-risk patients; Cluster 1 corresponds to an intermediate-risk group with mild electrolyte abnormalities; Cluster 3 comprises predominantly elderly patients characterized by hypernatremia, hyperchloremia, and metabolic acidosis tendency; and Cluster 4 denotes older patients with multiple comorbidities, renal impairment, and marked electrolyte disturbances, representing the highest-risk subgroup. Identification of key covariates associated with LOS To explore the key factors associated with subphenotype distribution and patient outcomes, univariate regression analysis was performed to screen potential covariates. To address skewness in the outcome distribution (Figure S2), LOS was first log-transformed. Univariate regression results indicated that age, BUN, glucose, creatinine, hematocrit, hemoglobin, RBC, RDW, WBC, CCI, race, marital status, surgery-others, alcohol consumption, vasopressor use, and anticoagulant use were all significantly associated with log LOS (all P<0.05, Table 3). Next, the VIF was calculated to assess multicollinearity. Hemoglobin, hematocrit, and RBC had VIF values greater than 5 (Table S3), suggesting severe collinearity; thus, these variables were excluded from subsequent analyses. Based on the remaining variables, machine learning methods were applied to rank variable importance (Figure 4). Both random forest and Adaboost models consistently identified surgery, WBC, RDW, glucose, age, BUN, creatinine, CCI, vasoactive drug, and anticoagulant drug among the top 10 predictors. Accordingly, these 10 variables were determined to be key covariates associated with LOS and were included in further modeling. Table 3Univariate regression analysis of LOS-associated factorsVariablesβ (95% CI)PAge0.012 (0.010 to 0.014)<0.001BMI−0.003 (−0.005 to 0.000)0.055BUN0.007 (0.006 to 0.009)<0.001Glucose0.001 (0.000 to 0.001)0.007Creatinine0.037 (0.021 to 0.053)<0.001Hematocrit−0.013 (−0.018 to −0.008)<0.001Hemoglobin−0.043 (−0.056 to −0.030)<0.001Platelets0.001 (−0.000 to 0.001)0.15RBC−0.113 (−0.153 to −0.073)<0.001RDW0.069 (0.056 to 0.082)<0.001WBC0.005 (0.002 to 0.008)<0.001CCI0.069 (0.061 to 0.078)<0.001Race0.062 (0.007 to 0.116)0.03Marital status−0.108 (−0.161 to −0.054)<0.001Surgery-TURP−0.006 (−0.072 to 0.059)0.85Surgery-others0.473 (0.427 to 0.519)<0.001Alcohol0.268 (0.131 to 0.405)<0.001Tobacco0.025 (−0.049 to 0.098)0.51Vasoactive drugs0.416 (0.327 to 0.505)<0.001Anticoagulant drugs0.336 (0.285 to 0.387)<0.001BMI, body mass index; BUN, blood urea nitrogen; CCI, Charlson comorbidity index; CI, confidence interval; LOS, hospital length of stay; RBC, red blood cell; RDW, red blood cell distribution width; TURP, transurethral resection of the prostate; WBC, white blood cell. Univariate regression analysis of LOS-associated factors BMI, body mass index; BUN, blood urea nitrogen; CCI, Charlson comorbidity index; CI, confidence interval; LOS, hospital length of stay; RBC, red blood cell; RDW, red blood cell distribution width; TURP, transurethral resection of the prostate; WBC, white blood cell. Weight importance of variables was ranked by random forest and Adaboost. BUN, blood urea nitrogen; CCI, Charlson comorbidity index; RDW, red blood cell distribution width; WBC, white blood cell. Association between electrolyte subphenotypes and LOS in prostate cancer patients To further assess the impact of different subphenotypes on LOS, regression models were constructed with log LOS as the dependent variable and cluster classification as the independent variable. Based on previous analyses, Cluster 2, which demonstrated the most favorable metabolic homeostasis, was used as the reference group. In the unadjusted model (Table 4), compared with the reference group G1 (Cluster 2), patients in G2 (Cluster 1), G3 (Cluster 3), and G4 (Cluster 4) all showed significantly longer log LOS. The regression coefficients (β) were 0.174 (95% CI: 0.113–0.235, P<0.001), 0.242 (95% CI: 0.168–0.316, P<0.001), and 0.341 (95% CI: 0.253–0.428, P<0.001) in G2, G3, and G4, respectively. This corresponds to relative increases of 19.0%, 27.4%, and 40.6% in log LOS for G2, G3, and G4, respectively, showing a stepwise upward trend, with G4 patients experiencing the greatest prolongation. Table 4Association between subclusters and log LOSClustersnβ (95% CI)PG1 (cluster 2)212Ref.G2 (cluster 1)3590.174 (0.113–0.235)<0.001G3 (cluster 3)1540.242 (0.168–0.316)<0.001G4 (cluster 4)930.341 (0.253–0.428)<0.001Rude model: adjusted for no covariates. CI, confidence interval; LOS, hospital length of stay. Association between subclusters and log LOS Rude model: adjusted for no covariates. CI, confidence interval; LOS, hospital length of stay. After further covariate adjustment, the associations remained significant (Table 5). In Model 1 (adjusted for age and CCI), β values for G2, G3, and G4 were 0.094 (95% CI: 0.039–0.149, P=0.001), 0.142 (95% CI: 0.075–0.209, P<0.001), and 0.171 (95% CI: 0.090–0.251, P<0.001), respectively. In Model 2 (adjusted for surgery, vasoactive drug, and anticoagulant drug), the effect sizes were attenuated but remained significant (G2: β=0.055, 95% CI: 0.007–0.104, P=0.03; G3: β=0.068, 95% CI: 0.008–0.128, P=0.03; G4: β=0.089, 95% CI: 0.018–0.160, P=0.01). In Model 3 (adjusted for laboratory indices: WBC, RDW, glucose, BUN, creatinine), results were similarly robust, with β values of 0.122 (95% CI: 0.064–0.179, P<0.001), 0.173 (95% CI: 0.104–0.243, P<0.001), and 0.169 (95% CI: 0.079–0.259, P<0.001) for G2, G3, and G4, respectively. Overall, the trend demonstrated progressively prolonged LOS from G2 to G4, with G4 patients showing the most pronounced increase, indicating the heaviest disease burden, the slowest recovery, and the poorest prognosis. Table 5Multivariable regression models for subclusters and log LOSClustersModel 1Model 2Model 3β (95% CI)Pβ (95% CI)Pβ (95% CI)PG2 (cluster 1)0.094 (0.039–0.149)0.0010.055 (0.007–0.104)0.030.122 (0.064–0.179)<0.001G3 (cluster 3)0.142 (0.075–0.209)<0.0010.068 (0.008–0.128)0.030.173 (0.104–0.243)<0.001G4 (cluster 4)0.171 (0.090–0.251)<0.0010.089 (0.018–0.160)0.010.169 (0.079–0.259)<0.001Model 1 adjusted for age and CCI. Model 2 adjusted for surgery, vasoactive drug, and anticoagulant drug. Model 3 adjusted for WBC, RDW, glucose, BUN, creatinine. BUN, blood urea nitrogen; CCI, Charlson comorbidity index; CI, confidence interval; LOS, hospital length of stay; RDW, red blood cell distribution width; WBC, white blood cell. Multivariable regression models for subclusters and log LOS Model 1 adjusted for age and CCI. Model 2 adjusted for surgery, vasoactive drug, and anticoagulant drug. Model 3 adjusted for WBC, RDW, glucose, BUN, creatinine. BUN, blood urea nitrogen; CCI, Charlson comorbidity index; CI, confidence interval; LOS, hospital length of stay; RDW, red blood cell distribution width; WBC, white blood cell. Subgroup analysis of the association between electrolyte subphenotypes and LOS To assess the robustness of the association between electrolyte subphenotypes and LOS, sensitivity analyses were conducted across different clinical subgroups. The results showed that the positive association between G2–G4 and log-transformed LOS remained consistent in most subgroups (Table 6). In patients with low CCI (≤7), G2, G3, and G4 were all significantly associated with prolonged log LOS, with β coefficients of 0.118, 0.208, and 0.306, respectively (all P<0.001). In contrast, among patients with high CCI (>7), this association was attenuated: G2 and G3 were no longer statistically significant, and only G4 remained significantly associated with LOS (β=0.147, 95% CI: 0.011–0.284, P=0.04). Stratified analyses by vasoactive drug use showed that in patients not receiving vasoactive agents, G2–G4 were consistently positively associated with LOS (G2: β=0.157, 95% CI: 0.096–0.217; G3: β=0.229, 95% CI: 0.155–0.304; G4: β=0.280, 95% CI: 0.189–0.371; all P<0.001). However, in patients receiving vasoactive drugs, the significant association between G3 and LOS disappeared, while G2 and G4 remained statistically significant. In the anticoagulant subgroup, G2–G4 were all significantly associated with prolonged LOS (all P≤0.001), suggesting that this relationship was not influenced by anticoagulant therapy. When stratified by surgical type, only G4 was significantly associated with LOS in the RP subgroup (β=0.184, 95% CI: 0.041–0.327; P=0.01). In the TURP subgroup, no significant associations were observed between G2–G4 and LOS. In contrast, in the other surgeries subgroup, G2–G4 all demonstrated stable and significant positive associations with LOS (all P<0.05). Table 6Subgroup analyses of the association between electrolyte subphenotypes and LOS in prostate cancer patientsSubgroupsG2 (cluster 1)G3 (cluster 3)G4 (cluster 4)β (95% CI)Pβ (95% CI)Pβ (95% CI)PCCI ≤70.118 (0.054 to 0.183)<0.0010.208 (0.125 to 0.292)<0.0010.306 (0.194 to 0.418)<0.001 >70.095 (−0.021 to 0.210)0.110.101 (−0.029 to 0.230)0.130.147 (0.011 to 0.284)0.04Vasoactive drug No0.157 (0.096 to 0.217)<0.0010.229 (0.155 to 0.304)<0.0010.280 (0.189 to 0.371)<0.001 Yes0.289 (0.054 to 0.525)0.020.229 (−0.033 to 0.491)0.090.391 (0.139 to 0.642)0.003Anticoagulant drug No0.077 (0.007 to 0.146)0.030.187 (0.085 to 0.289)<0.0010.211 (0.048 to 0.375)0.01 Yes0.136 (0.055 to 0.217)0.0010.16 (0.067 to 0.253)0.0010.244 (0.140 to 0.347)<0.001Surgery RP0.009 (−0.048 to 0.066)0.760.058 (−0.030 to 0.146)0.200.184 (0.041 to 0.327)0.01 TURP0 (−0.066 to 0.065)0.99−0.031 (−0.115 to 0.052)0.470 (−0.114 to 0.114)>0.99 Others0.117 (0.026 to 0.208)0.010.137 (0.036 to 0.239)0.0080.173 (0.063 to 0.283)0.002CCI, Charlson comorbidity index; CI, confidence interval; LOS, hospital length of stay; RP, radical prostatectomy; TURP, transurethral resection of the prostate. Subgroup analyses of the association between electrolyte subphenotypes and LOS in prostate cancer patients CCI, Charlson comorbidity index; CI, confidence interval; LOS, hospital length of stay; RP, radical prostatectomy; TURP, transurethral resection of the prostate. Discussion This study systematically explored the postoperative heterogeneity of prostate cancer patients based on electrolyte trajectory subtyping and its association with LOS. Using consensus clustering combined with GBMTM, four representative dynamic electrolyte trajectory subphenotypes were identified. These subphenotypes differed not only in baseline demographic characteristics but also in laboratory indicators, surgical approaches, medication use, and clinical outcomes. Notably, Cluster 2 consisted mainly of younger patients with stable electrolyte homeostasis and exhibited the shortest LOS. In contrast, Cluster 4 was characterized by older age, multiple comorbidities, and severe electrolyte disturbances, leading to significantly prolonged LOS and heavier disease burden. These findings provide a novel perspective for perioperative risk stratification and individualized management in prostate cancer patients. Electrolyte disturbances are not only markers of systemic metabolic dysfunction but may also directly influence tumor biology. For example, sodium channels are aberrantly overexpressed in prostate cancer cells, and their activation is closely associated with enhanced proliferation, migration, and invasiveness (28). Dysregulation of potassium channels has been implicated in apoptotic escape and chemotherapy resistance (29). Moreover, disruption of acid-base balance can alter the tumor microenvironment and immune responses, thereby promoting cancer progression and metastasis (30,31). Maintaining electrolyte homeostasis is also crucial in the perioperative period. Surgical trauma, anesthesia, blood loss, fluid resuscitation, and pharmacological interventions may all interfere with electrolyte balance, while abnormal electrolyte states can further delay postoperative recovery (32-34). Previous studies have observed sodium and potassium abnormalities during TURP, although without evident physiological consequences (35). Another study reported a weak positive association between hyperkalemia and mortality in prostate cancer patients (36). These findings may be attributable to the fact that such studies focused only on single-time-point measurements, which cannot fully capture dynamic changes. In contrast, our study applied trajectory modeling, incorporating multiple serial measurements during hospitalization to more accurately depict the evolution of electrolyte states, thereby uncovering potential heterogeneous subpopulations. Among the four identified subphenotypes, Cluster 4 represented the highest-risk population. Patients in this group exhibited pronounced renal dysfunction (with the highest BUN and creatinine levels) and severe acid-base imbalance (low bicarbonate, elevated potassium, and high AG). AG reflects the difference between unmeasured serum anions and cations and is one of the most commonly used biomarkers for diagnosing acid-base disorders and identifying metabolic acidosis (37). The profile of Cluster 4 suggests a metabolic acidosis state. Acidic pH has been recognized as a biomarker of prostate cancer aggressiveness and an important prognostic factor (38,39). Acidosis not only predisposes patients to cardiac depression and inflammatory responses but also delays tissue repair, thereby increasing morbidity and mortality (40,41). In addition, Cluster 4 patients had the lowest hemoglobin and hematocrit levels and the highest RDW, indicating anemia and impaired hematopoietic function. Taken together with their older age, the highest CCI scores, and the highest proportions of vasoactive and anticoagulant drugs, this group can be characterized as having the typical “advanced age-high comorbidity-severe metabolic dysregulation” profile, making them the most vulnerable perioperative population. Cluster 3 was also a high-risk group, though slightly less severe than Cluster 4. These patients were predominantly elderly and exhibited electrolyte patterns characterized by hypernatremia, hyperchloremia, low bicarbonate, and high AG, suggesting a tendency toward metabolic acidosis. This profile may be related to perioperative fluid administration (e.g., saline or chloride-rich solutions) or tubular dysfunction. Previous studies have confirmed that acid-base imbalance is closely associated with postoperative infections and delayed recovery (42,43). Therefore, for patients in Clusters 4 and 3, intensified monitoring of renal function and acid-base balance, along with early intervention for electrolyte disturbances, may help reduce LOS. In contrast, Clusters 1 and 2 represented relatively low-risk populations. Cluster 1 was dominated by patients undergoing TURP, with electrolyte levels overall close to the cohort mean, showing only mildly lower sodium and chloride than other clusters. Cluster 2 demonstrated the most favorable metabolic homeostasis: patients had the lowest BUN and creatinine, indicating preserved renal function; higher bicarbonate with stable sodium and chloride, reflecting normal acid-base regulation; and higher hemoglobin and hematocrit, suggesting adequate hematologic reserve, which supports tissue repair and oxygen delivery. Moreover, Cluster 2 had the lowest CCI scores, which are a strong predictor of treatment-related toxicity (44). These patients also had the lowest proportions of vasoactive and anticoagulant drug use and the shortest LOS, consistent with their favorable metabolic and clinical characteristics, representing an ideal group with rapid recovery and good prognosis. Regression analyses further reinforced the independent prognostic significance of electrolyte subphenotypes. In the unadjusted model, compared with Cluster 2, LOS was progressively longer in Clusters 1, 3, and 4. It is noteworthy that patients in the high-risk clusters were more likely to undergo more complex surgical procedures, have higher CCI scores, and require more frequent use of vasoactive agents, suggesting that perioperative severity may partially drive cluster formation. Perioperative factors such as surgical trauma, intraoperative blood loss, and anesthesia intensity may indirectly prolong LOS by inducing acid-base disturbances and renal dysfunction. In our multivariable models, after stepwise adjustment for age, CCI, surgical type, medication use, and key laboratory variables, high-risk clusters remained positively associated with LOS, indicating that electrolyte trajectories provide incremental prognostic information beyond conventional clinical indicators. Sensitivity analyses further demonstrated that this trend was generally consistent across different clinical subgroups. Although the statistical significance of some clusters was attenuated in subgroups with high CCI, use of vasoactive agents, or those undergoing TURP/RP procedures, high-risk clusters consistently showed a positive association with LOS, supporting the robustness of the relationship between electrolyte-based subtypes and LOS. These findings suggest that electrolyte trajectories are not merely epiphenomena, but may reflect an intrinsic link between systemic metabolic homeostasis and postoperative recovery capacity. This study carries important clinical implications. First, trajectory-based subtyping derived from dynamic electrolyte changes reveals substantial heterogeneity in metabolic status, providing a novel perspective for risk stratification in postoperative patients with prostate cancer. For example, Cluster 2 patients may benefit from preplanned enhanced recovery pathways, whereas Cluster 4 patients require intensified monitoring and targeted interventions. Second, perioperative fluid and electrolyte management strategies can be optimized according to subtype, such as avoiding chloride-rich solutions, promptly correcting metabolic acidosis, and cautiously using nephrotoxic medications. Third, integrating dynamic electrolyte information into predictive models may help improve the accuracy of clinical outcome prediction. However, it should be noted that the subtypes identified in this study were derived from retrospective analyses, and their real-time identification in clinical practice remains challenging. Future studies could explore simplified classification models based on key electrolyte features within early time windows (e.g., preoperative and 24–48 h postoperative), thereby enabling prospective subtype classification and improving clinical applicability. The strengths of this study include the use of a large, real-world dataset from the MIMIC-IV database, which enhances the generalizability of the findings. In addition, advanced statistical approaches such as GBMTM were applied to robustly identify data-driven phenotypes. Extensive covariate adjustments further ensured the reliability of the core associations. Nonetheless, several limitations should be noted. First, as a retrospective observational study, residual confounding cannot be fully excluded despite extensive adjustments, and the causal mechanisms linking electrolyte trajectories to LOS remain to be elucidated. Second, the identified subtypes rely on complete longitudinal trajectories, and the feasibility of real-time classification in clinical settings has not yet been validated, which limits their direct application in perioperative decision-making. Future research should adopt prospective designs incorporating real-time electrolyte monitoring to determine the time points at which reliable classification can be achieved and to develop simplified predictive tools for clinical use. Additionally, due to limitations of the MIMIC-IV database, the precise timing of laboratory measurements relative to surgery was not consistently available. Finally, the study population was derived from a single center, which may limit the generalizability of our findings; external validation in multi-center, multi-ethnic cohorts is warranted. Conclusions In summary, this study is the first to characterize and preliminarily evaluate the close association between electrolyte trajectory subtypes and LOS in patients with prostate cancer within the MIMIC-IV cohort. The four subphenotypes represent distinct patient profiles ranging from low risk (Cluster 2) to high risk (Cluster 4) groups, highlighting the potential importance of electrolyte homeostasis in perioperative prognosis. These findings suggest patterns that may inform patient stratification and perioperative management, while their applicability beyond ICU settings requires further investigation. This study contributes to understanding patient heterogeneity in prostate cancer but also provides potential directions for individualized management and optimization of perioperative treatment. Future studies should further validate these results in broader populations and explore targeted interventions for high-risk subtypes to improve postoperative recovery and long-term outcomes. Supplementary The article’s supplementary files as Available at https://tau.amegroups.com/article/view/10.21037/tau-2026-1-0060/prf