plotKaplanMeier creates the Kaplain-Meier (KM) survival plot. Based (partially) on recommendations in Pocock et al (2002).

When variable-sized strata are detected, an adjusted KM plot is computed to account for stratified data, as described in Galimberti eta al (2002), using the closed form variance estimator described in Xie et al (2005).

plotKaplanMeier(population, censorMarks = FALSE,
  confidenceIntervals = TRUE, includeZero = FALSE, dataTable = TRUE,
  dataCutoff = 0.9, targetLabel = "Treated",
  comparatorLabel = "Comparator", title, fileName = NULL)

Arguments

population

A population object generated by createStudyPopulation, potentially filtered by other functions.

censorMarks

Whether or not to include censor marks in the plot.

confidenceIntervals

Plot 95 percent confidence intervals? Default is TRUE, as recommended by Pocock et al.

includeZero

Should the y axis include zero, or only go down to the lowest observed survival? The default is FALSE, as recommended by Pocock et al.

dataTable

Should the numbers at risk be shown in a table? Default is TRUE, as recommended by Pocock et al.

dataCutoff

Fraction of the data (number censored) after which the graph will not be shown. The default is 90 percent as recommended by Pocock et al.

targetLabel

A label to us for the target cohort.

comparatorLabel

A label to us for the comparator cohort.

title

The main title of the plot.

fileName

Name of the file where the plot should be saved, for example 'plot.png'. See the function ggsave in the ggplot2 package for supported file formats.

Value

A ggplot object. Use the ggsave function to save to file in a different format.

References

Pocock SJ, Clayton TC, Altman DG. (2002) Survival plots of time-to-event outcomes in clinical trials: good practice and pitfalls, Lancet, 359:1686-89.

Galimberti S, Sasieni P, Valsecchi MG (2002) A weighted Kaplan-Meier estimator for matched data with application to the comparison of chemotherapy and bone-marrow transplant in leukaemia. Statistics in Medicine, 21(24):3847-64.

Xie J, Liu C. (2005) Adjusted Kaplan-Meier estimator and log-rank test with inverse probability of treatment weighting for survival data. Statistics in Medicine, 26(10):2276.