Kaplan-Meier estimation and plotting.
This is a convenient interface to the survfit function from the survival package that is designed to cover 99 in the pharmacometric area. The KM plot can be exported to PDF. In addition, information about median survival time is generated and shown as a table. A cox regression for the provided strata is done as well and results returned as a table.
km_IQRsurvival(data, TIMEcol, CENScol = NULL, EVENTcol = NULL, type = "survival", STRATAcat = NULL, STRATAcont = NULL, STRATAcontUnits = NULL, probs.cont = c(0.5), conf.type = "plain", conf.int = 0.95, xlab = NULL, ylab = NULL, title = NULL, subtitle = NULL, xlim = NULL, ylim = c(0, 1), xtickDelta = NULL, shadedCI = TRUE, risk.table = FALSE, risk.table.height = 0.25, legend.labs = NULL, SIGNIF = 4, filename = NULL)
A data frame containing the columns that are defined in the following
Name of the time column in data for the analysis. Time of event or time of last visit without an event.
Name of the censoring column in the data. Elements in this column need to be 0 or 1. 0 if an event happened in the observation period. 1 if event did not happen or subject dropped-out before event happened (right-censored). If CENScol is defined then EVENTcol is not allowed to be defined.
Name of the event column in the data. Elements in this column need to be 0 or 1. 1 if an event happened in the observation period. 0 if event did not happen or subject dropped-out before event happened (right-censored). If CENScol is defined then EVENTcol is not allowed to be defined.
Character string defining the type of the plot "survival" and "cdf" are allowed.
Single character string or vector of strings containing names of columns in data that should be used for stratification. These columns should have categorical content.
Single character string or vector of strings containing names of columns in data that should be used for stratification. These columns should have continuous content. They will be converted to categorical content based on the quantiles defined in the probs.cont argument.
Character string of same length as STRATAcont, defining the units of each element in STRATAcont.
Numeric value between 0 and 1 or vector of such values. To be used for quantile calculation and binning the values in STRATAcont into their quantile numbers.
Type of confidence interval calculation. Can be "none", "plain" or "log". Please refer to the survfit function in the survival package to learn more.
Numeric value between 0 and 1, defining the confidence interval. If NULL or NA, then no confidence intervals will be determined and shown.
Label for the x-axis for the plots.
Label for the y-axis for the KM plot.
Title for the KM plot.
Subtitle for the KM plot. Use "" for removal of subtitle
Vector with two elements. First: lower x-axis limit, Second: higher x-axis limit for the KM plot.
Vector with two elements. First: lower y-axis limit, Second: higher y-axis limit for the KM plot.
Numeric value defining increments for xticks. Equidistant from 0 or min(xlim) to last datapoint of max(xlim).
Logical. TRUE will draw shaded areas for the CIs. FALSE will draw thiner lines as boundaries for the CIs. Use "FALSE" if submitting to the FDA.
Logical. TRUE will add a table in the plot with numbers of subjects still at risk. FALSE will only show the KM plot.
Value between 0-1 to define the relative height of the table showinf numbers of subjects at risk.
Vector of character strings allowing to change the legend labels.
Number of significant digits used for the median survival time table.
If a filename (possibly including a path) is provided then the table and plot are exported to PNG and table text files. If no filename provided then a list containing both the plot object and the table object are returned.
List with ggplot2 object for the KM plot and IQRoutputTable objects for median survival time and cox regression results