quantileKM | R Documentation |
In survival analysis, often quantiles (e.g., the median) of an
estimated survival function are of interest. The survfit
function in the 'survival' packages of version < 2.35
computes median time to event.
However, the output of that function is such that the median is not
conveniently accessible by the user. This function
makes the median and any other quantile accessible by the user.
quantileKM(
time,
event,
group = NULL,
quantile = 0.5,
conf.level = 0.95,
conf.type = c("log-log", "log", "plain", "none")
)
time |
Event times, censored or observed. |
event |
Censoring indicator, 1 for event, 0 for censored. |
group |
Indicates groups to compute individual quantile for each group.
Default is |
quantile |
Quantile to be computed. Real number in |
conf.level |
Significance level for confidence interval for the time to event quantile. |
conf.type |
Type of confidence interval to be computed. For possible
choices see above, and for specifications regarding the different options
see |
A list containing a matrix with columns:
n |
Number of observations used. |
events |
Number of events. |
quantile |
Quantile estimate. |
lower.ci |
Lower limit of confidence interval. |
upper.ci |
Upper limit of confidence interval. |
and the p-value of the test for the difference between the survival curves;
see survdiff
for more information.
The function is based on the function survfit
.
Kaspar Rufibach
Confidence intervals are computed according to
Brookmeyer, R. and Crowley, J. (1982). A Confidence Interval for the Median Survival Time. Biometrics, 38, 29–41.
survfit
, survdiff
## use Acute Myelogenous Leukemia survival data contained in package 'survival'
time <- leukemia[, 1]
event <- leukemia[, 2]
group <- as.factor(leukemia[, 3])
plot(survfit(Surv(time, event) ~ group, conf.type = "none"), mark = "/", col = 1:2)
## median time to event
quantileKM(time, event, group = group, quantile = 0.5, conf.level = 0.95,
conf.type = "log")
## comparison to standard function (median time to event not accessible by user)
survfit(Surv(time, event) ~ group, conf.int = 0.95)
## compute 0.25 quantile
quantileKM(time = time, event = event, group = group, quantile = 0.25,
conf.type = "log")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.