Kaplan–Meier estimator

From testwiki
Revision as of 17:02, 11 November 2024 by 2a02:aa12:b103:bc80:e:9190:6921:e64f (talk) (link to lost to follow up)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Short description Template:Use mdy dates

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.[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]

The estimator of the survival function S(t) (the probability that life is longer than t) is given by:

S^(t)=i: tit(1dini),

with ti a time when at least one event happened, di the number of events (e.g., deaths) that happened at time ti, and ni the individuals known to have survived (have not yet had an event or been censored) up to time ti.

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 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]

Problem definition

Let τ0 be a random variable as the time that passes between the start of the possible exposure period, t0, and the time that the event of interest takes place, t1. As indicated above, the goal is to estimate the survival function S underlying τ. Recall that this function is defined as

S(t)=Prob(τ>t), where t=0,1, is the time.

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

Derivation of the Kaplan–Meier estimator

Two derivations of the Kaplan–Meier estimator are shown. 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 k[n]:={1,,n} and let t>0. A basic argument shows that the following proposition holds:

Proposition 1: If the censoring time ck of event k exceeds t (ckt), then τ~kt if and only if τkt.

Let k be such that ckt. It follows from the above proposition that

Prob(τkt)=Prob(τ~kt).

Let Xk=𝕀(τ~kt) and consider only those kC(t):={k:ckt}, i.e. the events for which the outcome was not censored before time t. Let m(t)=|C(t)| be the number of elements in C(t). Note that the set C(t) is not random and so neither is m(t). Furthermore, (Xk)kC(t) is a sequence of independent, identically distributed Bernoulli random variables with common parameter S(t)=Prob(τt). Assuming that m(t)>0, this suggests to estimate S(t) using

S^naive(t)=1m(t)k:cktXk=|{1kn:τ~kt}||{1kn:ckt}|=|{1kn:τ~kt}|m(t),

where the second equality follows because τ~kt implies ckt, while the last equality is simply a change of notation.

The quality of this estimate is governed by the size of m(t). This can be problematic when 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 t. Intuitively, these observations still contain information about S(t): For example, when for many events with ck<t, τk<ck also holds, we can infer that events often happen early, which implies that Prob(τt) is large, which, through S(t)=1Prob(τt) means that 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,

S(t)=Prob(τ>tτ>t1)Prob(τ>t1)=(1Prob(τtτ>t1))Prob(τ>t1)=(1Prob(τ=tτt))Prob(τ>t1)=q(t)S(t1),

where the second to last equality used that τ is integer valued and for the last line we introduced

q(t)=1Prob(τ=tτt).

By a recursive expansion of the equality S(t)=q(t)S(t1), we get

S(t)=q(t)q(t1)q(0).

Note that here q(0)=1Prob(τ=0τ>1)=1Prob(τ=0).

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

It remains to specify how q(s)=1Prob(τ=sτs) is to be estimated. By Proposition 1, for any k[n] such that cks, Prob(τ=s)=Prob(τ~k=s) and Prob(τs)=Prob(τ~ks) both hold. Hence, for any k[n] such that cks,

Prob(τ=s|τs)=Prob(τ~k=s)/Prob(τ~ks).

By a similar reasoning that lead to the construction of the naive estimator above, we arrive at the estimator

q^(s)=1|{1kn:cks,τ~k=s}||{1kn:cks,τ~ks}|=1|{1kn:τ~k=s}||{1kn:τ~ks}|

(think of estimating the numerator and denominator separately in the definition of the "hazard rate" Prob(τ=s|τs)). The Kaplan–Meier estimator is then given by

S^(t)=s=0tq^(s).

The form of the estimator stated at the beginning of the article can be obtained by some further algebra. For this, write q^(s)=1d(s)/n(s) where, using the actuarial science terminology, d(s)=|{1kn:τk=s}| is the number of known deaths at time s, while n(s)=|{1kn:τ~ks}| is the number of those persons who are alive (and not being censored) at time s1.

Note that if d(s)=0, q^(s)=1. This implies that we can leave out from the product defining S^(t) all those terms where d(s)=0. Then, letting 0t1<t2<<tm be the times s when d(s)>0, di=d(ti) and ni=n(ti), we arrive at the form of the Kaplan–Meier estimator given at the beginning of the article:

S^(t)=i:tit(1dini).

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 the discrete hazard function.[8]Template:Self-published inline More specifically given di as the number of events and ni the total individuals at risk at time ti, discrete hazard rate hi can be defined as the probability of an individual with an event at time ti. Then survival rate can be defined as:

S(t)=i: tit(1hi)

and the likelihood function for the hazard function up to time ti is:

(hj:jidj:ji,nj:ji)=j=1ihjdj(1hj)njdj(njdj)

therefore the log likelihood will be:

log()=j=1i(djlog(hj)+(njdj)log(1hj)+log(njdj))

finding the maximum of log likelihood with respect to hi yields:

log()hi=dih^inidi1h^i=0h^i=dini

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

S^(t)=i: tit(1h^i)=i: tit(1dini)

More generally (for continuous as well as discrete survival distributions), the Kaplan-Meier estimator may be interpreted as a nonparametric maximum likelihood estimator.[9]

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.

The Kaplan-Meier estimator is directly related to the Nelson-Aalen estimator and both maximize the empirical likelihood.[10]

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

Var^(S^(t))=S^(t)2i: titdini(nidi),

where di is the number of cases and ni is the total number of observations, for ti<t.

Template:Hidden 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]

Software

  • Mathematica: the built-in function SurvivalModelFit creates survival models.[15]
  • SAS: The Kaplan–Meier estimator is implemented in the proc lifetest procedure.[16]
  • R: the Kaplan–Meier estimator is available as part of the survival package.[17][18][19]
  • Stata: the command sts returns the Kaplan–Meier estimator.[20][21]
  • Python: the lifelines and scikit-survival packages each include the Kaplan–Meier estimator.[22][23]
  • MATLAB: the ecdf function with the 'function','survivor' arguments can calculate or plot the Kaplan–Meier estimator.[24]
  • StatsDirect: The Kaplan–Meier estimator is implemented in the Survival Analysis menu.[25]
  • SPSS: The Kaplan–Meier estimator is implemented in the Analyze > Survival > Kaplan-Meier... menu.[26]
  • Julia: the Survival.jl package includes the Kaplan–Meier estimator.[27]
  • Epi Info: Kaplan–Meier estimator survival curves and results for the log rank test are obtained with the KMSURVIVAL command.[28]

See also

References

Template:Reflist

Further reading

Template:Statistics