Kaplan–Meier estimator

(Redirected from Kaplan-Meier estimator)
An example of a Kaplan–Meier plot for two conditions associated with patient survival.

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. The journal editor, John Tukey, convinced them to combine their work into one paper, which has been cited about 50,000 times since its publication.[4][5]

The estimator is given by:

${\displaystyle {\widehat {S}}(t)=\prod \limits _{i:\ t_{i}\leq t}\left(1-{\frac {d_{i}}{n_{i}}}\right),}$

with ${\displaystyle t_{i}}$ a time when at least one event happened, di the number of events (i.e., deaths) that happened at time ${\displaystyle t_{i}}$ and ${\displaystyle n_{i}}$ the individuals known to survive (have not yet had an event or been censored) at time ${\displaystyle t_{i}}$.

Basic concepts

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 indicate 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 more quickly 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.

In order 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.[6]

Problem Definition

Let ${\displaystyle \tau \geq 0}$ be a random variable, which we think of as the time until an event of interest takes place. As indicated above, the goal is to estimate the survival function ${\displaystyle S}$ underlying ${\displaystyle \tau }$. Recall that this function is defined as

${\displaystyle S(t)=\mathrm {Prob} (\tau >t)}$,

where ${\displaystyle t=0,1,\dots }$.

Let ${\displaystyle \tau _{1},\dots ,\tau _{n}\geq 0}$ be independent, identically distributed random variables, whose common distribution is that of ${\displaystyle \tau }$: ${\displaystyle \tau _{j}}$ is the random time when some event ${\displaystyle j}$ happened. The data available for estimating ${\displaystyle S}$ is not ${\displaystyle (\tau _{j})_{j=1,\dots ,n}}$, but the list of pairs ${\displaystyle (\,({\tilde {\tau }}_{j},c_{j})\,)_{j=1,\dots ,n}}$ where for ${\displaystyle j\in [n]:=\{1,2,\dots ,n\}}$, ${\displaystyle c_{j}\geq 0}$ is a fixed, deterministic integer, the censoring time of event ${\displaystyle j}$ and ${\displaystyle {\tilde {\tau }}_{j}=\min(\tau _{j},c_{j})}$. In particular, the information available about the timing of event ${\displaystyle j}$ is whether the event happened before the fixed time ${\displaystyle c_{j}}$ and if so, then the actual time of the event is also available. The challenge is to estimate ${\displaystyle S(t)}$ given this data.

Derivation of the Kaplan-Meier Estimator

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.

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 ${\displaystyle k\in [n]:=\{1,\dots ,n\}}$ and let ${\displaystyle t>0}$. A basic argument shows that the following proposition holds:

Proposition 1: If the censoring time ${\displaystyle c_{k}}$ of event ${\displaystyle k}$ exceeds ${\displaystyle t}$ (${\displaystyle c_{k}\geq t}$), then ${\displaystyle {\tilde {\tau }}_{k}=t}$ holds true if and only if ${\displaystyle \tau _{k}=t}$ holds true, and, similarly, ${\displaystyle {\tilde {\tau }}_{k}\geq t}$ holds true if and only if ${\displaystyle \tau _{k}\geq t}$.

Let ${\displaystyle k}$ be such that ${\displaystyle c_{k}\geq t}$. It follows from the above proposition that

${\displaystyle \mathrm {Prob} (\tau \geq t)=\mathrm {Prob} ({\tilde {\tau }}_{k}\geq t).}$

Let ${\displaystyle X_{k}=\mathbb {I} ({\tilde {\tau }}_{k}\geq t)}$ and consider only those ${\displaystyle k\in C(t):=\{1\leq k\leq n\,:\,c_{k}\geq t\}}$. Let ${\displaystyle m(t)=|C(t)|}$ be the number of elements in ${\displaystyle C(t)}$. Note that the set ${\displaystyle C(t)}$ is not random and so neither is ${\displaystyle m(t)}$. Furthermore, ${\displaystyle (X_{k})_{k\in C(t)}}$ is a sequence of independent, identically distributed Bernoulli random variables with common parameter ${\displaystyle S(t-1)=\mathrm {Prob} (\tau \geq t)}$. Assuming that ${\displaystyle m(t)>0}$, this suggests to estimate ${\displaystyle S(t-1)}$ using

