KaplanMeier#

final class relife.lifetime_models.KaplanMeier[source]#

Kaplan-Meier estimator.

Compute the non-parametric Kaplan-Meier estimator (also known as the product limit estimator) of the survival function from lifetime data.

Notes

For a given time instant \(t\) and \(n\) total observations, this estimator is defined as:

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

where \(d_i\) is the number of failures until \(t_i\) and \(n_i\) is the number of assets at risk just prior to \(t_i\).

The variance estimation is obtained by:

\[\widehat{Var}[\hat{S}(t)] = \hat{S}(t)^2 \sum_{i: t_i \leq t} \frac{d_i}{n_i(n_i - d_i)}\]

which is often referred to as Greenwood’s formula.

References

[1]

Lawless, J. F. (2011). Statistical models and methods for lifetime data. John Wiley & Sons.

[2]

Kaplan, E. L., & Meier, P. (1958). Nonparametric estimation from incomplete observations. Journal of the American statistical association, 53(282), 457-481.

Methods

fit

Compute the non-parametric estimations with respect to lifetime data.

plot

sf

The estimation of the survival function.

fit(time, event=None, entry=None)[source]#

Compute the non-parametric estimations with respect to lifetime data.

Parameters:
timendarray

Observed lifetime values.

eventndarray of boolean values (1d), default is None

Boolean indicators tagging lifetime values as right censored or complete.

entryndarray of float (1d), default is None

Left truncations applied to lifetime values.

sf()[source]#

The estimation of the survival function.

Returns:
outtuple of 3 1darray

A tuple containing the timeline, the estimated values and the estimated standard errors.