survReport | R Documentation |
The analysis of survival data most often requires the production of Kaplan-Meier plots, estimated median survival time, and univariate estimates of hazard ratios (with associated confidence intervals and p-values). Often, this is performed separately for several possible risk factors. This function simplifies these tasks by providing a unified interface to simultaneously produce graphics, estimate median survival time, and compute hazard ratios with associated statistics from the Cox proportional hazards model.
survReport(
time,
event,
group = NULL,
stmt.placement = c("bottomleft", "bottomright", "topright", "subtitle", "none"),
legend.placement = c("topright", "bottomleft", "bottomright", "none"),
output = c("text", "plain"),
main = "",
xlab = "Time",
ylab = "Survival",
labels = levels(group),
digits = 2,
conf.level = 0.95
)
time |
Numeric vector of event times, censored or observed. |
event |
Numeric vector of censoring indicators, 1 for event, 0 for censored. |
group |
Kaplan-Meier plots, median survival and hazard rates will be
computed for each |
stmt.placement |
Placement of the statement giving hazard ratios, confidence
intervals and p-values in the plot. Ignored if |
legend.placement |
Placement of the legend in the plot. Ignored if
|
output |
Type of output, "plain" gives plaintext output for median
survival and hazard ratios suitable for the creation of tables etc., while
"text" gives output suitable for the text of reports. "text"-type output
is always printed in the plots unless |
main |
Title of the plot. |
xlab |
Label for the x-axis of the plot. |
ylab |
Label for the y-axis of the plot. |
labels |
Labels used to produce the legend and the contrasts printed in the hazard ratio statements. |
digits |
Number of significant digits used in rounding for text-type output. |
conf.level |
Significance level for confidence interval for the median survival and hazard ratio estimates. |
The Kaplan-Meier curve is plotted and a list with the following elements is returned:
med |
Matrix of median survival, and corresponding confidence intervals.
If |
events |
Matrix of hazard ratios, corresponding confidence intervals, and p-values from the
Wald test. If |
Sarah R. Haile
survfit
, coxph
, quantileKM
## use Acute Myelogenous Leukemia survival data from the 'survival' package
time <- leukemia[, 1]; event <- leukemia[, 2]; group <- leukemia[, 3]
survReport(time = time, event = event)
survReport(time = time, event = event, group = group)
survReport(time = time, event = event, group = group, stmt.placement = "bottomright",
output = "plain", main = "Acute Myeloid Leukemia")
survReport(time = time, event = event, group = group, stmt.placement = "bottomright",
output = "text", main = "AML")
survReport(time = time, event = event, group = group, stmt.placement = "subtitle",
output = "text", main = "Acute Myeloid Leukemia")
## use Larynx data from the 'survival' package
data(larynx)
larynx$stage <- factor(x = larynx$stage, 1:4, c("I", "II", "III", "IV"))
with(larynx, survReport(time = time, event = death, group = stage, output = "text",
stmt.placement = "bottomright", main = "Larynx"))
with(larynx, survReport(time = time, event = death, group = stage, output = "text",
stmt.placement = "subtitle", main = ""))
with(larynx, survReport(time = time, event = death, group = stage, output = "plain",
stmt.placement = "topright", legend.placement = "bottomright"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.