# Why are the survival curves different for the Kaplan Meier method and cox regression for the same categorical variable?

I have 1 categorical variable called group (1 = treatment, 2 = placebo). If I create the survival curves with the Kaplan Meier method in SPSS I see that the survival is better for the treatment group compared to the placebo group. The survival curves are also significantly different according to the log-rank test.

When I do cox regression with the same variable (without adding other variables) the hazard ratio is significant as well and has a value below 1 (comparing treatment group to placebo group), indicating that the treatment group is associated with decreased hazard. So this is all as expected.

I can also create survival curves during the cox regression in SPSS. I can then seperate the lines for the group variable. However, these survival curves look different than the survival curves of the Kaplan Meier. How is this possible? Also the amount of vertical drops in the curve (which indicates that a patient has died) is also different between the cox regression and kaplan meier survival curves...The amount of vertical drops are somehow similar for the survival curves of the treatment group and placebo group in the cox regression...

Is the interpretation of the survival curves different for the cox regression than for the Kaplan Meier method? Is a vertical drop not a patient that died in cox regression? And how are the survival curves different for the cox regression and kaplan meier when I have the same variable and are comparing the same groups? Is this because the survival probability is calculated in another way?

I hope you can help we further and explain it in an easy way.

Thanks a lot for your help in advance!

## 2 Answers

It sounds like you have plotted the Kaplan-Meier estimate for each group separately. The Kaplan-Meier survival estimate at time t (probability of surviving until at least time t) is given by $$\hat{S}\left(t\right) = \prod_{i: \, t_i \leq t}\left(1 - \frac{d_i}{n_i} \right)$$ That is to say the decrease in the survival curve is simply given by the number of people who died in the group at the ith event time, divided by the number still alive in the group before the ith event time.

For the Cox regression method, the hazard function (probability of dying in a small time interval given you survived until the start of the interval, divided by the length of the interval), is given by $$\lambda\left(t | X \right) = \lambda_0\left(t\right) e^{X \beta}$$ where X is the indicator for being in the treatment group (1 if treatment, 0 if control), and $$\lambda_0$$ is the baseline hazard across the two groups. So note the hazard at any given time is proportional between the two groups - it differs only by a time-independent constant $$e^{X \beta}$$. This is why the jump sizes have to be the same between the two groups. It also allows us to have a nice interpretation for $$e^{X \beta}$$ as the multiplicative increase (or decrease) in hazard due to receiving the treatment.

And the fact that the jump sizes are forced to be the same in the Cox model (which they aren't in the KM estimate), is why the survival curves look different. (Note the survival curve is a function of the hazard, so forcing jumps in the hazard to proportional has the same effect on the survival curve).

As you found, with the situation you describe (a single binary predictor distinguishing 2 groups) the log-rank test for the Kaplan-Meier curves and the score test for the Cox regression will give the same result, as they end up being the same test. There's an important distinction, however, between the Kaplan-Meier and Cox approaches in terms of how survival curves are estimated.

The Kaplan-Meier method estimates the survival curves separately, and empirically, for each group. Thus the 2 curves can have different shapes. In particular, there will be a drop in survival curve for a group only at event times within that group. The depth of each drop will depend on the number of cases still at risk in that group at that time.

The Cox regression model, in contrast, forces the survival curves for the two curves to have the same overall shape, with the hazard ratio constant across all time. The overall hazard ratio is an average over the estimates at all the event times for both groups.

Then with a Cox model, to get the separate survival curves, you start with the overall cumulative baseline hazard over time, estimated by pooling information from both groups. At each event time from either group, in one standard approach you increase the cumulative baseline hazard by the ratio of the number of events at that time to the hazard ratio-weighted number of cases still at risk. If $$\Lambda(t)$$ is the baseline cumulative hazard over time, then the baseline survival curve is $$S(t)=\exp(-\Lambda(t))$$.

As the baseline hazard estimated from the Cox model combines information from both groups, the baseline survival curve will have drops at all event times regardless of which group had an event at that time. With 2 groups, the baseline survival curve will be that for the reference group. For the non-reference group, the survival drop at each event time is set to be proportionate to the estimated overall hazard ratio.

Thus you should expect the Kaplan-Meier and Cox-model survival curves to look different in general. Kaplan-Meier curves will have drops only at event times within the corresponding groups, and shapes can differ between groups. Survival curves from Cox models will have drops at all event times regardless of group, and the shapes of the survival curves for the groups are the same. At each event time in an estimate from a Cox model, the relative depth of the drops in the 2 curves will be the same, related to the overall hazard ratio.