Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Survival analysis is time-to-event analysis, that is, when the outcome of interest is the time until an event occurs. Examples of time-to-events are the time until infection, reoccurrence of a disease, or recovery in health sciences, duration of unemployment in economics, time until the failure of a machine part or lifetime of light bulbs in engineering, and so on. Survival analysis is a part of reliability studies in engineering. In this case, it is usually used to study the lifetime of industrial components. In reliability analyses, survival times are usually called failure times as the variable of interest is how much time a component functions properly before it fails.

Survival analysis consists of parametric, semiparametric, and
nonparametric methods. You can use these to estimate the most commonly
used measures in survival studies, survivor and hazard functions,
compare them for different groups, and assess the relationship of
predictor variables to survival time. Some statistical probability
distributions describe survival times well. Commonly used distributions
are exponential, Weibull, lognormal, Burr, and Birnbaum-Saunders distributions. Statistics and Machine
Learning Toolbox™ functions `ecdf`

and `ksdensity`

compute
the empirical and kernel density estimates of the cdf, cumulative
hazard, and survivor functions. `coxphfit`

fits the
Cox proportional hazards model to the data.

One important concept in survival analysis is censoring. The survival times of some individuals might not be fully observed due to different reasons. In life sciences, this might happen when the survival study (e.g., the clinical trial) stops before the full survival times of all individuals can be observed, or a person drops out of a study, or for long-term studies, when the patient is lost to follow up. In the industrial context, not all components might have failed before the end of the reliability study. In such cases, the individual survives beyond the time of the study, and the exact survival time is unknown. This is called right censoring.

During a survival study either the individual is observed to
fail at time *T*, or the observation on that individual
ceases at time *c*. Then the observation is min(*T*,*c*)
and an indicator variable *I*_{c} shows
if the individual is censored or not. The calculations for hazard
and survivor functions must be adjusted to account for censoring. Statistics and Machine
Learning Toolbox functions
such as `ecdf`

, `ksdensity`

, `coxphfit`

, `mle`

account
for censoring.

Survival data usually consists of the time until an event of interest occurs and the censoring information for each individual or component. The following table shows the fictitious unemployment time of individuals in a 6-month study. Two individuals are right censored (indicated by a censoring value of 1). One individual was still unemployed after the 24th week, when the study ended. Contact with the other censored individual was lost at the end of the 21st week.

Unemployment Time (Weeks) | Censoring |
---|---|

14 | 0 |

23 | 0 |

7 | 0 |

21 | 1 |

19 | 0 |

16 | 0 |

24 | 1 |

8 | 0 |

Survival data might also include the number of failures at a certain time (the number of times a particular survival or failure time was observed). The following table shows the simulated time until a light-emitting diodes drops to 70% of its full light output level, in hours, in an accelerated life test.

Failure Time (hrs) | Frequency |
---|---|

8600 | 6 |

15300 | 19 |

22000 | 11 |

28600 | 20 |

35300 | 17 |

42000 | 14 |

48700 | 8 |

55400 | 2 |

62100 | 0 |

68800 | 2 |

Data might also have information on the predictor variables, to use in semi-parametric regression-like methods such as Cox proportional hazards regression.

Time Until Recovery (weeks) | Censoring | Gender | Systolic Blood Pressure | Diastolic Blood Pressure |
---|---|---|---|---|

12 | 1 | Male | 124 | 93 |

20 | 0 | Female | 109 | 77 |

7 | 0 | Female | 125 | 83 |

13 | 0 | Male | 117 | 75 |

9 | 1 | Male | 122 | 80 |

15 | 0 | Female | 121 | 70 |

17 | 1 | Male | 130 | 88 |

8 | 0 | Female | 115 | 82 |

14 | 0 | Male | 118 | 86 |

The survivor function is the probability of survival as a function
of time. It is also called the survival function. It gives the probability
that the survival time of an individual exceeds a certain value. Since
the cumulative distribution function, *F*(*t*),
is the probability that the survival time is less than or equal to
a given point in time, the survival function for a continuous distribution, *S*(*t*),
is the complement of the cumulative distribution function:

