NAG FL Interface
G12 (Surviv)
Survival Analysis

Settings help

FL Name Style:


FL Specification Language:


1 Scope of the Chapter

This chapter is concerned with statistical techniques used in the analysis of survival/reliability/failure time data.
Other chapters contain routines which are also used to analyse this type of data. Chapter G02 contains generalized linear models, Chapter G07 contains routines to fit distribution models, and Chapter G08 contains rank based methods.

2 Background to the Problems

2.1 Introduction to Terminology

This chapter is concerned with the analysis on the time, t, to a single event. This type of analysis occurs commonly in two areas. In medical research it is known as survival analysis and is often the time from the start of treatment to the occurrence of a particular condition or of death. In engineering it is concerned with reliability and the analysis of failure times, that is how long a component can be used until it fails. In this chapter the time t will be referred to as the failure time.
Let the probability density function of the failure time be f(t), then the survivor function, S(t), which is the probability of surviving to at least time t, is given by
S(t)=tf(τ)dτ=1-F(t)  
where F(t) is the cumulative density function. The hazard function, λ(t), is the probability that failure occurs at time t given that the individual survived up to time t, and is given by
λ(t)=f(t)/S(t).  
The cumulative hazard rate is defined as
Λ (t)=0tλ (τ)dτ ,  
hence S(t)=e-Λ(t).
It is common in survival analysis for some of the data to be right-censored. That is, the exact failure time is not known, only that failure occurred after a known time. This may be due to the experiment being terminated before all the individuals have failed, or an individual being removed from the experiment for a reason not connected with effects being tested in the experiment. The presence of censored data leads to complications in the analysis.

2.2 Rank Statistics

There are a number of different rank statistics described in the literature, the most common being the logrank statistic. All of these statistics are designed to test the null hypothesis where Sj is the survivor function for group j, g is the number of groups being tested and τ is the largest observed time, against the alternative hypothesis
A rank statistics T is calculated as follows:
Let ti , for i = 1 , 2 , , n d , denote the list of distinct failure times across all g groups and wi a series of nd weights.
Let dij denote the number of failures at time ti in group j and nij denote the number of observations in the group j that are known to have not failed prior to time ti, i.e., the size of the risk set for group j at time ti. If a censored observation occurs at time ti then that observation is treated as if the censoring had occurred slightly after ti and, therefore, the observation is counted as being part of the risk set at time ti.
Finally let
di = j=1 g d ij   and   ni = j=1 g n ij .  
The (weighted) number of observed failures in the jth group, Oj, is, therefore, given by
Oj = i=1 nd wi d ij  
and the (weighted) number of expected failures in the jth group, Ej, by
Ej = i=1 nd wi n ij di ni  
and if x denote the vector of differences x = (O1-E1,O2-E2,,Og-Eg)
V jk = i=1 nd w i 2 ( di (ni-di) (ni n i k I jk - n ij n ik ) n i 2 (ni-1) )  
where I jk = 1 if j=k and 0 otherwise, then the rank statistic, T, is calculated as
T = x V- xT  
where V- denotes a generalized inverse of the matrix V.
Under the null hypothesis, T χ ν 2 where the degrees of freedom, ν, is taken as the rank of the matrix V.
The different rank statistics are defined by using different weights in the above calculations, for example
logrank statistic wi=1
Wilcoxon rank statistic wi=ni
Tarone–Ware rank statistic wi=ni
Peto–Peto rank statistic wi = S~ (ti) where S~ (ti) = tj ti nj - dj + 1 nj+1

2.3 Estimating the Survivor Function and Hazard Plotting

The most common estimate of the survivor function for censored data is the Kaplan–Meier or product-limit estimate,
S^(t)=j=1i (nj-djnj) ,  tit<ti+1  
where dj is the number of failures occurring at time tj out of nj surviving to tj. This is a step function with steps at each failure time but not at censored times.
As S(t)=e-Λ(t) the cumulative hazard rate can be estimated by
Λ^(t)=-log(S^(t)).  
A plot of Λ^(t) or log(Λ^(t)) against t or log(t) is often useful in identifying a suitable parametric model for the survivor times. The following relationships can be used in the identification.
  1. (a)Exponential distribution: Λ(t)=λt.
  2. (b)Weibull distribution: log(Λ(t))=logλ+γlog(t).
  3. (c)Gompertz distribution: log(Λ(t))=logλ+γt.
  4. (d)Extreme value (smallest) distribution: log(Λ(t))=λ(t-γ).

