# Kaplan-Meier curves seem to say otherwise than the Cox regression

In R, I am doing survival data analysis of cancer patients.

I have been reading very helpful stuff about survival analysis in CrossValidated and other places and think I understood how to interpret the Cox regression results. However, one result still bugs me...

I am comparing survival vs. gender. The Kaplan-Meier curves are in clear favour of female patients (I have checked several times that the legend I have added is correct, the patient with the maximum survival, 4856 days, is indeed a woman): And the Cox regression is returning:

Call:
coxph(formula = survival ~ gender, data = Clinical)

n= 348, number of events= 154

coef exp(coef) se(coef)      z Pr(>|z|)
gendermale -0.3707    0.6903   0.1758 -2.109    0.035 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

exp(coef) exp(-coef) lower .95 upper .95
gendermale    0.6903      1.449    0.4891    0.9742

Concordance= 0.555  (se = 0.019 )
Rsquare= 0.012   (max possible= 0.989 )
Likelihood ratio test= 4.23  on 1 df,   p=0.03982
Wald test            = 4.45  on 1 df,   p=0.03499
Score (logrank) test = 4.5  on 1 df,   p=0.03396


So Hazards Ratio (HR) for male patients (gendermale) is 0.6903. The way I would interpret that (without looking at the Kaplan-Meier curve) is: as the HR is <1, being a patient of male gender is protective. Or more precisely, a female patient is 1/0.6903 = exp(-coef) = 1.449 more likely to die at any specific time than a male.

But that does not seem like what the Kaplan-Meier curves say! What's wrong with my interpretation?

• From your K-M curve, it seems PH assumption of Cox regression is not hold. Jun 15, 2017 at 8:32
• I see. I haven't look into that before! Graphically, it means my Kaplan-Meier curves should be parallel so I can safely use Cox, right? That seems more or less OK before ~2200 days. Is it alright to have a look at the Cox results for all data a bit before the intersection? Jun 15, 2017 at 8:41
• NB It's the curves $\log -\log \hat S_i(t)$, where $\hat S_i(t)$ is the estimated survival function for group $i$, that should be parallel under proportional hazards. As @IWS points out, the confidence intervals will be very wide for the female group after about 3000 days (are there only two making it past that point?) so the PH assumption may not be too bad. Jun 15, 2017 at 9:09
• @DeepNorth: I don't really see strong evidence against proportional hazards. Yeah the curves technically overlap...but that's on the extreme tails. Jun 15, 2017 at 14:56
• To complement the other answers and comments, compare the median survival or five year survival for males and for females. There is a clear benefit for males in this data in agreement with the Cox PH analysis. Jun 20, 2017 at 7:29

This is a very good example of non-proportional hazards OR the effect of 'depletion' in survival analysis. I will try to explain.

At first take a good look at your Kaplan-Meier (KM) curve: you can see in the first part (until around 3000 days) the proportion of males still alive in the population at risk at time t is larger than the proportion of females (i.e. the blue line is 'higher' than the red one). This means that indeed male gender is 'protective' for the event (death) studied. Accordingly the hazard ratio should be between 0 and 1 (and the coefficient should be negative).

However, after day 3000, the red line is higher! This would indeed suggest the opposite. Based on this KM graph alone, this would further suggest a non-proportional hazard. In this case 'non-proportional' means that the effect of your independent variable (gender) is not constant over time. In other words, the hazard ratio is viable to change as time progresses. As explained above, this seems the case. The regular proportional hazard Cox model does not accommodate such effects. Actually, one of the main assumptions is that the hazards are proportional! Now you can actually model non-proportional hazards as well, but that is beyond the scope of this answer.

There is one additional comment to make: this difference could be due to the true hazards being non-proportional or the fact that there is a lot of variance in the tail estimates of the KM curves. Note that at this point in time the total group of 348 patients will have declined to a very small population still at risk. As you can see, both gender groups have patients experiencing the event and patients being censored (the vertical lines). As the population at risk declines, the survival estimates will become less certain. If you would have plotted 95% confidence intervals around the KM lines, you would see the width of the confidence interval increasing. This is important for the estimation of hazards as well. Put simply, as the population at risk and amount of events in the final period of your study is low, this period will contribute less to the estimates in your initial cox model.

