opt.ci: Confidence bands optimized by area

View source: R/package_functions.R

opt.ciR Documentation

Confidence bands optimized by area

Description

opt.ci obtains simultaneous confidence bands for the survival or cumulative-hazard functions such that the area between is minimized.

Usage

opt.ci(survi, conf.level = 0.95, fun = "surv", tl = NA, tu = NA, samples = 1)

Arguments

survi

a survfit object.

conf.level

desired coverage level.

fun

"surv" for survival function and "cumhaz" for the cumulative-hazard. function, with "surv" as the default.

tl

a lower bound for truncation.

tu

an upper bound for truncation.

samples

the number of groups (1 or 2).

Details

Produces an approximate solution based on local time arguments.

Value

A survfit object with optimized confidence bands.

Examples

library(survival)
# fit and plot a Kaplan-Meier curve
fit <- survfit(Surv(stop, event) ~ 1, data=bladder)
plot(fit)
fit2 <- opt.ci(fit)
plot(fit2)


seasamgo/optband documentation built on April 23, 2023, 1:08 p.m.