Skip to contents

S3 method for extracting quantiles. No default method is available at the moment.

Usage

get_quantile(x, ...)

# S3 method for survfit
get_quantile(
  x,
  ...,
  probs = c(0.25, 0.5, 0.75),
  conf.int = TRUE,
  tolerance = sqrt(.Machine$double.eps)
)

Arguments

x

An object of class survfit

...

other arguments passed on to the method

probs

probabilities Default = c(0.25,0.50,0.75)

conf.int

should lower and upper confidence limits be returned?

tolerance

tolerance for checking that the survival curve exactly equals one of the quantiles

Value

A data frame with quantiles of the object

See also

Examples


## Kaplan-Meier estimates
survfit_object <- visR::estimate_KM(data = adtte, strata = c("TRTP"))

## visR quantiles
visR::get_quantile(survfit_object)
#>                      strata quantity  25 50  75
#> 4              TRTP=Placebo    lower  35 NA  NA
#> 1              TRTP=Placebo quantile  70 NA  NA
#> 7              TRTP=Placebo    upper 177 NA  NA
#> 5 TRTP=Xanomeline High Dose    lower   5 25  50
#> 2 TRTP=Xanomeline High Dose quantile  14 36  58
#> 8 TRTP=Xanomeline High Dose    upper  22 47  94
#> 6  TRTP=Xanomeline Low Dose    lower  15 28  57
#> 3  TRTP=Xanomeline Low Dose quantile  19 33  80
#> 9  TRTP=Xanomeline Low Dose    upper  27 51 126

## survival quantiles
quantile(survfit_object)
#> $quantile
#>                           25 50 75
#> TRTP=Placebo              70 NA NA
#> TRTP=Xanomeline High Dose 14 36 58
#> TRTP=Xanomeline Low Dose  19 33 80
#> 
#> $lower
#>                           25 50 75
#> TRTP=Placebo              35 NA NA
#> TRTP=Xanomeline High Dose  5 25 50
#> TRTP=Xanomeline Low Dose  15 28 57
#> 
#> $upper
#>                            25 50  75
#> TRTP=Placebo              177 NA  NA
#> TRTP=Xanomeline High Dose  22 47  94
#> TRTP=Xanomeline Low Dose   27 51 126
#>