# 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

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.

source
StatsBase.fitMethod
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.

source
StatsBase.confintMethod
confint(km::KaplanMeier, α=0.05)

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

source
• 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.