naginterfaces.library.surviv.kaplanmeier(t, ic, freq, ifreq)[source]

kaplanmeier computes the Kaplan–Meier, (or product-limit), estimates of survival probabilities for a sample of failure times.

For full information please refer to the NAG Library document for g12aa

tfloat, array-like, shape

The failure and censored times; these need not be ordered.

icint, array-like, shape

contains the censoring code of the th observation, for .

The th observation is a failure time.

The th observation is right-censored.

freqstr, length 1

Indicates whether frequencies are provided for each time point.

Frequencies are provided for each failure and censored time.

The failure and censored times are considered as single observations, i.e., a frequency of is assumed.

ifreqint, array-like, shape

Note: the required length for this argument is determined as follows: if : ; if : ; otherwise: .

If , must contain the frequency of the th observation.

If , a frequency of is assumed and is not referenced.


The number of distinct failure times, .

tpfloat, ndarray, shape

contains the th ordered distinct failure time, , for .

pfloat, ndarray, shape

contains the Kaplan–Meier estimate of the survival probability, , for time , for .

psigfloat, ndarray, shape

contains an estimate of the standard deviation of , for .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: or .

(errno )

On entry, and .

Constraint: or .

(errno )

On entry, and .

Constraint: .


In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

A survivor function, , is the probability of surviving to at least time with , where is the cumulative distribution function of the failure times. The Kaplan–Meier or product limit estimator provides an estimate of , , from sample of failure times which may be progressively right-censored.

Let , , be the ordered distinct failure times for the sample of observed failure/censored times, and let the number of observations in the sample that have not failed by time be . If a failure and a loss (censored observation) occur at the same time , then the failure is treated as if it had occurred slightly before time and the loss as if it had occurred slightly after .

The Kaplan–Meier estimate of the survival probabilities is a step function which in the interval to is given by

where is the number of failures occurring at time .

kaplanmeier computes the Kaplan–Meier estimates and the corresponding estimates of the variances, , using Greenwood’s formula,


Gross, A J and Clark, V A, 1975, Survival Distributions: Reliability Applications in the Biomedical Sciences, Wiley

Kalbfleisch, J D and Prentice, R L, 1980, The Statistical Analysis of Failure Time Data, Wiley