NAG C Library Chapter Introduction
g12 – Survival Analysis
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
contains rank based methods.
Background to the Problems
Introduction to Terminology
This chapter is concerned with the analysis on the time,
, 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 will be referred to as the failure time.
Let the probability density function of the failure time be
, then the survivor function
, which is the probability of surviving to at least time
, is given by
is the cumulative density function. The
, is the probability that failure occurs at time
given that the individual survived up to time
, and is given by
The cumulative hazard
rate is defined as
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.
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
is the survivor function for group
is the number of groups being tested and
is the largest observed time, against the alternative hypothesis
at least one of the
differ, for some
A rank statistics is calculated as follows:
, for , denote the list of distinct failure times across all groups and a series of weights.
Let denote the number of failures at time in group and denote the number of observations in the group that are known to have not failed prior to time , i.e., the size of the risk set for group at time . If a censored observation occurs at time then that observation is treated as if the censoring had occurred slightly after and therefore the observation is counted as being part of the risk set at time .
The (weighted) number of observed failures in the
, is therefore given by
and the (weighted) number of expected failures in the
denote the vector of differences
otherwise, then the rank statistic,
, is calculated as
denotes a generalized inverse of the matrix
Under the null hypothesis,
where the degrees of freedom, , is taken as the rank of the matrix .
The different rank statistics are defined by using different weights in the above calculations, for example
|Wilcoxon rank statistic
|Tarone–Ware rank statistic
|Peto–Peto rank statistic
Estimating the Survivor Function and Hazard Plotting
The most common estimate of the survivor function for censored data is the Kaplan–Meier
is the number of failures occurring at time
. This is a step function with steps at each failure time but not at censored times.
the cumulative hazard rate can be estimated by
A plot of
is often useful in identifying a suitable parametric model for the survivor times. The following relationships can be used in the identification.
|Exponential distribution: .
|Weibull distribution: .
|Gompertz distribution: .
|Extreme value (smallest) distribution: .
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
is a baseline hazard function,
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
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.
Cox's Proportional Hazard Model
Rather than using a specified form for the hazard function, Cox (1972)
considered the case when
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,
, the set of those who were still in the study is considered this includes any that were censored at
. This set is known as the risk set for time
and denoted by
. Given the risk set the probability that out of all possible sets of
subjects that could have failed the actual observed
cases failed can be written as
is the sum of the covariates of the
individuals observed to fail at
and the summation is over all distinct sets of
individuals drawn from
. This leads to a complex likelihood. If there are no ties in failure times the likelihood reduces to
is the number of distinct failure times. For cases where there are ties the following approximation, due to
Peto , can be used:
Having fitted the model an estimate of the baseline survivor function (derived from and the residuals) can be computed to examine the suitability of the model, in particular the proportional hazard assumption.
Recommendations on Choice and Use of Available Functions
The following functions are available.
computes Kaplan–Meier estimates of the survivor function and their standard deviations.
performs a comparison of survival curves using rank statistics.
fits the Cox proportional hazards model for fixed covariates.
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 (
) and the total number of observations (
) at time
, 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.
computes the reciprocal of Mills' Ratio, that is the hazard rate for the Normal distribution.
fits a generalized linear model with Poisson errors (see Aitkin and Clayton (1980)
fits a generalized linear model with gamma errors.
fits a Normal distribution to censored data.
fits a Weibull distribution to censored data.
fits a linear model using likelihood based on ranks to censored data
(see Kalbfleisch and Prentice (1980)
fits a conditional logistic model. When applied to the risk sets generated by nag_surviv_risk_sets (g12zac)
it fits the Cox proportional hazards model by exact marginal likelihood in the presence of tied observations.
|Cox's proportional hazard model,
Auxiliary Functions Associated with Library Function Arguments
Functions Withdrawn or Scheduled for Withdrawal
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