Search code examples
rsurvival-analysis

Area under the Kaplan-Meier curve for a time interval


I'd like to compute the area under the Kaplan-Meier curve for a interval time. I know I can compute the area under the curve from 0 to t, aka the restricted mean survival time with the print.survfit function:

library(survival)
km <- survfit(Surv(futime, fustat) ~ 1, data = ovarian)
print(km, rmean = 600)

But, what I'd like is the area under the Kaplan-Meier curve for a time interval, e.g. from t1 to t2. Is there a way to left truncate the computations of the area under the Kaplan Meier curve ? Any suggestion will be welcomed !


Solution

  • Actually, I eventually figured out how to compute the variance of the AUC between t1 and t2 thanks to the surv2sample of the surv2sampleComp package. It does so by resampling.

    library("survival")
    library("surv2sampleComp")
    data(veteran)
    # we need a group variable to use the surv2sample function
    veteran$group <- as.numeric(veteran$karno < 70) 
    rmst <- surv2sample(veteran$time, veteran$status, veteran$group, npert = 500, tau_start= 100, tau = 200)
    rmst$group0
    #---------------
                                 Est.       Lower 95%   Upper 95%          SE
    RMST                       43.4025761  32.1207404  55.8039197  6.15988181
    # results truncated