NAG FL Interface
g12aaf (kaplanmeier)
1
Purpose
g12aaf computes the Kaplan–Meier, (or product-limit), estimates of survival probabilities for a sample of failure times.
2
Specification
Fortran Interface
Subroutine g12aaf ( |
n, t, ic, freq, ifreq, nd, tp, p, psig, iwk, ifail) |
Integer, Intent (In) |
:: |
n, ic(n), ifreq(*) |
Integer, Intent (Inout) |
:: |
ifail |
Integer, Intent (Out) |
:: |
nd, iwk(n) |
Real (Kind=nag_wp), Intent (In) |
:: |
t(n) |
Real (Kind=nag_wp), Intent (Out) |
:: |
tp(n), p(n), psig(n) |
Character (1), Intent (In) |
:: |
freq |
|
C Header Interface
#include <nag.h>
void |
g12aaf_ (const Integer *n, const double t[], const Integer ic[], const char *freq, const Integer ifreq[], Integer *nd, double tp[], double p[], double psig[], Integer iwk[], Integer *ifail, const Charlen length_freq) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
g12aaf_ (const Integer &n, const double t[], const Integer ic[], const char *freq, const Integer ifreq[], Integer &nd, double tp[], double p[], double psig[], Integer iwk[], Integer &ifail, const Charlen length_freq) |
}
|
The routine may be called by the names g12aaf or nagf_surviv_kaplanmeier.
3
Description
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,
4
References
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
5
Arguments
-
1:
– Integer
Input
-
On entry: the number of failure and censored times given in
t.
Constraint:
.
-
2:
– Real (Kind=nag_wp) array
Input
-
On entry: the failure and censored times; these need not be ordered.
-
3:
– Integer array
Input
-
On entry:
contains the censoring code of the
th observation, for
.
- The th observation is a failure time.
- The th observation is right-censored.
Constraint:
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.
Constraint:
or .
-
5:
– Integer array
Input
-
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.
Constraint:
if , , for .
-
6:
– Integer
Output
-
On exit: the number of distinct failure times, .
-
7:
– Real (Kind=nag_wp) array
Output
-
On exit: contains the th ordered distinct failure time, , for .
-
8:
– Real (Kind=nag_wp) array
Output
-
On exit: contains the Kaplan–Meier estimate of the survival probability, , for time , for .
-
9:
– Real (Kind=nag_wp) array
Output
-
On exit: contains an estimate of the standard deviation of , for .
-
10:
– Integer array
Workspace
-
-
11:
– Integer
Input/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).
6
Error 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, .
Constraint: .
-
On entry, .
Constraint: or .
-
On entry, and .
Constraint: or .
-
On entry, and .
Constraint: .
An unexpected error has been triggered by this routine. Please
contact
NAG.
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.
7
Accuracy
The computations are believed to be stable.
8
Parallelism and Performance
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 .
10
Example
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).
10.1
Program Text
10.2
Program Data
10.3
Program Results