g12 Chapter Contents
g12 Chapter Introduction (PDF version)
NAG Library Manual

NAG Library Chapter Introduction

g12 – Survival Analysis

+ Contents

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 functions which are also used to analyse this type of data. Chapter g02 contains generalized linear models, Chapter g07 contains functions 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 ft, then the survivor function, St, which is the probability of surviving to at least time t, is given by
St=tfτdτ=1-Ft
where Ft 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=ft/St.
The cumulative hazard rate is defined as
Λ t=0tλ τdτ ,
hence St=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 St=e-Λt the cumulative hazard rate can be estimated by
Λ^t=-logS^t.
A plot of Λ^t or logΛ^t against t or logt is often useful in identifying a suitable parametric model for the survivor times. The following relationships can be used in the identification.
(a) Exponential distribution: Λt=λt.
(b) Weibull distribution: logΛt=logλ+γlogt.
(c) Gompertz distribution: logΛt=logλ+γt.
(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=λ0texpβTz
where λ0t is a baseline hazard function, z is a vector of covariates and β is a vector of unknown arguments. The assumption is that the covariates have a multiplicative effect on the hazard.
The form of λ0t 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 λ0t 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 Rti. 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
expsiTβ expzlTβ (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 Rti. This leads to a complex likelihood. If there are no ties in failure times the likelihood reduces to
L=i=1ndexpziTβ lRtiexpzlTβ (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=1ndexpsiTβ lRtiexpzlTβdi . (3)
Having fitted the model an estimate of the baseline survivor function (derived from λ0t 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 Functions

The following functions are available.
nag_prod_limit_surviv_fn (g12aac)computes Kaplan–Meier estimates of the survivor function and their standard deviations.
nag_surviv_logrank (g12abc)comparison of survival curves using rank statistics.
nag_surviv_cox_model (g12bac)fits the Cox proportional hazards model for fixed covariates.
nag_surviv_risk_sets (g12zac)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 nag_surviv_logrank (g12abc) 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 functions from other chapters may also be useful in the analysis of survival data.
nag_mills_ratio (g01mbc)the reciprocal of Mills' Ratio, that is the hazard rate for the Normal distribution.
nag_glm_poisson (g02gcc)fits generalized linear model with Poisson errors (see Aitkin and Clayton (1980)).
nag_glm_gamma (g02gdc)fits generalized linear model with gamma errors.
nag_censored_normal (g07bbc)fits Normal distribution to censored data.
nag_estim_weibull (g07bec)fits Weibull distribution to censored data.
nag_rank_regsn_censored (g08rbc)fits linear model using likelihood based on ranks to censored data (see Kalbfleisch and Prentice (1980)).
nag_condl_logistic (g11cac)fits a conditional logistic model. When applied to the risk sets generated by nag_surviv_risk_sets (g12zac) the Cox proportional hazards model is fitted by exact marginal likelihood in the presence of tied observations.

4  Functionality Index

Cox's proportional hazard model, 
    create the risk sets nag_surviv_risk_sets (g12zac)
    parameter estimates and other statistics nag_surviv_cox_model (g12bac)
Survival, 
    Rank statistics nag_surviv_logrank (g12abc)
Survivor function nag_prod_limit_surviv_fn (g12aac)

5  Auxiliary Functions Associated with Library Function Arguments

None.

6  Functions Withdrawn or Scheduled for Withdrawal

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

g12 Chapter Contents
g12 Chapter Introduction (PDF version)
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2014