confIntKM_t0: Compute confidence interval for a survival curve at a fixed...

Description Usage Arguments Value Note Author(s) Examples

Description

Compute a Wald type confidence interval for a Kaplan-Meier survival curve at a fixed point. The variance is computed according to Peto's formula and the confidence interval is computed using a logit-transformation, to ensure that its bounds lie in (0, 1). Alternatives are given in the examples below.

Usage

1
confIntKM_t0(time, event, t0, conf.level = 0.95)

Arguments

time

Event times, censored or observed.

event

Censoring indicator, 1 for event, 0 for censored.

t0

Vector (or single number) of time points to compute confidence interval for.

conf.level

Confidence level for confidence interval.

Value

t0

Time points.

S at t0

Value of survival curve at t0.

lower.ci

Lower limits of confidence interval(s).

upper.ci

Upper limits of confidence interval(s).

Note

The variance according to Peto's formula tends to be more conservative than that based on Greenwood's formula.

Author(s)

Kaspar Rufibach
kaspar.rufibach@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
## use Acute Myelogenous Leukemia survival data contained in package 'survival'
time <- leukemia[, 1]; status <- leukemia[, 2]; x <- as.factor(leukemia[, 3])
tmp <- Surv(time, status) ~ 1
plot(survfit(tmp, conf.type = "none"), mark = "/", col = 1:2)
confIntKM_t0(time, status, t0 = c(10, 25, 50), conf.level = 0.95)

## an alternative is the log-log confidence interval using Greenwood's
## variance estimate
t0 <- 10
obj <- survfit(tmp, conf.int = 0.95, conf.type = "log-log", 
    type = "kaplan", error = "greenwood")
dat <- cbind(obj$time, obj$surv, obj$lower, obj$upper)
dat <- dat[dat[, 1] >= t0, ]
dat[1, 3:4]

## this same confidence interval can also be computed using the 
## package km.ci
library(km.ci)
ci.km <- km.ci(survfit(tmp), conf.level = 0.95, method = "loglog")
dat.km <- cbind(ci.km$time, ci.km$surv, ci.km$lower, ci.km$upper)
dat.km <- dat.km[dat.km[, 1] >= t0, 3:4]
dat.km[1, ]

## End(Not run)

biostatUZH documentation built on May 2, 2019, 6:06 p.m.