NAG Library Routine Document
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 nagmk26.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) |
|
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: – IntegerInput
-
On entry: the number of failure and censored times given in
t.
Constraint:
.
- 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.
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 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.
Constraint:
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
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation 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 argument, the recommended value is
.
When the value 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, | or . |
-
On entry, | or , for some . |
-
On entry, | and , for some . |
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation 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
Program Text (g12aafe.f90)
10.2
Program Data
Program Data (g12aafe.d)
10.3
Program Results
Program Results (g12aafe.r)