The routine may be called by the names g12aaf or nagf_surviv_kaplanmeier.
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 .
g12aaf 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
1: – IntegerInput
On entry: the number of failure and censored times given in t.
2: – Real (Kind=nag_wp) arrayInput
On entry: the failure and censored times; these need not be ordered.
3: – Integer arrayInput
On entry: contains the censoring code of the th observation, for .
The th observation is a failure time.
The th observation is right-censored.
or , for .
4: – Character(1)Input
On entry: 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.
5: – Integer arrayInput
Note: the dimension of the array ifreq
must be at least
if and at least if .
On entry: if , must contain the frequency of the th observation.
If , a frequency of is assumed and ifreq is not referenced.
if , , for .
6: – IntegerOutput
On exit: the number of distinct failure times, .
7: – Real (Kind=nag_wp) arrayOutput
On exit: contains the th ordered distinct failure time, , for .
8: – Real (Kind=nag_wp) arrayOutput
On exit: contains the Kaplan–Meier estimate of the survival probability, , for time , for .
9: – Real (Kind=nag_wp) arrayOutput
On exit: contains an estimate of the standard deviation of , for .
10: – Integer arrayWorkspace
11: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
On entry, .
Constraint: or .
On entry, and .
Constraint: or .
On entry, and .
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
The computations are believed to be stable.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g12aaf is not threaded in any implementation.
If there are no censored observations, reduces to the ordinary binomial estimate of the probability of survival at time .
The remission times for a set of leukaemia patients at distinct time points are read in and the Kaplan–Meier estimate computed and printed. For further details see page 242 of Gross and Clark (1975).