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)}}\]



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

  • times: Distinct event times
  • nevents: Number of observed events at each time
  • ncensor: Number of right censored events at each time
  • natrisk: Size of the risk set at each time
  • survival: Estimate of the survival probability at each time
  • stderr: Standard error of the log survivor function at each time

Use fit(KaplanMeier, ...) to compute the estimates and construct this type.

fit(KaplanMeier, times, status) -> KaplanMeier

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

confint(km::KaplanMeier, α=0.05)

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