Is there a way to calculate Hazard Ratios in Python's Lifeline package relative to a specified group?
What I have at the moment is:
from lifelines import CoxPHFitter
data=KM_DF[["Survival_Time","Event","30_40","40_50","50_60","60_70","70_80","Male"]]
cph=CoxPHFitter()
cph.fit(data,"Survival_Time",event_col="Event",show_progress=True)
cph.print_summary()
I would like to know the HR of the 40_50, 50_60, 60_70, and 70_80 group relative to the 30_40 group while also adjusting for sex. But at the moment, I get a HR of the group I want to be the reference ("30-40") as 3.02.
Is there a way to do this with lifelines?
For greater context/motivation, in R's workflow for Cox Proportional Hazard Ratio calculations, one can set variable "levels", and the subsequent Hazard Ratios are relative to the 1st level. However, I have been unable to sort out if this is possible in the popular "Lifelines" Python package.