Biostatistics & Causal Analysis

Survival analysis, Bayesian inference, and SHAP explainability

Survival Analysis

Kaplan-Meier curves and Cox proportional hazards for ICU length of stay

8.0
Median LOS (days)
7.63
Mean LOS (days)
5.0–11.0
IQR (days)
230
Encounters
0.7288
Cox C-Index
p=0.0000
Log-Rank Test
KM Curves by Risk Category
KM Curves by Sepsis Status
Cox PH Hazard Ratios
Cox Model Summary
CovariateHR95% CIp
age_at_encounter 1.012 1.0009–1.0233 0.0348 *
is_male 0.6965 0.4699–1.0324 0.0717
temperature_c 1.2283 1.0237–1.4739 0.0270 *
heart_rate_bpm 1.0037 0.9946–1.0129 0.4303
resp_rate_bpm 1.0097 0.9785–1.0419 0.5468
wbc_k_ul 0.9706 0.9234–1.0202 0.2406
lactate_mmol_l 1.2225 1.0812–1.3823 0.0013 **
systolic_bp_min 1.001 0.9944–1.0076 0.7638
sirs_count 1.7024 1.3194–2.1965 0.0000 ***
Log-likelihood ratio test: χ²=66.5913, p=0.0000, df=9
Pairwise Log-Rank Tests
High vs Low
χ²=16.8514, p=0.0000
High vs Low-Moderate
χ²=84.7898, p=0.0000
High vs Moderate
χ²=5.8583, p=0.0155
Low vs Low-Moderate
χ²=0.0, p=1.0000
Low vs Moderate
χ²=0.0, p=1.0000
Low-Moderate vs Moderate
χ²=0.0, p=1.0000

Bayesian Logistic Regression

Posterior distributions with clinically informative priors (PyMC / NUTS sampler)

Converged
MCMC Status
1.0
Max R-hat
1479
Min ESS
2×1000
Chains × Draws
Posterior Odds Ratios (95% CrI)
Probability of Positive Effect
Posterior Summary
FeaturePriorPost. MeanSD95% HDIOROR 95% CrIP(β>0)
temperature_c N(0.5, 1.0) -0.047 0.423 [-0.952, 0.741] 0.9541 [0.386, 2.098] 0.464
heart_rate_bpm N(0.3, 1.0) 0.379 0.678 [-0.948, 1.666] 1.4608 [0.3875, 5.291] 0.7075
resp_rate_bpm N(0.3, 1.0) 0.465 0.685 [-0.913, 1.789] 1.592 [0.4013, 5.9835] 0.7535
wbc_k_ul N(0.2, 1.0) -0.068 0.505 [-1.031, 0.956] 0.9343 [0.3567, 2.6013] 0.441
lactate_mmol_l N(0.8, 1.0) 0.603 0.74 [-0.757, 2.059] 1.8276 [0.4691, 7.8381] 0.7905
systolic_bp_min N(-0.3, 1.0) 0.872 0.328 [0.24, 1.548] 2.3917 [1.2712, 4.7021] 0.996
temp_severity N(0.5, 1.0) 0.832 0.483 [-0.198, 1.715] 2.2979 [0.8204, 5.5567] 0.96
hr_severity N(0.3, 1.0) 0.344 0.705 [-1.0, 1.696] 1.4106 [0.3679, 5.4521] 0.6725
rr_severity N(0.3, 1.0) 0.097 0.683 [-1.223, 1.42] 1.1019 [0.2943, 4.1371] 0.5635
wbc_severity N(0.2, 1.0) 0.32 0.493 [-0.692, 1.219] 1.3771 [0.5006, 3.3838] 0.735
lactate_severity N(0.8, 1.0) 0.583 0.721 [-0.893, 1.97] 1.7914 [0.4094, 7.1707] 0.798
sirs_score N(1.0, 1.5) 3.776 0.675 [2.419, 5.001] 43.6411 [11.2346, 148.5616] 1.0
organ_dysfunction_score N(1.0, 1.5) 2.92 0.545 [1.901, 3.963] 18.5413 [6.6926, 52.6149] 1.0
Prior Specifications & Rationale
temperature_c: Normal(0.5, 1.0)
Fever increases sepsis risk
heart_rate_bpm: Normal(0.3, 1.0)
Tachycardia is a SIRS criterion
resp_rate_bpm: Normal(0.3, 1.0)
Tachypnea is a SIRS criterion
wbc_k_ul: Normal(0.2, 1.0)
Leukocytosis/leukopenia indicate infection
lactate_mmol_l: Normal(0.8, 1.0)
Elevated lactate indicates organ dysfunction
systolic_bp_min: Normal(-0.3, 1.0)
Hypotension increases sepsis risk
temp_severity: Normal(0.5, 1.0)
Deviation from normal temperature
hr_severity: Normal(0.3, 1.0)
Heart rate severity score
rr_severity: Normal(0.3, 1.0)
Respiratory rate severity score
wbc_severity: Normal(0.2, 1.0)
WBC severity score
lactate_severity: Normal(0.8, 1.0)
Lactate severity score
sirs_score: Normal(1.0, 1.5)
Composite SIRS criteria count
organ_dysfunction_score: Normal(1.0, 1.5)
Organ dysfunction indicators

SHAP Explainability

SHapley Additive exPlanations — why the model flags each patient

SHAP Importance (Random Forest)
SHAP Importance (Logistic Regression)
SHAP Beeswarm (Random Forest)
SHAP Direction Summary
Most Impactful Predictions Explained
synth-encounter-000224 Sepsis
Total |SHAP| = 0.882
  • sirs_score: +0.128
  • lactate_mmol_l: -0.127
  • lactate_severity: -0.127
  • wbc_severity: +0.083
  • systolic_bp_min: +0.081
synth-encounter-000021 Sepsis
Total |SHAP| = 0.864
  • sirs_score: +0.121
  • lactate_mmol_l: -0.121
  • lactate_severity: -0.113
  • wbc_severity: +0.109
  • wbc_k_ul: +0.086
synth-encounter-000071 Sepsis
Total |SHAP| = 0.8347
  • lactate_severity: -0.123
  • lactate_mmol_l: -0.122
  • sirs_score: +0.115
  • wbc_k_ul: +0.067
  • wbc_severity: +0.065
synth-encounter-000032 Sepsis
Total |SHAP| = 0.8138
  • lactate_severity: -0.138
  • lactate_mmol_l: -0.135
  • sirs_score: +0.101
  • temp_severity: +0.098
  • systolic_bp_min: +0.076
synth-encounter-000226 Sepsis
Total |SHAP| = 0.8123
  • lactate_severity: -0.161
  • lactate_mmol_l: -0.161
  • sirs_score: +0.110
  • temp_severity: +0.065
  • organ_dysfunction_score: +0.056