havakv / pycox

Survival analysis with PyTorch
BSD 2-Clause "Simplified" License
828 stars 193 forks source link

Is there any method or way to get hazard ratio? #96

Open inticoy opened 3 years ago

inticoy commented 3 years ago

We are using Pycox - CoxPH Model to find out hazard ratio of each genetic mutations. So, we put presence of each genetic mutations as 1 or 0 in x, survival time and event in y.

We want to get hazard ratio of a particular genetic mutation. Is there any method or way to get it?

havakv commented 3 years ago

So, if you're using a non-linear model, I don't think you can get hazard ratios for a single covariate that easily. In regular Cox regression (corresponding to a linear function x'\beta) you're able to obtain the hazard ratio of a single covariate because all the other cancels out. For a non-linear model, you can get the hazard ratio at an individual level (for individual i, the hazard ratio of covariate x is ...).

One approach for obtaining the hazard ration for when using neural networks would be to compute the hazard ratio for each individual and average that over your whole dataset. I don't know if this is common practice though.

Does this answer your question?

srn284 commented 3 years ago

Continuing with this @havakv, for the logistic hazard /nnet survival, how would we get individual hazards? Thank you very much.

havakv commented 3 years ago

The LogisticHazard method should have a method called predict_hazard so you can use model.predict_hazard(x) to get the individual hazards.

srn284 commented 3 years ago

Sounds good thanks again!

francescamanni1989 commented 2 years ago

Is there a way to get hazard ratio with deephit single?

miniyoyo25 commented 2 years ago

Is there a way to get hazard ratio with deephit single?

Hi,I have the same question. Have you solved this yet? thank you so much.