confIntKM_t0 {biostatUZH} | R Documentation |
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.
confIntKM_t0(time, event, t0, conf.level = 0.95)
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. |
t0 |
Time points. |
S at t0 |
Value of survival curve at |
lower.ci |
Lower limits of confidence interval(s). |
upper.ci |
Upper limits of confidence interval(s). |
The variance according to Peto's formula tends to be more conservative than that based on Greenwood's formula.
Kaspar Rufibach
kaspar.rufibach@gmail.com
## 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)