Closed DaniBre99 closed 1 year ago
Hi @DaniBre99, like you want to implement your own hazard function? Something like this?
Hi @CamDavidsonPilon! Thanks a lot for the answer! I'm doing a survival analysis with KaplanMeierFitter (lifelines) and I'd like to add a graph like this:
https://bookdown.org/rwnahhas/RMPH/survival-hazard.html
Or like this:
https://stats.oarc.ucla.edu/sas/seminars/sas-survival/
(chapter: 1.2.4. Background: The hazard function)
In python I can manually calculate the hazard ratio like this:
https://allendowney.github.io/SurvivalAnalysisPython/02_kaplan_meier.html
(chapter: Estimating the hazard function)
I was wondering if these calculations to find the hazard ratio were already included in the lifelines library or if it was possible to insert them and then create the graph. I saw the link you kindly sent me, maybe are they the same in the ThreeParamInverseTimeHazardFitter() function? I don't understand very well how this function works.
Thank you very much!
I see. So the Kaplan Meier Fitter would be the wrong tool, since it's purpose is to estimate the survival curve. I would suggest using the Nelson-Aalen model to get hazard rates. See these two sections: https://lifelines.readthedocs.io/en/latest/Survival%20analysis%20with%20lifelines.html#estimating-hazard-rates-using-nelson-aalen
and specifically: https://lifelines.readthedocs.io/en/latest/Survival%20analysis%20with%20lifelines.html#smoothing-the-hazard-function
Thank you very much!!
Hi! Is possible to implement Hazard Function in python with lifelines like in R and SAS languages? Thanks