# Is censoring data necessary to calculate the hazard ratio between 2 KM curves?

I would like to know if censoring data is necessary to calculate the hazard ratio between 2 Kaplan Meier (KM) curves.

Censoring data is typically represented by small vertical bars atop of the curve on KM graphs.

Censoring data has an impact on the shape of a KM curve already (for instance, if 98/100 people drop from a trial, and 1 person dies, the curve goes down much more than if no one had dropped out). This makes me think that the curves are perhaps enough for calculating hazard ratios (since I understand hazard rates are akin to the slope of the curves). Is this true?

I am asking a practical question: Is having the values of survival curves over time, without the censoring information, enough to estimate the hazard ratio between these curves?

Context: I am right now digitizing KM curves. I would like to estimate the hazard ratio between them. I cannot retrieve the censoring data. Not having the censoring data is a limitation to my analysis, I know. But I would like to know: Can I nonetheless calculate the hazard ratio? Can I calculate a confidence interval for this hazard ratio?

Ideally, please let me know how the answer differs depending on whether or not we assume relative hazards between the 2 groups are constant across time.

You need to distinguish between the data analysis and the data display.

As you note, the Kaplan-Meier curves directly take censoring into account:

if 98/100 people drop from a trial, and 1 person dies, the curve goes down much more than if no one had dropped out.

That means that you need to include censored cases in the analysis. You can't just throw away the censored cases.

You don't necessarily need to display the censored cases on the curves, typically done with short vertical bars at censoring times. I think that most readers would like to see those, however, as it provides information about the distribution of censoring times versus the distribution of event times. That information helps the reader gauge the reliability of the analysis, and I urge you to show them for situations where there are moderate numbers of cases.

For Kaplan-Meier analysis, you need to be careful when you say:

hazard rates are akin to the slope of the curves.

A Kaplan-Meier curve has 0 slope between events and an infinitely steep slope at event times. For such curves, the instantaneous hazard is the probability of having an event given that there has been survival up to that time. So the hazard is 0 between event times and proportional to the magnitude of the drop at event times.

The log-rank test can determine whether 2 Kaplan-Meier curves differ significantly. As that Wikipedia reference notes, for 2 groups that test is equivalent to the score test in a Cox survival regression.

You also have to be careful in moving from a difference between 2 Kaplan-Meier curves to statements about hazard ratios, as estimated by Cox regressions. Unless the relative hazards between the 2 groups are constant across time (proportional hazards, PH, assumption), a hazard ratio between the 2 groups is at best difficult to interpret. Unless PH holds, there is no constant hazard ratio between the groups over time. With non-zero hazards only at event times in Kaplan-Meier or Cox models, it's even hard to gauge relative hazards between groups as a function of time. Parametric survival functions would better allow for comparing continuous hazard ratios as a function of time.

• Thanks for this answer @EdM. It made me realise that my question wasn't specific enough, so I rephrase: Is having the values of survival curves over time, without the censoring information, enough to estimate the hazard ratio between these curves? – hartmut Jan 16 at 22:49

Yes, you would need to know the time of each event, the number of events at each time, and the number at risk at each time there was an event. There is not enough information on the figures to determine exactly how many subjects were at risk in both groups at each time there was an event- unless the figure actually shows the time of censoring using circles or some symbol. Otherwise, no matter how accurate the software is, you will not be able to know how many were at risk at each time.

Example, where there is a jump in the Kaplan-Meier curve, using the product-limit estimator if the software is accurate enough, it is possible to work backwards to figure out the ratio of {# events}/{# at risk}. That part is fine and since you know approximately how many are at risk and assuming # events is a small number, it will be possible to pinpoint exactly # at risk and # events. However, what if it is a time point where there is an event in the other group only? Suppose there is an event in group A at time 100. There is no event in group B at that time. But, it is known that at time 95 there were 1000 patient at risk in group B and at time 105 there were 950 patients at risk (no events occurred between time 95 and 105). You only know that at time 100 there was some number between 950 and 1000 at risk in group B. It is impossible to identify any more information from the graph no matter how precise the graph was drawn and no matter how good the software is. The information is simply not on the graph.

Of course, you could just assume it is half way in between 950 and 1000 (i.e. 975 patients at risk at time 100) and you could similarly use interpolation at all the time points like that (assume the number at risk goes down linearly between the two time points where you know the numbers at risk).

In practice, the software I have seen does not even try to help you to guess how many are at risk and how many events occur at each time point, it simply estimates the x and y values at different points on the graph.

The KM-estimate is:

$$S(t_2) = P(T>t_2) = P(T>t_2|T>t_1)P(T>t_1) \\ = P(T>t_2|T>t_1)S(t_1)$$

with $$P(T>t_2|T>t_1)$$ estimated as $$P(T>t_2|T>t_1) = 1-\frac{\mathrm{number \ of \ events}}{\mathrm{number \ at \ risk}}$$

If you can accurately measure $$S(t_1)$$ and $$S(t_2)$$ based on the graphs, you can reproduce the number at risk at each event-time.

$$1-\frac{\mathrm{number \ of \ events}}{\mathrm{number \ at \ risk}} = P(T>t_2|T>t_1) \\ = \frac{S(t_2)}{S(t_1)}$$

Of course, if $$N_E$$ and $$N_R$$ satisfy a drop from $$S(t_1)$$ to $$S(t_2)$$, then $$2N_E$$ in combination with $$2N_R$$ does so as well. Additional info on the order of magnitude of $$N_R$$ (and realizing that $$N_E$$ and $$N_R$$ are integers) is a great help.

As long as the resolution is good enough to accurately measure the survival probabilities and make the distinction between 1, 2 or more simulatious events (with many people at risk, the drop in S(t) from 1 event may only be 0.1 %, which will difficult to distinguish from a drop of 0.2 % due to 2 simultaneous events), you can do the reverse calculation. From the numbers at risk at $$t_1$$ and $$t_2$$, you can deduce the number of censored between these times.

So yes, you can (approximately) recreate the numbers at risk and number of events at each timepoint, but (as pointed out by John L.) only within the arm where the event takes place. So if you have event times $$t_1$$, $$t_2$$ and $$t_3$$ with events in group A, B and A again, you can recreate the number at risk in group A at times $$t_1$$ and $$t_3$$ but not at $$t_2$$. In the same way, you can recreate the number at risk in group B for time $$t_2$$ but not at times $$t_1$$ and $$t_3$$.