Kaplan-Meier Estimator

The Kaplan-Meier estimator is a nonparametric estimator of the survivor function, i.e. the probability of survival beyond a given time.

The estimate is given by

\[\hat{S}(t) = \prod_{i: t_i < t} \left( 1 - \frac{d_i}{n_i} \right)\]

where $d_i$ is the number of observed events at time $t_i$ and $n_i$ is the number of subjects at risk for the event just before time $t_i$.

The pointwise standard error of the log of the survivor function can be computed using Greenwood's formula:

\[\text{SE}(\log \hat{S}(t)) = \sqrt{\sum_{i: t_i < t} \frac{d_i}{n_i (n_i - d_i)}}\]

API

Survival.KaplanMeierType
KaplanMeier{S,T}

An immutable type containing survivor function estimates computed using the Kaplan-Meier method. The type has the following fields:

  • events: An EventTable summarizing the times and events used to compute the estimates. The time values are of type T.
  • survival: Estimate of the survival probability at each time. Values are of type S.
  • stderr: Standard error of the log survivor function at each time. Values are of type S.

Use fit(KaplanMeier, ...) to compute the estimates as Float64 values and construct this type. Alternatively, fit(KaplanMeier{S}, ...) may be used to request a particular value type S for the estimates.

source
StatsAPI.fitMethod
fit(KaplanMeier, times, status) -> KaplanMeier

Given a vector of times to events and a corresponding vector of indicators that denote whether each time is an observed event or is right censored, compute the Kaplan-Meier estimate of the survivor function.

source
StatsAPI.confintMethod
confint(km::KaplanMeier; level=0.05)

Compute the pointwise log-log transformed confidence intervals for the survivor function as a vector of tuples.

source

References

  • Kaplan, E. L., and Meier, P. (1958). Nonparametric Estimation from Incomplete Observations. Journal of the American Statistical Association, 53(282), 457-481. doi:10.2307/2281868

  • Greenwood, M. (1926). A Report on the Natural Duration of Cancer. Reports on Public Health and Medical Subjects. London: Her Majesty's Stationery Office. 33, 1-26.