Thin wrapper around survival::survfit() returning a tidy list with
Greenwood or complementary-log-log confidence bands.
Usage
morie_survival_km(
time,
event,
confidence = 0.95,
ci_method = c("greenwood", "log-log")
)Value
list with times, survival, ci_lower, ci_upper,
at_risk, events, censored, median_survival, method.
Examples
set.seed(1)
time <- rexp(60); event <- rbinom(60, 1, 0.7)
str(morie_survival_km(time, event), max.level = 1)
#> List of 9
#> $ times : num [1:47] 0.0594 0.1061 0.1398 0.1457 0.147 ...
#> $ survival : num [1:47] 0.983 0.966 0.949 0.932 0.915 ...
#> $ ci_lower : num [1:47] 0.95 0.92 0.893 0.868 0.844 ...
#> $ ci_upper : num [1:47] 1 1 1 0.996 0.986 ...
#> $ at_risk : num [1:47] 59 58 57 56 55 54 53 52 51 50 ...
#> $ events : num [1:47] 1 1 1 1 1 1 1 1 1 1 ...
#> $ censored : num [1:47] 0 0 0 0 0 0 0 0 0 0 ...
#> $ median_survival: num 0.997
#> $ method : chr "Kaplan-Meier (greenwood CI)"
