I was told, that the Cox with a single categorical covariate is equal to the Kaplan-Meier stratified by the levels of this covariate. But the two graphs below don't support it. I also use strata() in Cox model and got a very similar curve to Kaplan-Meier, however slightly differing.
So, assuming I draw Kaplan-Meier for 2 curves, how can I take HR from Cox for them, if the shapes are so different? Is there, indeed, a need for stratification rather than including the covariate?
This is done in R, but I believe the problem is in the statistical explanation.
- Kaplan-Meier
plot(survfit(Surv(time = futime, event = fustat) ~ rx, data = ovarian))
grid()
With strata(rx) I get exactly the same. OK.
- Now I fit Cox with strata(rx):
m <- coxph(Surv(futime, fustat) ~ strata(rx), data = ovarian)
plot(survfit(m))
grid()
- Now I fit Cox with covariate
m <- coxph(Surv(futime, fustat) ~ rx, data = ovarian)
d <- data.frame(rx = c(1, 2))
plot(survfit(m, newdata = d))
grid()
And this is completely different. I overlaid them:
Why do I get so different results, and even Cox with strata != Kaplan-Meier exactly?
How do I get the HR for the Kaplan-Meier, if Cox with strata (closest to it, not exactly) DOES NOT estimate it?
EDIT: OK, it seems that if I want to compare cures, it cannot not be stratified, so I should plot the KM directly from the Cox with the covariate.