${\displaystyle {\hat {S}}_{\mathrm {naive} }(t-1)={\frac {1}{m(t)}}\sum _{k:c_{k}\geq t}X_{k}={\frac {|\{1\leq k\leq n\,:\,{\tilde {\tau }}_{k}\geq t\}|}{m(t)}}}$,

where the last equality follows because ${\displaystyle {\tilde {\tau }}_{k}\geq t}$ implies ${\displaystyle c_{k}\geq t}$.

The quality of this estimate is governed by the size of ${\displaystyle m(t)}$. This can be problematic when ${\displaystyle m(t)}$ is small, which happens, by definition, when a lot of the events are censored. A particularly unpleasant property of this estimator, that suggests that perhaps it is not the "best" estimator, is that it ignores all the observations whose censoring time precedes ${\displaystyle t}$. Intuitively, these observations still contain information about ${\displaystyle S(t)}$: For example, when for many events with ${\displaystyle c_{k}, ${\displaystyle {\tilde {\tau }}_{k} also holds, we can infer that events often happen early, which implies that ${\displaystyle \mathrm {Prob} (\tau \leq t)}$ is large, which, through ${\displaystyle S(t)=1-\mathrm {Prob} (\tau \leq t)}$ means that ${\displaystyle S(t)}$ must be small. However, this information is ignored by this naive estimator. The question is then whether there exists an estimator that makes a better use of all the data. This is what the Kaplan–Meier estimator accomplishes. Note that the naive estimator cannot be improved when censoring does not take place; so whether an improvement is possible critically hinges upon whether censoring is in place.

The Plug-In Approach

By elementary calculations,

{\displaystyle {\begin{aligned}S(t)&=\mathrm {Prob} (\tau >t|\tau >t-1)\mathrm {Prob} (\tau >t-1)\\&=(1-\mathrm {Prob} (\tau \leq t|\tau >t-1))\mathrm {Prob} (\tau >t-1)\\&=(1-\mathrm {Prob} (\tau =t|\tau \geq t))\mathrm {Prob} (\tau >t-1)\\&=q(t)S(t-1)\,,\end{aligned}}}

where the one but last equality used that ${\displaystyle \tau }$ is integer valued and for the last line we introduced

${\displaystyle q(t)=1-\mathrm {Prob} (\tau =t|\tau \geq t)}$.

By a recursive expansion of the equality ${\displaystyle S(t)=q(t)S(t-1)}$, we get

${\displaystyle S(t)=q(t)q(t-1)\cdots q(0).}$

Note that here ${\displaystyle q(0)=1-\mathrm {Prob} (\tau =0|\tau >-1)=1-\mathrm {Prob} (\tau =0)}$.

The Kaplan–Meier estimator can be seen as a "plug-in estimator" where each ${\displaystyle q(s)}$ is estimated based on the data and the estimator of ${\displaystyle S(t)}$ is obtained as a product of these estimates.

It remains to specify how ${\displaystyle q(s)=1-\mathrm {Prob} (\tau =s|\tau \geq s)}$ is to be estimated. By Proposition 1, for any ${\displaystyle k\in [n]}$ such that ${\displaystyle c_{k}\geq s}$, ${\displaystyle \mathrm {Prob} (\tau =s)=\mathrm {Prob} ({\tilde {\tau }}_{k}=s)}$ and ${\displaystyle \mathrm {Prob} (\tau \geq s)=\mathrm {Prob} ({\tilde {\tau }}_{k}\geq s)}$ both hold. Hence, for any ${\displaystyle k\in [n]}$ such that ${\displaystyle c_{k}\geq s}$,

${\displaystyle \mathrm {Prob} (\tau =s|\tau \geq s)=\mathrm {Prob} ({\tilde {\tau }}_{k}=s)/\mathrm {Prob} ({\tilde {\tau }}_{k}\geq s)}$. By a similar reasoning that lead to the construction of the naive estimator above, we arrive at the estimator

${\displaystyle {\hat {q}}(s)=1-{\frac {|\{1\leq k\leq n\,:\,c_{k}\geq s,{\tilde {\tau }}_{k}=s\}|}{|\{1\leq k\leq n\,:\,c_{k}\geq s,{\tilde {\tau }}_{k}\geq s\}|}}=1-{\frac {|\{1\leq k\leq n\,:\,{\tilde {\tau }}_{k}=s\}|}{|\{1\leq k\leq n\,:\,{\tilde {\tau }}_{k}\geq s\}|}}}$

(think of estimating the numerator and denominator separately in the definition of the "hazard rate" ${\displaystyle \mathrm {Prob} (\tau =s|\tau \geq s)}$). The Kaplan–Meier estimator is then given by

${\displaystyle {\hat {S}}(t)=\prod _{s=0}^{t}{\hat {q}}(s)}$.

The form of the estimator stated at the beginning of the article can be obtained by some further algebra. For this, write ${\displaystyle {\hat {q}}(s)=1-d(s)/n(s)}$ where, using the actuarial science terminology, ${\displaystyle d(s)=|\{1\leq k\leq n\,:\,{\tilde {\tau }}_{k}=s\}|}$ is the number of known deaths at time ${\displaystyle s}$, while ${\displaystyle n(s)=|\{1\leq k\leq n\,:\,{\tilde {\tau }}_{k}\geq s\}|}$ is the number of those persons who are alive at time ${\displaystyle s}$.

Note that if ${\displaystyle d(s)=0}$, ${\displaystyle {\hat {q}}(s)=1}$. This implies that we can leave out from the product defining ${\displaystyle {\hat {S}}(t)}$ all those terms where ${\displaystyle d(s)=0}$. Then, letting ${\displaystyle 0\leq t_{1} be the times ${\displaystyle s}$ when ${\displaystyle d(s)>0}$, ${\displaystyle d_{i}=d(t_{i})}$ and ${\displaystyle n_{i}=n(t_{i})}$, we arrive at the form of the Kaplan–Meier estimator given at the beginning of the article:

${\displaystyle {\hat {S}}(t)=\prod _{i:t_{i}\leq t}\left(1-{\frac {d_{i}}{n_{i}}}\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.

Derivation as a maximum likelihood estimator

Kaplan–Meier estimator can be derived from maximum likelihood estimation of hazard function.[7] More specifically given ${\displaystyle d_{i}}$ as the number of events and ${\displaystyle n_{i}}$ the total individuals at risk at time ${\displaystyle t_{i}}$, discrete hazard rate ${\displaystyle h_{i}}$ can be defined as the probability of an individual with an event at time ${\displaystyle t_{i}}$. Then survival rate can be defined as:

${\displaystyle S(t)=\prod \limits _{i:\ t_{i}\leq t}(1-h_{i})}$

and the likelihood function for the hazard function up to time ${\displaystyle t_{i}}$ is:

${\displaystyle {\mathcal {L}}(h_{j:j\leq i}|d_{j:j\leq i},n_{j:j\leq i})=\prod _{j=1}^{i}h_{j}^{d_{j}}(1-h_{j})^{n_{j}-d_{j}}}$

therefore the log likelihood will be:

${\displaystyle \log({\mathcal {L}})=\sum _{j=1}^{i}\left(d_{j}\log(h_{j})+(n_{j}-d_{j})\log(1-h_{j})\right)}$

finding the maximum of log likelihood with respect to ${\displaystyle h_{i}}$ yields:

${\displaystyle {\frac {\partial \log({\mathcal {L}})}{\partial h_{i}}}={\frac {d_{i}}{{\widehat {h}}_{i}}}-{\frac {n_{i}-d_{i}}{1-{\widehat {h}}_{i}}}=0\Rightarrow {\widehat {h}}_{i}={\frac {d_{i}}{n_{i}}}}$

where hat is used to denote maximum likelihood estimation. Given this result, we can write:

${\displaystyle {\widehat {S}}(t)=\prod \limits _{i:\ t_{i}\leq t}\left(1-{\widehat {h}}_{i}\right)=\prod \limits _{i:\ t_{i}\leq t}\left(1-{\frac {d_{i}}{n_{i}}}\right)}$

Benefits and limitations

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.

Statistical considerations

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:[8]

${\displaystyle {\widehat {\operatorname {Var} }}({\widehat {S}}(t))={\widehat {S}}(t)^{2}\sum \limits _{i:\ t_{i}\leq t}{\frac {d_{i}}{n_{i}(n_{i}-d_{i})}},}$

where ${\displaystyle d_{i}}$ is the number of cases and ${\displaystyle n_{i}}$ is the total number of observations, for ${\displaystyle t_{i}.

For a mathematical derivation of the equation above, click on "show" to reveal

Greenwood formula is derived[9] by noting that probability of getting ${\displaystyle d_{i}}$ failures out of ${\displaystyle n_{i}}$ cases follows a binomial distribution with failure probability ${\displaystyle h_{i}}$. As a result for maximum likelihood hazard rate ${\displaystyle {\widehat {h}}_{i}=d_{i}/n_{i}}$ we have ${\displaystyle E({\widehat {h}}_{i})=h_{i}}$ and ${\displaystyle \operatorname {Var} ({\widehat {h}}_{i})=h_{i}(1-h_{i})/n_{i}}$. To avoid dealing with multiplicative probabilities we compute variance of logarithm of ${\displaystyle {\widehat {S}}(t)}$ and will use delta method to convert it back to the original variance:

{\displaystyle {\begin{aligned}\operatorname {Var} (\log {\widehat {S}}(t))&\sim {\frac {1}{{{\widehat {S}}(t)}^{2}}}\operatorname {Var} ({\widehat {S}}(t))\Rightarrow \\\operatorname {Var} ({\widehat {S}}(t))&\sim {{{\widehat {S}}(t)}^{2}}\operatorname {Var} (\log {\widehat {S}}(t))\end{aligned}}}

using martingale central limit theorem, it can be shown that the variance of the sum in the following equation is equal to the sum of variances:[9]

${\displaystyle \log {\widehat {S}}(t)=\sum \limits _{i:\ t_{i}\leq t}\log \left(1-{\widehat {h}}_{i}\right)}$

as a result we can write:

{\displaystyle {\begin{aligned}\operatorname {Var} ({\widehat {S}}(t))&\sim {{{\widehat {S}}(t)}^{2}}\operatorname {Var} \left(\sum \limits _{i:\ t_{i}\leq t}\log \left(1-{\widehat {h}}_{i}\right)\right)\\&\sim {{{\widehat {S}}(t)}^{2}}\sum \limits _{i:\ t_{i}\leq t}\operatorname {Var} \left(\log \left(1-{\widehat {h}}_{i}\right)\right)\end{aligned}}}

using delta method once more:

{\displaystyle {\begin{aligned}\operatorname {Var} ({\widehat {S}}(t))&\sim {{{\widehat {S}}(t)}^{2}}\sum _{i:\ t_{i}\leq t}\left({\frac {\partial \log \left(1-{\widehat {h}}_{i}\right)}{\partial {\widehat {h}}_{i}}}\right)^{2}\operatorname {Var} ({\widehat {h}}_{i})\\&={{{\widehat {S}}(t)}^{2}}\sum _{i:\ t_{i}\leq t}\left({\frac {1}{1-{\widehat {h}}_{i}}}\right)^{2}{\frac {{\widehat {h}}_{i}(1-{\widehat {h}}_{i})}{n_{i}}}\\&={{{\widehat {S}}(t)}^{2}}\sum _{i:\ t_{i}\leq t}{\frac {{\widehat {h}}_{i}}{n_{i}(1-{\widehat {h}}_{i})}}\\&={{{\widehat {S}}(t)}^{2}}\sum _{i:\ t_{i}\leq t}{\frac {d_{i}}{n_{i}(n_{i}-d_{i})}}\end{aligned}}}

as desired.

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 the Hall-Wellner band[10] and the equal-precision band.[11]

Software

• Mathematica: the built-in function SurvivalModelFit creates survival models.[12]
• SAS: The Kaplan–Meier estimator is implemented in the proc lifetest procedure.[13]
• R: the Kaplan–Meier estimator is available as part of the survival package.[14][15][16]
• Stata: the command sts returns the Kaplan–Meier estimator.[17][18]
• Python: the lifelines package includes the Kaplan–Meier estimator.[19]
• MATLAB: the ecdf function with the 'function','survivor' arguments can calculate or plot the Kaplan–Meier estimator.[20]
• StatsDirect: The Kaplan–Meier estimator is implemented in the Survival Analysis menu.[21]

References

1. ^ Kaplan, E. L.; Meier, P. (1958). "Nonparametric estimation from incomplete observations". J. Amer. Statist. Assoc. 53 (282): 457–481. doi:10.2307/2281868. JSTOR 2281868.
2. ^ Kaplan, E.L. in a retrospective on the seminal paper in "This week's citation classic". Current Contents 24, 14 (1983). Available from UPenn as PDF.
3. ^ Meyer, Bruce D. (1990). "Unemployment Insurance and Unemployment Spells". Econometrica. 58 (4): 757–782. doi:10.2307/2938349.
5. ^ "Paul Meier, 1924–2011". Chicago Tribune. August 18, 2011.
6. ^ Rich JT, Neely JG, Paniello RC, Voelker CC, Nussenbaum B, Wang EW (2010). "A practical guide to understanding Kaplan–Meier curves". Otolaryngol Head Neck Surg. 143 (3): 331–6. doi:10.1016/j.otohns.2010.05.007. PMC . PMID 20723767.
7. ^ (PDF) https://web.stanford.edu/~lutian/coursepdf/STAT331unit3.pdf. Missing or empty |title= (help)
8. ^ Greenwood, M. (1926). "The natural duration of cancer". Reports on Public Health and Medical Subjects. London: Her Majesty's Stationery Office. 33: 1–26.
9. ^ a b (PDF) https://www.math.wustl.edu/%7Esawyer/handouts/greenwood.pdf. Missing or empty |title= (help)
10. ^ Hall WJ and Wellner JA (1980) Confidence bands for a survival curve for censored data. Biometrika 69
11. ^ Nair VN (1984) Confidence bands for survival functions with censored data: A comparative study. Technometrics 26: 265–275
12. ^ "Survival Analysis - Mathematica SurvivalModelFit". wolfram.com. Retrieved 2017-08-14.
13. ^ The LIFETEST Procedure
14. ^ "survival: Survival Analysis". R Project.
15. ^ Willekens, Frans (2014). "The Survival Package". Multistate Analysis of Life Histories with R. Springer. pp. 135–153. doi:10.1007/978-3-319-08383-4_6. ISBN 978-3-319-08383-4.
16. ^ Chen, Ding-Geng; Peace, Karl E. (2014). Clinical Trial Data Analysis Using R. CRC Press. pp. 99–108.
17. ^ "sts — Generate, graph, list, and test the survivor and cumulative hazard functions" (PDF). Stata Manual.
18. ^ Cleves, Mario (2008). An Introduction to Survival Analysis Using Stata (Second ed.). College Station: Stata Press. pp. 93–107. ISBN 1-59718-041-6.
19. ^ lifelines docs
20. ^ "Empirical cumulative distribution function - MATLAB ecdf". mathworks.com. Retrieved 2016-06-16.
21. ^ [1]