10.6 Kaplan Meier survival estimator

We will use the excellent survival package to produce the Kaplan Meier (KM) survival estimator (Terry M. Therneau and Patricia M. Grambsch (2000), Therneau (2020)). This is a non-parametric statistic used to estimate the survival function from time-to-event data.

library(survival)

survival_object <- melanoma %$% 
    Surv(time, status_os)

# Explore:
head(survival_object) # + marks censoring, in this case "Alive"
## [1]  10   30   35+  99  185  204
# Expressing time in years
survival_object <- melanoma %$% 
    Surv(time/365, status_os)

10.6.1 KM analysis for whole cohort

10.6.2 Model

The survival object is the first step to performing univariable and multivariable survival analyses.

If you want to plot survival stratified by a single grouping variable, you can substitute “survival_object ~ 1” by “survival_object ~ factor”

# Overall survival in whole cohort
my_survfit <- survfit(survival_object ~ 1, data = melanoma)
my_survfit # 205 patients, 71 events
## Call: survfit(formula = survival_object ~ 1, data = melanoma)
## 
##       n  events  median 0.95LCL 0.95UCL 
##  205.00   71.00      NA    9.15      NA

10.6.3 Life table

A life table is the tabular form of a KM plot, which you may be familiar with. It shows survival as a proportion, together with confidence limits. The whole table is shown with, summary(my_survfit).

summary(my_survfit, times = c(0, 1, 2, 3, 4, 5))
## Call: survfit(formula = survival_object ~ 1, data = melanoma)
## 
##  time n.risk n.event survival std.err lower 95% CI upper 95% CI
##     0    205       0    1.000  0.0000        1.000        1.000
##     1    193      11    0.946  0.0158        0.916        0.978
##     2    183      10    0.897  0.0213        0.856        0.940
##     3    167      16    0.819  0.0270        0.767        0.873
##     4    160       7    0.784  0.0288        0.730        0.843
##     5    122      10    0.732  0.0313        0.673        0.796
# 5 year overall survival is 73%

References

Terry M. Therneau, and Patricia M. Grambsch. 2000. Modeling Survival Data: Extending the Cox Model. New York: Springer.

Therneau, Terry M. 2020. A Package for Survival Analysis in R. https://CRAN.R-project.org/package=survival.