'Python CoxPHFitter to extract hazard ratio and confidence intervals

I am new to survival analysis and I have been reading many research paper where the authors report adjusted (age and gender) and unadjusted hazard ratios along with confidence intervals. I am currently using CoxPHFitter from lifelines python package but I am unable to extract hazard ratios. I have followed many links e.g. https://databricks.com/notebooks/survival_analysis/survival_analysis_03_modeling_hazards.html and https://towardsdatascience.com/survival-analysis-part-a-70213df21c2e but none of them give any details on how to extract hazard ratio along with confidence intervals for adjusted or unadjusted cox regression. Using the "baseline_hazard" does give hazard ratio for the intervals but no confidence interval (I am not sure whether this is the right variable to look at) The "confidence_intervals" provides the confidence intervals of the covariates but I am looking for hazard ratio of the fitted model. Can anyone please help me with this? I am new to this analysis



Solution 1:[1]

The hazard ratios (labelled exp(coef)) and confidence intervals are available in the cph.summary, and in a prettier format with cph.print_summary().

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1