I'm new to survival analysis and will apperciate your help regarding predictions after Cox regression.

I'm running a cox model (using stata's -stcox-) in which I examine the effect of a continuous independent variable (ranges from 0 to 1) on the hazard to commit crime. The coefficient I get for this variable makes sense. Then, I want to get predictions based on this variables. Essentiely, what I want is the predict risk to commit crime for different values of the independent variable (Is this possible?).

To this end, I used the margins command, i.e.:

margins, at(indep_var=(0(0.2)1)) atmeans

However, I struggle to understand what the values I get represent. For example, what does it mean if I get a value of 0.75, or 1.23? I don't believe it represents the hazard to commit crime. Is there any way to get what I'm looking for?



1 Answer 1


A Cox model returns hazard ratios, not absolute hazards. Although that's inherent in the nature of a Cox model, it can lead to a lot of confusion. A hazard ratio must be expressed between two conditions.

Although I don't use Stata, its manual on Cox models seems to suggest that the default outcome from the margins command is in the hazard ratio scale. That presumably is the hazard ratio with respect to whatever the stcox routine chose as the reference set of predictor-variable values. That's another source of confusion with Cox models, as different software routines make different choices about the reference condition, choices which don't always make a lot of sense. You will have to read the Stata documentation to know what reference-condition choice stcox makes.

A more useful display might be to plot a set of estimated survival curves over time at your chosen values of the continuous predictor, at some representative combination of values of the other predictors.

  • $\begingroup$ Thanks @EdM. I will look into that. Following your answer, is it even possible to somehow get absolute hazards? $\endgroup$
    – Eran
    Nov 13, 2023 at 13:07
  • $\begingroup$ @Eran Remember that a standard survival model assumes that all individuals eventually experience the event; the question is risk at any given time. Absolute hazards (failure rates) change over time, except for simple exponential models. A Cox model assumes that the basic form of the baseline hazard is the same for all individuals, with hazard ratios providing a useful summary of differences associated with treatments, clinical characteristics, etc. For a Cox model the absolute hazard is exactly 0 between event times. $\endgroup$
    – EdM
    Nov 13, 2023 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.