% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/KaplanMeier.R
\name{plotKaplanMeier}
\alias{plotKaplanMeier}
\title{Plot the Kaplan-Meier curve}
\usage{
plotKaplanMeier(
  population,
  censorMarks = FALSE,
  confidenceIntervals = TRUE,
  includeZero = FALSE,
  dataTable = TRUE,
  dataCutoff = 0.9,
  targetLabel = "Treated",
  comparatorLabel = "Comparator",
  title = NULL,
  fileName = NULL
)
}
\arguments{
\item{population}{A population object generated by \code{createStudyPopulation},
potentially filtered by other functions.}

\item{censorMarks}{Whether or not to include censor marks in the plot.}

\item{confidenceIntervals}{Plot 95 percent confidence intervals? Default is TRUE, as recommended by Pocock et al.}

\item{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.}

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

\item{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.}

\item{targetLabel}{A label to us for the target cohort.}

\item{comparatorLabel}{A label to us for the comparator cohort.}

\item{title}{The main title of the plot.}

\item{fileName}{Name of the file where the plot should be saved, for example
'plot.png'. See the function \code{ggsave} in the ggplot2 package for
supported file formats.}
}
\value{
A ggplot object. Use the \code{\link[ggplot2]{ggsave}} function to save to file in a different
format.
}
\description{
\code{plotKaplanMeier} creates the Kaplan-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).
}
\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.
}
