CamDavidsonPilon / lifelines

Survival analysis in Python
lifelines.readthedocs.org
MIT License
2.37k stars 560 forks source link

Baseline hazard estimation in CoxTimeVaryingFitter #894

Open jingsliu07 opened 4 years ago

jingsliu07 commented 4 years ago

Dear authors, thanks for providing such useful package in python. I'm working with a dataset that has time-variant variables, and I'm wondering if there is any theoretical reason that the equivalent of _compute_baseline_hazard method isn't available in the CoxTimeVaryingFitter as in the basic CoxPhFitter? If not, how shall I go about generating the predicted survival rate with CoxTimeVaryingFitter over different time points?

(Interpretation-wise, I'm interested in predicting accuracy using what's known until now, so the knowledge that patient is still alive if there is a future update won't be used)

Thank you!

CamDavidsonPilon commented 4 years ago

Hi @jingsliu07, apologies for missing this. I'm not sure why we don't have _compute_baseline_hazard, but we do have _compute_baseline_cumulative_hazard - if you take the .diff of this, it will equal the baseline hazard.

Since you are working retrospectively, prediction will be easier for you, but unfortunately CoxTimeVaryingFitter doesn't have much support for even retrospective predictions.