Skip to contents

quantile() gives the time by which a given proportion of subjects have had the event, with confidence limits read from the confidence band. median() is the 0.5 quantile. A quantile is NA when the curve (or the band) never drops far enough.

Usage

# S3 method for class 'kaplan_meier'
quantile(x, probs = 0.5, ...)

# S3 method for class 'kaplan_meier'
median(x, na.rm = FALSE, ...)

Arguments

x

A kaplan_meier() fit.

probs

Proportions of subjects who have had the event, between 0 and 1.

...

Unused.

na.rm

Unused. Present for compatibility with the generic.

Value

A data frame with one row per group and probability: strata, the grouping variables, prob, time, conf_low, and conf_high. median() omits prob. The layout is the same for one curve as for several.

Examples

lung <- data.frame(
  time = c(306, 455, 1010, 210, 883, 1022, 310, 361, 218, 166),
  status = c(2, 2, 1, 2, 2, 1, 2, 2, 2, 2)
)
fit <- kaplan_meier(Surv(time, status) ~ 1, data = lung)
median(fit)
#>   strata time conf_low conf_high
#> 1    all  310      218        NA
quantile(fit, probs = c(0.25, 0.5, 0.75))
#>   strata prob time conf_low conf_high
#> 1    all 0.25  218      166       883
#> 2    all 0.50  310      218        NA
#> 3    all 0.75  883      361        NA