NAG Library Routine Document
G12AAF computes the Kaplan–Meier, (or product-limit), estimates of survival probabilities for a sample of failure times.
|SUBROUTINE G12AAF (
||N, T, IC, FREQ, IFREQ, ND, TP, P, PSIG, IWK, IFAIL)
||N, IC(N), IFREQ(*), ND, IWK(N), IFAIL
||T(N), TP(N), P(N), PSIG(N)
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
is given by
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: N – INTEGERInput
: the number of failure and censored times given in T
- 2: T(N) – REAL (KIND=nag_wp) arrayInput
On entry: the failure and censored times; these need not be ordered.
- 3: IC(N) – INTEGER arrayInput
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: FREQ – CHARACTER(1)Input
: 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: IFREQ() – INTEGER arrayInput
the dimension of the array IFREQ
must be at least
and at least
must contain the frequency of the
, a frequency of
is assumed and IFREQ
is not referenced.
if , , for .
- 6: ND – INTEGEROutput
On exit: the number of distinct failure times, .
- 7: TP(N) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the th ordered distinct failure time, , for .
- 8: P(N) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the Kaplan–Meier estimate of the survival probability, , for time , for .
- 9: PSIG(N) – REAL (KIND=nag_wp) arrayOutput
On exit: contains an estimate of the standard deviation of , for .
- 10: IWK(N) – INTEGER arrayWorkspace
- 11: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
|On entry,|| or .|
|On entry,|| or , for some .|
|On entry,|| and , for some .|
The computations are believed to be stable.
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)
9.1 Program Text
Program Text (g12aafe.f90)
9.2 Program Data
Program Data (g12aafe.d)
9.3 Program Results
Program Results (g12aafe.r)