lifelines icon indicating copy to clipboard operation
lifelines copied to clipboard

Are there some errors when compute baseline_hazard in cox model?

Open shiyadonggithub opened this issue 5 years ago • 1 comments

https://github.com/CamDavidsonPilon/lifelines/blob/519bd3abe6051bd9fb5da0dfffce24ab86171f3f/lifelines/fitters/coxph_fitter.py#L2171 In this function,we compute the baseline_hazard.and the comment indicates that the method is refer to https://stats.stackexchange.com/questions/46532/cox-baseline-hazard. but i found some bugs in the implement of the functiion. image I think code in 2179 lines should be ind_hazards_summed_over_durations["E"] / ind_hazards_summed_over_durations["P"][::-1], columns=[name]

shiyadonggithub avatar Oct 16 '20 12:10 shiyadonggithub

Hi @shiyadonggithub, can you explain why you think it should be that way? (Note that in a line above, I do reverse the order)

CamDavidsonPilon avatar Oct 16 '20 15:10 CamDavidsonPilon