This package approaches simultaneous confidence bands for survival functions purely from an optimization perspective: given a certain coverage level, obtain bands such that the area between is minimized. optband imports LambertW and utils and provides an approximate solution based off local time arguments for both the survival and cumulative-hazard functions.


install.packages("devtools", repos="")
#> The downloaded binary packages are in
#>  /var/folders/0g/wnxynt411mj4nn_wmt2kj5n40000gn/T//RtmpGG74z5/downloaded_packages

Methods, conf.level = 0.95, fun = 'surv', tl = NA, tu = NA, samples = 1) takes a survfit object from the survival package with the desired 1 − α coverage level, function of interest (either 'surv' for the survival function or 'cumhaz' for the cumulative-hazard function), optional upper or lower bounds for data truncation, and the number of samples to consider (1 or 2). Defaults are α = 0.05, fun = 'surv', tl = NA, tu = NA, samples = 1.

Other methods/functions are internal and include cumhaz.var, func.sum,, psi, riemsum, and surv.range. For more, please view their corresponding help file.


Obtain confidence band for bladder cancer data set inherent to the survival package:


## 1-sample case
dat <- bladder[bladder$enum==1,]
S <- survival::survfit(Surv(stop, event) ~ 1, type = "kaplan-meier", data = dat)
opt.S <-