# 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

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:

## API

`Survival.KaplanMeier`

— Type.`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.

`StatsBase.fit`

— Method.`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.

`StatsBase.confint`

— Method.`confint(km::KaplanMeier, α=0.05)`

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

## 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/2281868Greenwood, 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.