2.4 Proportional Hazard Models

Often in the analysis of survival data the relationship between the hazard function and the number of explanatory variables or covariates is modelled. The covariates may be, for example, group or treatment indicators or measures of the state of the individual at the start of the observational period. There are two types of covariate time independent covariates such as those described above which do not change value during the observational period and time dependent covariates. The latter can be classified as either external covariates, in which case they are not directly involved with the failure mechanism, or as internal covariates which are time dependent measurements taken on the individual.
The most common function relating the covariates to the hazard function is the proportional hazard function
λ(t,z)=λ0(t)exp(βTz)  
where λ0(t) is a baseline hazard function, z is a vector of covariates and β is a vector of unknown parameters. The assumption is that the covariates have a multiplicative effect on the hazard.
The form of λ0(t) can be one of the distributions considered above or a nonparametric function. In the case of the exponential, Weibull and extreme value distributions the proportional hazard model can be fitted to censored data using the method described by Aitkin and Clayton (1980) which uses a generalized linear model with Poisson errors. Other possible models are the gamma distribution and the log-normal distribution.

2.5 Cox's Proportional Hazard Model

Rather than using a specified form for the hazard function, Cox (1972) considered the case when λ0(t) was an unspecified function of time. To fit such a model assuming fixed covariates a marginal likelihood is used. For each of the times at which a failure occurred, ti, the set of those who were still in the study is considered this includes any that were censored at ti. This set is known as the risk set for time ti and denoted by R(ti). Given the risk set the probability that out of all possible sets of di subjects that could have failed the actual observed di cases failed can be written as
exp(siTβ) exp(zlTβ) (1)
where si is the sum of the covariates of the di individuals observed to fail at ti and the summation is over all distinct sets of ni individuals drawn from R(ti). This leads to a complex likelihood. If there are no ties in failure times the likelihood reduces to
L=i=1ndexp(ziTβ) [lR(ti)exp(zlTβ)] (2)
where nd is the number of distinct failure times. For cases where there are ties the following approximation, due to Peto [2], can be used:
L=i=1ndexp(siTβ) [lR(ti)exp(zlTβ)]di . (3)
Having fitted the model an estimate of the baseline survivor function (derived from λ0(t) and the residuals) can be computed to examine the suitability of the model, in particular the proportional hazard assumption.

3 Recommendations on Choice and Use of Available Routines

The following routines are available.
g12aaf computes Kaplan–Meier estimates of the survivor function and their standard deviations.
g12abf performs a comparison of survival curves using rank statistics.
g12baf fits the Cox proportional hazards model for fixed covariates.
g12zaf creates the risk sets associated with the Cox proportional hazards model for fixed covariates.
Depending on the rank statistic required, it may be necessary to call g12abf twice, once to calculate the number of failures (di) and the total number of observations (ni) at time ti, to facilitate in the computation of the required weights, and once to calculate the required rank statistics.
The following routines from other chapters may also be useful in the analysis of survival data.
g01mbf computes the reciprocal of Mills' Ratio, that is the hazard rate for the Normal distribution.
g02gcf fits a generalized linear model with Poisson errors (see Aitkin and Clayton (1980)).
g02gdf fits a generalized linear model with gamma errors.
g07bbf fits a Normal distribution to censored data.
g07bef fits a Weibull distribution to censored data.
g08rbf fits a linear model using likelihood based on ranks to censored data (see Kalbfleisch and Prentice (1980)).
g11caf fits a conditional logistic model. When applied to the risk sets generated by g12zaf it fits the Cox proportional hazards model by exact marginal likelihood in the presence of tied observations.

4 Functionality Index

Cox's proportional hazard model,  
create the risk sets   g12zaf
parameter estimates and other statistics   g12baf
Survival,  
Rank statistics   g12abf
Survivor function   g12aaf

5 Auxiliary Routines Associated with Library Routine Arguments

None.

6 Withdrawn or Deprecated Routines

None.

7 References

Aitkin M and Clayton D (1980) The fitting of exponential, Weibull and extreme value distributions to complex censored survival data using GLIM Appl. Statist. 29 156–163
Cox D R (1972) Regression models in life tables (with discussion) J. Roy. Statist. Soc. Ser. B 34 187–220
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