Fits a Kaplan-Meier estimator with survival::survfit, optionally stratified
by a grouping variable, and returns the median and quartile attainment times
with their confidence intervals.
Value
An object of class physio_km (a list) with fit (the survfit),
quantiles (median / Q1 / Q3 attainment times with CIs, per group) and
summary table, plus print and plot methods.
References
Kaplan EL, Meier P (1958). Nonparametric estimation from incomplete observations. JASA, 53(282), 457-481.
Examples
if (requireNamespace("survival", quietly = TRUE)) {
survivalFit(survival::lung, "time", "status", group = "sex")
}
#> Kaplan-Meier fit
#> Call: survfit(formula = form, data = data, conf.int = conf_level)
#>
#> n events median 0.95LCL 0.95UCL
#> sex=1 138 112 270 212 310
#> sex=2 90 53 426 348 550
#>
#> Attainment times (median / quartiles):
#> group Q1 median Q3 median_lower median_upper
#> sex=1 144 270 457 212 310
#> sex=2 226 426 687 348 550