I am doing survival analysis on some continuous variables and am finding that some of my plots are difficult to interpret because there are too many lines. Here is an example: Example Cox Curve

I am interested in making complex curves like these more interpretable. I guess it might be possible to improve things with some graphical tweaks and I welcome any suggestions for how to do so in R (I am using packages ggplot2, GGally and survival). But I think what I really need to do to improve interpretability is reduce the number of lines shown on the plot by binning the continuous variable. I am asking the community for guidance about how and at what point should such binning occur?

Without knowing any better approach, my binning method would simply be to divide the variable into three categories:

  • 0
  • less-than-median
  • greater-than-median

with the median being computed after removing the 0 values. This method makes intuitive sense to me but I don't have any mathematical justification for it nor have I been able to find any examples of people doing something similar in survival analysis. If there's something problematic about it or if there's a better way, please let me know, but I am ultimately much less comfortable with the question of when to bin.

As for when the binning should occur, I am reluctant to bin the continuous variable before computing the Cox PH values because I think this could have a major impact the p-value and because my only rationale for binning this way is that I expect it will make my graphs easier to interpret. But if I bin the continuous variable after computing the Cox PH, I worry that that I'll be misrepresenting the data since the p-value will have been based on values which are masked by the binning.

Apologies if this is a common/simple/already-answered question. I am pretty new to data science and have not had much formal training (and none at all relating to survival analysis),


1 Answer 1


You need to think differently about the Cox PH analysis itself and the way that you display the data.

Keeping the variable as continuous in the Cox PH analysis itself is important, as you recognize. That forms the basis of statistical significance, hazard ratios and their confidence intervals, and so forth.

That, however, is no reason to avoid showing survival plots for binned values of the continuous variable. Your claim of statistical significance is not based on the plots, it's based on the Cox PH analysis. The survival curves are just a convenient way to show the audience how much survival may vary over the range of the variable. The choice of number of bins to use is pretty much up to you; you don't want so many lines as to confuse the reader. You should include similar numbers of cases in each bin.

This also can be a useful tool for checking your model. I once found a "significant" relation for a continuous variable, but when I looked at plots over binned ranges it was clear that the influence of the variable on outcome hit a maximum well below the top of its range.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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