*S*(*t*) = 1 – *F*(*t*).

For example, for data coming from a Burr distribution with parameters 50, 3, and 1, you can calculate and plot the survivor function.

x = 0:0.1:200; figure() plot(x,1-cdf('Burr',x,50,3,1)) xlabel('Failure time'); ylabel('Survival probability');

The survivor function is also related
to the hazard function.
If the data has the hazard function, *h*(*t*),
then the survivor function is

$$S(t)=\mathrm{exp}\left(-{\displaystyle \underset{0}{\overset{t}{\int}}h\left(u\right)du}\right),$$

which corresponds to

$$S(t)=\mathrm{exp}\left(-H\left(t\right)\right),$$

where *H*(*t*)
is the cumulative hazard function.

The hazard function gives the instantaneous failure rate of an individual conditioned on the fact that the individual survived until a given time. That is,

$$h(t)=\underset{\Delta t\to 0}{\mathrm{lim}}\frac{P\left(t\le T<t+\Delta t|T\ge t\right)}{\Delta t},$$

where Δ*t* is
a very small time interval. The hazard rate, therefore, is sometimes
called the conditional failure rate. The hazard function always takes
a positive value. However, these values do not correspond to probabilities
and might be greater than 1.

The hazard function is related to the probability density function,* f*(*t*),
cumulative distribution function, *F*(*t*),
and survivor function, *S*(*t*),
as follows:

$$h(t)=\frac{f(t)}{S(t)}=\frac{f(t)}{1-F(t)},$$

which is also equivalent to

$$h(t)=-\frac{d}{dt}\mathrm{ln}S(t).$$

So, if you know the shape of the survival function, you can also derive the corresponding hazard function.

For example, for data coming from a Burr distribution with parameters 50, 3, and 1, you can calculate and plot the hazard function.

x = 0:1:200; Burrhazard = pdf('Burr',x,50,3,1)./(1-cdf('Burr',x,50,3,1)); figure() plot(x,Burrhazard) xlabel('Failure time'); ylabel('Hazard rate');

There are different types of hazard functions. The previous figure shows a situation when the hazard rate increases for the early time periods and then gradually decreases. The hazard rate might also be monotonically decreasing, increasing, or constant over time. The following figure shows examples of different types of hazard functions for data coming from different Weibull distributions.

ax1 = subplot(3,1,1); x1 = 0:0.5:30; hazard1 = pdf('wbl',x1,3,0.6)./(1-cdf('wbl',x1,3,0.6)); plot(x1,hazard1) ax2 = subplot(3,1,2); x2 = 0:0.05:2; hazard2 = pdf('wbl',x2,0.9,4)./(1-cdf('wbl',x2,0.9,4)); plot(x2,hazard2,'color','r') ax3 = subplot(3,1,3); x3 = 0:0.05:5; hazard3 = pdf('wbl',x3,2.5,1)./(1-cdf('wbl',x3,2.5,1)); plot(x3,hazard3) set(ax1,'Ylim',[0 0.4]); legend(ax1,'a=3, b=0.6'); legend(ax2,'a=0.9, b=4','location','northwest'); legend(ax3,'a=2.5, b=1');

In the third case, the Weibull distribution has a shape parameter value of 1, which corresponds to the exponential distribution. The exponential distribution always has a constant hazard rate over time.

[1] Cox, D. R., and D. Oakes. *Analysis
of Survival Data*. London: Chapman & Hall, 1984.

[2] Lawless, J. F. *Statistical
Models and Methods for Lifetime Data*. Hoboken, NJ: Wiley-Interscience,
2002.

[3] Kleinbaum, D. G., and M. Klein. *Survival Analysis*.
Statistics for Biology and Health. 2nd edition. Springer, 2005.

- Hazard and Survivor Functions for Different Groups
- Survivor Functions for Two Groups
- Cox Proportional Hazards Model for Censored Data
- Cox Proportional Hazards Model with Time-Dependent Covariates