Finally, this would explain why the hazard (assumed constant over time) is more in line with the first part of your KM, instead of the final endpoint.

EDIT: see @Scrotchi's spot-on comment to the original question: As stated, the effect of low numbers in the final period of the study is that the estimates of the hazards at those points in time are uncertain. Consequently you are also less certain whether the apparent violation of the proportional hazards assumption isn't due to chance. As @ scrotchi's states, the PH assumption may not be that bad.

• (-1) The tails cross on the extreme ends, where we have extremely little data. In fact, the evidence for "non-proportional hazards" is based on only two observations (i.e. when t >2800, there were only two subjects left in the female cohort, and besides that, the last event before that in the group was around t = 2100) Jun 15, 2017 at 15:01
• @CliffAB Thanks for the feedback Cliff AB. I am a bit confused though, as your remark is exactly what I was trying to say. I'll admit: it could have been a little shorter. The -1 is a tad bit harsh though :'(
– IWS
Jun 15, 2017 at 19:09
• perhaps it was a bit mean of me. My only point is that when I look at this, I don't see necessarily a good example of non proportional hazards, but rather little data on the tails. I see the first sentence has been revised (I think unless I missed this the first time?) to address though, so now the (-1) is definitely uncalled for. Jun 16, 2017 at 17:49
• Oops, it appears I did miss it the first time. Sorry! Jun 16, 2017 at 17:52
• No problem, at leest we agree on the answer :D
– IWS
Jun 16, 2017 at 20:21

You are confused as to the nature of your output. These data say: If you are a male you are more likely to live longer than a female; Females have WORSE survival than males. This is reflected in the regression output as the effect for being MALE is to have a negative log hazard ratio, e.g. males have lower risk than females. At most event times (when the curves "step"), the male survival curve is greater than that of the females, the Cox model results and graph agree very well. The KM curves confirm this as do the regression model output. The "cross" is an inconsequential one.

KM curves behave poorly in the tails, especially when they near 0% and/or taper off flatly. The Y-axis is the proportion surviving. With relatively few who survive long into the study, and few who die at that time, the reliability of the estimates is intuitively and graphically terrible. I note, for instance, there are visibly fewer females in your cohort than males and that after 2,800 days, there are less than 10 females remaining in the cohort, as evidenced by the steps in the survival curve and lack of censored events.

As an interesting note, because survival analyses using KM curves, log rank tests, and Cox models use ranked survival time, the actual duration of survival is somewhat irrelevant. Your longest surviving female could, infact, have survived for another 100 years and it would have no impact on the analyses. This is because the baseline hazard function (not having observed any events for the past 13 years) would assume there was no risk of death for those next 87 years since nobody died then.

If you want a robust HR to obtain correct 95% CIs and p-values for this, specify robust=TRUE in the Cox-PH to obtain sandwich standard errors. In that case, the HR is a time-averaged HR comparing males to females at all failure times.

• To clarify: In the KM plot, males have better survival up to about 2700 days. After that, women have better survival. But that tail isn't precise because there is so little data out there. You can see that two steps in the KM curve take female survival from about 35% to 0%, so that is most likely two people.It would be helpful to plot the KM curves with confidence bands. Then I'd guess that you'd see clear separation up to about 2000 days, and then overlap after that. Jun 21, 2017 at 15:34
• @HarveyMotulsky true but the tails of KMs are very unreliable . If OP drew the CIs they would overlap strongly, so that inferentially we would say that the survival was probably equivocal after 2,700 days. Jun 21, 2017 at 16:46
• Exactly my point. The data clearly show that males (in this situation, whatever it is) have better survival at least for the first 2000+ days. Jun 21, 2017 at 16:51