View the fully rendered Jupyter Notebook
This project develops a transparent causal-inference workflow for estimating the effect of early right heart catheterization (RHC) on 30-day mortality among critically ill patients using observational clinical data.
The analysis emphasizes careful causal-question definition, transparent preprocessing, baseline-confounder assessment, propensity-score modeling, overlap diagnostics, stabilized inverse-probability-of-treatment weighting, covariate-balance assessment, doubly robust estimation, bootstrap confidence intervals, and sensitivity analysis.
The objective is not merely to compare observed mortality rates. The objective is to estimate a clinically meaningful treatment effect while documenting the assumptions and limitations of observational causal inference.
The project uses the publicly available Right Heart Catheterization (RHC) dataset.
The analytical sample contains:
- 5,735 critically ill patients
- 2,184 patients receiving early RHC
- 3,551 patients not receiving early RHC
- 30-day mortality as the primary outcome
The treatment indicator represents early RHC during the initial period of intensive-care treatment.
Among critically ill patients, what is the estimated effect of early right heart catheterization on 30-day mortality after accounting for measured baseline differences between treated and untreated patients?
The primary estimand is the Average Treatment Effect (ATE).
The ATE represents the estimated difference in 30-day mortality if the study population were treated with early RHC compared with the estimated mortality if the same population were not treated, under the assumptions required for observational causal inference.
The workflow includes:
- Causal-question and estimand definition
- Data loading and initial audit
- Transparent preprocessing of unusual baseline values
- Baseline-confounder specification
- Explicit categorical encoding
- Unadjusted covariate-balance assessment
- Propensity-score estimation
- Propensity-score overlap assessment
- Stabilized ATE weighting
- Weight diagnostics and effective-sample-size calculation
- Post-weighting covariate-balance assessment
- Primary stabilized-IPTW treatment-effect estimation
- Bootstrap confidence intervals with propensity-score re-estimation
- Doubly robust AIPW estimation
- Truncated-weight sensitivity analysis
- Empirical common-support restriction
- Publication-style figures and cautious interpretation
| Treatment group | Patients | Observed 30-day mortality |
|---|---|---|
| No RHC | 3,551 | 30.64% |
| RHC | 2,184 | 38.00% |
The unadjusted mortality difference was +7.36 percentage points.
This descriptive comparison should not be interpreted as a causal estimate because the treatment groups differed substantially in baseline clinical characteristics.
Before adjustment:
| Diagnostic | Result |
|---|---|
| Encoded baseline predictors assessed | 71 |
| Predictors with absolute SMD >= 0.10 | 35 |
| Predictors with absolute SMD >= 0.20 | 16 |
| Maximum absolute SMD | 0.501 |
The strongest initial imbalances involved illness severity, blood pressure, oxygenation, diagnosis categories, organ-system indicators, and laboratory values.
The estimated propensity-score range was inspected before weighting.
| Diagnostic | Result |
|---|---|
| Empirical common-support range | 0.0226 to 0.9751 |
| Patients outside empirical common support | 96 |
| Patients below propensity score 0.05 | 355 |
| Patients above propensity score 0.95 | 16 |
The treatment groups showed meaningful overall overlap, with limited concerns in the distribution tails.
| Diagnostic | Result |
|---|---|
| Mean stabilized weight | 0.9947 |
| Maximum stabilized weight | 24.9137 |
| Patients with stabilized weight above 5 | 33 |
| Patients with stabilized weight above 10 | 6 |
| Overall effective sample size | 3,295.3 |
After stabilized inverse-probability weighting:
| Diagnostic | Result |
|---|---|
| Predictors with absolute SMD >= 0.10 | 0 |
| Predictors with absolute SMD >= 0.20 | 0 |
| Maximum absolute SMD | 0.067 |
The weighting strategy substantially improved comparability between the RHC and No-RHC groups across the measured baseline covariates.
| Estimate | Result |
|---|---|
| Weighted mortality: No RHC | 31.20% |
| Weighted mortality: RHC | 37.25% |
| Adjusted ATE risk difference | +6.05 percentage points |
| 95% bootstrap CI | +2.72 to +9.04 percentage points |
| Adjusted risk ratio | 1.194 |
| 95% bootstrap CI | 1.084 to 1.300 |
After stabilized-IPTW adjustment, early RHC was associated with an estimated increase of 6.05 percentage points in 30-day mortality.
| Analytical approach | Estimated risk difference | 95% bootstrap CI |
|---|---|---|
| Primary stabilized IPTW | +6.05 percentage points | +2.72 to +9.04 |
| Doubly robust AIPW | +5.83 percentage points | +2.91 to +9.20 |
| Truncated-weight IPTW | +6.07 percentage points | +3.33 to +8.49 |
| Empirical common-support restriction | +6.03 percentage points | +2.66 to +9.56 |
The adjusted estimates were closely aligned across complementary analytical approaches.
This project demonstrates a transparent observational causal-inference workflow.
The findings remain dependent on important assumptions, including:
- adequate adjustment for measured confounders,
- meaningful positivity and overlap,
- appropriate model specification,
- consistency of the treatment definition,
- and the absence of important unmeasured confounding.
Propensity-score weighting and doubly robust estimation can reduce bias from measured confounding. They cannot eliminate bias from important unmeasured confounders.
The results should not be interpreted as:
- definitive proof of a clinical treatment effect,
- a clinical recommendation,
- evidence applicable automatically to all patient populations,
- or a substitute for randomized evidence and clinical expertise.
- Python
- pandas
- NumPy
- matplotlib
- scikit-learn
- Google Colab
Causal_Inference_RWE_Python.ipynb
propensity_score_overlap_before_weighting.pnglove_plot_covariate_balance_before_after_weighting.pngtreatment_effect_comparison_risk_difference.pngmortality_comparison_across_estimators.pngadjusted_treatment_effect_robustness_analysis.png
repository_file_inventory.csvkey_project_findings_summary.csvcovariate_balance_before_after_weighting.csvprimary_iptw_treatment_effect_point_estimates.csvprimary_iptw_bootstrap_confidence_intervals.csvcausal_estimator_comparison.csvaipw_bootstrap_confidence_intervals.csvweight_truncation_sensitivity_summary.csvtruncated_weight_bootstrap_confidence_intervals.csvcommon_support_sensitivity_summary.csvcommon_support_bootstrap_confidence_intervals.csvconsolidated_causal_sensitivity_analysis_summary.csvtreatment_effect_comparison_risk_difference.csvmortality_comparison_across_estimators.csvadjusted_treatment_effect_robustness_analysis.csv
This project supports the following professional positioning:
PhD Statistical Consultant | Advanced Quantitative Modeling (R, Mplus, Python)
The project demonstrates applied capability in causal inference for observational clinical and real-world evidence data, propensity-score methods, doubly robust estimation, bootstrap uncertainty analysis, sensitivity analysis, transparent reporting, and reproducible statistical computing in Python.
Professional website: https://drimransarmad.com




