The Kaplan–Meier estimator,[1] [2] also known as the product limit estimator, is a non-parametric statistic used to estimate the survival function from lifetime data. In medical research, it is often used to measure the fraction of patients living for a certain amount of time after treatment. In other fields, Kaplan–Meier estimators may be used to measure the length of time people remain unemployed after a job loss,[3] the time-to-failure of machine parts, or how long fleshy fruits remain on plants before they are removed by frugivores. The estimator is named after Edward L. Kaplan and Paul Meier, who each submitted similar manuscripts to the Journal of the American Statistical Association.[4] The journal editor, John Tukey, convinced them to combine their work into one paper, which has been cited more than 34,000 times since its publication in 1958.[5] [6]
S(t)
t
\widehatS(t)=
\prod\limits | |
i: ti\let |
\left(1-
di | |
ni |
\right),
with
ti
ti
ni
ti
A plot of the Kaplan–Meier estimator is a series of declining horizontal steps which, with a large enough sample size, approaches the true survival function for that population. The value of the survival function between successive distinct sampled observations ("clicks") is assumed to be constant.
An important advantage of the Kaplan–Meier curve is that the method can take into account some types of censored data, particularly right-censoring, which occurs if a patient withdraws from a study, is lost to follow-up, or is alive without event occurrence at last follow-up. On the plot, small vertical tick-marks state individual patients whose survival times have been right-censored. When no truncation or censoring occurs, the Kaplan–Meier curve is the complement of the empirical distribution function.
In medical statistics, a typical application might involve grouping patients into categories, for instance, those with Gene A profile and those with Gene B profile. In the graph, patients with Gene B die much quicker than those with Gene A. After two years, about 80% of the Gene A patients survive, but less than half of patients with Gene B.
To generate a Kaplan–Meier estimator, at least two pieces of data are required for each patient (or each subject): the status at last observation (event occurrence or right-censored), and the time to event (or time to censoring). If the survival functions between two or more groups are to be compared, then a third piece of data is required: the group assignment of each subject.[7]
Let
\tau\ge0
t0
t1
S
\tau
S(t)=\operatorname{Prob}(\tau>t)
t=0,1,...
Let
\tau1,...,\taun\ge0
\tau
\tauj
j
S
(\tauj)j=1,...,n
((\tilde\tauj,cj))j=1,...,n
j\in[n]:=\{1,2,...,n\}
cj\ge0
j
\tilde\tauj=min(\tauj,cj)
j
cj
S(t)
Here, we show two derivations of the Kaplan–Meier estimator. Both are based on rewriting the survival function in terms of what is sometimes called hazard, or mortality rates. However, before doing this it is worthwhile to consider a naive estimator.
To understand the power of the Kaplan–Meier estimator, it is worthwhile to first describe a naive estimator of the survival function.
Fix
k\in[n]:=\{1,...,n\}
t>0
Proposition 1: If the censoring time
ck
k
t
ck\get
\tilde\tauk\get
\tauk\get
Let
k
ck\get
\operatorname{Prob}(\tauk\get)=\operatorname{Prob}(\tilde\tauk\get).
Let
Xk=I(\tilde\tauk\get)
k\inC(t):=\{k:ck\get\}
t
m(t)=|C(t)|
C(t)
C(t)
m(t)
(Xk)k\in
S(t)=\operatorname{Prob}(\tau\get)
m(t)>0
S(t)
\hatSnaive(t) =
1 | |
m(t) |
\sum | |
k:ck\get |
Xk =
|\{1\lek\len:\tilde\tauk\get\ | |
|}{|\{1\le |
k\len:ck\get\}|} =
|\{1\lek\len:\tilde\tauk\get\ | |
|}{m(t)}, |
where the second equality follows because
\tilde\tauk\get
ck\get
The quality of this estimate is governed by the size of
m(t)
m(t)
t
S(t)
ck<t
\tauk<ck
\operatorname{Prob}(\tau\let)
S(t)=1-\operatorname{Prob}(\tau\let)
S(t)
By elementary calculations,
\begin{align} S(t)&=\operatorname{Prob}(\tau>t\mid\tau>t-1)\operatorname{Prob}(\tau>t-1)\\[4pt] &=(1-\operatorname{Prob}(\tau\let\mid\tau>t-1))\operatorname{Prob}(\tau>t-1)\\[4pt] &=(1-\operatorname{Prob}(\tau=t\mid\tau\get))\operatorname{Prob}(\tau>t-1)\\[4pt] &=q(t)S(t-1), \end{align}
where the second to last equality used that
\tau
q(t)=1-\operatorname{Prob}(\tau=t\mid\tau\get).
By a recursive expansion of the equality
S(t)=q(t)S(t-1)
S(t)=q(t)q(t-1) … q(0).
Note that here
q(0)=1-\operatorname{Prob}(\tau=0\mid\tau>-1)=1-\operatorname{Prob}(\tau=0)
The Kaplan–Meier estimator can be seen as a "plug-in estimator" where each
q(s)
S(t)
It remains to specify how
q(s)=1-\operatorname{Prob}(\tau=s\mid\tau\ges)
k\in[n]
ck\ges
\operatorname{Prob}(\tau=s)=\operatorname{Prob}(\tilde\tauk=s)
\operatorname{Prob}(\tau\ges)=\operatorname{Prob}(\tilde\tauk\ges)
k\in[n]
ck\ges
\operatorname{Prob}(\tau=s|\tau\ges)=\operatorname{Prob}(\tilde\tauk=s)/\operatorname{Prob}(\tilde\tauk\ges).
By a similar reasoning that lead to the construction of the naive estimator above, we arrive at the estimator
\hatq(s)=1-
|\{1\lek\len:ck\ges,\tilde\tauk=s\ | |
|}{|\{1\le |
k\len:ck\ges,\tilde\tauk\ges\}|} =1-
|\{1\lek\len:\tilde\tauk=s\ | |
|}{|\{1\le |
k\len:\tilde\tauk\ges\}|}
(think of estimating the numerator and denominator separately in the definition of the "hazard rate"
\operatorname{Prob}(\tau=s|\tau\ges)
\hatS(t)=
t | |
\prod | |
s=0 |
\hatq(s).
The form of the estimator stated at the beginning of the article can be obtained by some further algebra. For this, write
\hatq(s)=1-d(s)/n(s)
d(s)=|\{1\lek\len:\tauk=s\}|
s
n(s)=|\{1\lek\len:\tilde\tauk\ges\}|
s-1
Note that if
d(s)=0
\hatq(s)=1
\hatS(t)
d(s)=0
0\let1<t2<...<tm
s
d(s)>0
di=d(ti)
ni=n(ti)
\hatS(t)=
\prod | \left(1- | |
i:ti\let |
di | |
ni |
\right).
As opposed to the naive estimator, this estimator can be seen to use the available information more effectively: In the special case mentioned beforehand, when there are many early events recorded, the estimator will multiply many terms with a value below one and will thus take into account that the survival probability cannot be large.
Kaplan–Meier estimator can be derived from maximum likelihood estimation of the discrete hazard function.[8] More specifically given
di
ni
ti
hi
ti
S(t)=
\prod\limits | |
i: ti\let |
(1-hi)
and the likelihood function for the hazard function up to time
ti
l{L}(hj:\middj:,nj:)=
i | |
\prod | |
j=1 |
dj | |
h | |
j |
nj-dj | |
(1-h | |
j) |
{nj\choosedj}
therefore the log likelihood will be:
log(l{L})=
i | |
\sum | |
j=1 |
\left(djlog(hj)+(nj-dj)log(1-hj)+log{nj\choosedj}\right)
finding the maximum of log likelihood with respect to
hi
\partiallog(l{L | |
)}{\partial |
hi}=
di | |
\widehat{h |
|
i}=0 ⇒
\widehat{h} | ||||
|
where hat is used to denote maximum likelihood estimation. Given this result, we can write:
\widehatS(t)=
\prod\limits | |
i: ti\let |
\left(1-\widehat{h}i\right)=
\prod\limits | |
i: ti\let |
\left(1-
di | |
ni |
\right)
More generally (for continuous as well as discrete survival distributions), the Kaplan-Meier estimator may be interpreted as a nonparametric maximum likelihood estimator.[9]
The Kaplan–Meier estimator is one of the most frequently used methods of survival analysis. The estimate may be useful to examine recovery rates, the probability of death, and the effectiveness of treatment. It is limited in its ability to estimate survival adjusted for covariates; parametric survival models and the Cox proportional hazards model may be useful to estimate covariate-adjusted survival.
The Kaplan-Meier estimator is directly related to the Nelson-Aalen estimator and both maximize the empirical likelihood.[10]
The Kaplan–Meier estimator is a statistic, and several estimators are used to approximate its variance. One of the most common estimators is Greenwood's formula:[11]
\widehat{\operatorname{Var}}\left(\widehatS(t)\right)=\widehatS(t)2
\sum | |
i: ti\let |
di | |
ni(ni-di) |
,
where
di
ni
ti<t
In some cases, one may wish to compare different Kaplan–Meier curves. This can be done by the log rank test, and the Cox proportional hazards test.
Other statistics that may be of use with this estimator are pointwise confidence intervals,[12] the Hall-Wellner band[13] and the equal-precision band.[14]
SurvivalModelFit
creates survival models.[15]proc lifetest
procedure.[16]survival
package.[17] [18] [19]sts
returns the Kaplan–Meier estimator.[20] [21]lifelines
and scikit-survival
packages each include the Kaplan–Meier estimator.[22] [23]ecdf
function with the 'function','survivor'
arguments can calculate or plot the Kaplan–Meier estimator.[24]Survival Analysis
menu.[25]Analyze > Survival > Kaplan-Meier...
menu.[26]Survival.jl
package includes the Kaplan–Meier estimator.[27]Kaplan–Meier estimator survival curves and results for the log rank test are obtained with the KMSURVIVAL
command.[28]