survReport: Survival Analysis Results for Reports

View source: R/survReport.R

survReportR Documentation

Survival Analysis Results for Reports

Description

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.

Usage

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
)

Arguments

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 group. If group is missing, the Kaplan-Meier plots and median survival will be produced for the entire dataset.

stmt.placement

Placement of the statement giving hazard ratios, confidence intervals and p-values in the plot. Ignored if group = NULL.

legend.placement

Placement of the legend in the plot. Ignored if group = NULL. A warning will be produced if stmt.placement equals legend.placemet.

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 stmt.placement is "none".

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.

Value

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 output = "text", this is a vector of text giving median survival estimates and confidence intervals.

events

Matrix of hazard ratios, corresponding confidence intervals, and p-values from the Wald test. If output = "text", this is a character vector.

Author(s)

Sarah R. Haile

See Also

survfit, coxph, quantileKM

Examples


## 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"))


felix-hof/biostatUZH documentation built on Sept. 27, 2024, 1:48 p.m.