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)



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


Whether or not to include censor marks in the plot.


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


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.


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


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.


A label to us for the target cohort.


A label to us for the comparator cohort.


The main title of the plot.


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.


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


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.