I know, that the median survival time calculated from the Kaplan-Meier estimator is equal to the "naive" descriptive median of the survival time when no censoring in data occurs.

Does it apply also to the other quantiles, like the 3rd quantile? Is this possible that they differ, if no censoring occurs and all subjects experience the event?

> quantile(d$time)
     0%     25%     50%     75%    100% 
 2.5000  3.1375  4.3050 11.3700 71.4200 

> km  <- survfit( Surv(time, event) ~ 1, data = d, conf.type = "log-log")
> quantile(km)
    25     50     75 
 3.120  4.305 12.140 

No censoring:

> d %>% count(event)
  event  n
1     1 86

EDIT: OK, got it, thanks to @Frank Harrell

I should use the empirical CDF with averaging at discontinuities:

> quantile(km)$quantile
    25     50     75 
 3.120  4.305 12.140 

> quantile(d$time, type=2)
    0%    25%    50%    75%   100% 
 2.500  3.120  4.305 12.140 71.420 

1 Answer 1


There are multiple definitions of sample (and population, in case of discreteness) quantiles. If you use the empirical cumulative distribution function definition (which is not a weighted average of two estimates) this agrees fully with Kaplan-Meier under no censoring, because K-M is precisely one minus the empirical cumulative distribution function. Note that sample quantiles are noisy estimates --- even more so with censoring which lowers the effective sample size.

  • $\begingroup$ Thank you. Now it all agrees. But please, tell me, when I report the survival data with no censoring, and use R, which by default uses type 7 (or SAS, uses type 3), should I always report the type 1 instead? Or report the one from the survival estimator? Because now I have two set of numbers, describing the same, but not exactly the same. This confuses my readers... Should I always report the type 1 (empirical CDF) quantiles instead of the default type 7? $\endgroup$ Apr 11, 2022 at 14:24
  • $\begingroup$ I'm sorry, it's type 2, with averaging at discontinuities. This is not taught in typical textbooks to use type 2 quantile, most of my colleagues don't even know it exists. And we get discrepancies with Kaplan-Meier. Should we always summarize our data with type 2? So why R by default uses type 7? $\endgroup$ Apr 11, 2022 at 14:30
  • $\begingroup$ Use empirical CDF if you wish to compare to Kaplan-Meier. $\endgroup$ Apr 12, 2022 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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