surv_dist | R Documentation |
Solve for the time or proportion event-free assuming exponential survival.
surv_dist(p1, time1, p2 = NULL, time2 = NULL)
p1 , p2 |
proportion of patients who are event-free for the known and unknown rates, respectively |
time1 , time2 |
times corresponding to p1 and p2, respectively; note
that exactly one of |
time <- seq(0, 5, 0.01)
cumhaz <- cumsum(rep(exp(0.2), length(time)) * 0.01)
surv <- exp(-cumhaz)
set.seed(1)
n <- runif(100)
failtimes <- time[colSums(outer(surv, n, `>`))]
library('survival')
sf <- survfit(Surv(failtimes) ~ 1)
op <- par(mfrow = c(1, 2))
plot(time, surv, type = 'l', xlab = 'Time', ylab = 'Survival')
plot(sf)
par(op)
surv_extract(sf)
## given median survival of 0.58 time units, what proportions are
## event-free at times
times <- c(0.4, 0.6, 0.8)
p <- surv_dist(0.5, 0.58, time2 = times)
round(p, 3)
summary(sf, times = times)
## similarly, given median survival of 0.58 time units, when are the
## proportions of 0.609, 0.478, and 0.374 event-free
surv_dist(0.5, 0.58, round(p, 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.