Statistics made easy
8th revised edition (March 2026) - many illustrative examples - only €8.99
Survival Analysis
Author: Dr. Hannah Volk-Jesussek
Updated:
This tutorial is about survival analysis (Time-to-Event analysis). We start with the question of what survival analysis is, then come to the important point of what censoring means, and then discuss the Kaplan-Meier curve, the log-rank test and Cox regression (more on these in the separate tutorials).
What is survival analysis?
Survival time analysis is a group of statistical methods in which the variable under study is the time until an event occurs. What does "time to occurrence of an event" mean?
Survival time analysis considers a variable that has a start time and, when a particular event occurs, an end time. The time between the start time and the event is the focus of survival analysis. For example, time may be measured in days, weeks or months.
When do you use survival analysis?
An example would be to look at the time between a drug withdrawal and the person's relapse. The start time would then be the end of the withdrawal and the event considered would be the relapse. For example, you might be interested in whether different types of treatment have an effect on the time to relapse.
As the name "survival time analysis" implies, there is also a classic example: the time to death after a disease. Here, the start time is the diagnosis of the disease and the end time is death. It is often of great interest to know whether a particular drug has an effect on survival time.
Of course, the event does not have to be a negative one - you could look at the time it took to return to work after a burnout, for example.
Moreover, the object under investigation does not have to be a human being. In engineering, for example, a common question is how long a component will last in a test without failing. In this case, different parameters could be varied to see if they have an effect on the object's survival time.
Survival time means time until an event
The time considered may have nothing to do with the actual "survival time", but it is still called survival time and survival time analysis.
Survival analysis example
How exactly is a survival analysis performed? Let us look at an example. Let's say you are a dental technician and you want to analyse the "survival time" of a filling in a tooth.
So your start time is the moment a person goes to the dentist for a filling. The end time, or event, is the moment when the filling fails. You are now interested in the time between these two events.
First, of course, you need subjects so that you have data to evaluate. For each test person you can now note down the time that passes until the filling fails.
You will probably ask yourself the question: What happens if the filling of a test person does not break out at all? Or what happens if a person moves, changes dentists, and it is simply not known when the filling will break out?
All these cases are summarised under the term "censoring". Let's have a look at what it means.
What is censored data?
First of all, it is important to remember that a study cannot go on indefinitely, but is limited in time. For reasons of resources (time, money, etc.) and simply because you want to publish the results at some point, each study has a clear start and end date.
If a filling is inserted within this time period and then fails within the same period, with the failure time documented, then the event time is observed.
However, it is also possible that a filling is inserted and then the end of the study is reached before the event occurs. Or it can happen that a subject decides not to continue with the study. If the filling was still intact at the last observation, its time is right-censored: you know that it lasted at least until that point, but not how much longer it lasted.
Another event can also occur that is not considered in the study. For example, the patient could die or even lose the whole tooth. In both cases, the event considered in the study, failure of the filling, can no longer occur. These are competing events, not ordinary censoring, and may require a competing risks analysis.
It can also happen that the patient does not notice that the filling has failed and it is only discovered at the next routine check-up. If you know only that the event occurred between two check-ups, the event time is interval-censored. The standard Kaplan-Meier method is designed for exact event times and right-censored observations, so interval-censored data require a suitable extension.
All in all, there are several reasons why the exact event time may not be available. Censoring means that only partial information about the event time is known; it should not be confused with a competing event. Standard survival methods also assume non-informative censoring: at a given time, censored subjects should have the same future event prospects as comparable subjects who remain under observation. You will learn how to deal with right-censored data in the Kaplan-Meier curve tutorial. Now let's look at the most common methods of survival analysis.
Main methods in survival analysis
The appropriate method depends on whether the data contain ordinary censoring or an observed event that prevents the event of interest. Kaplan-Meier curves, the log-rank test, and Cox regression are used for the standard setting. Cumulative incidence, Gray's test, and Fine-Gray regression are used when competing events are present.
We will now briefly cover the standard methods and then show when competing risks need a different approach. Each method family has a detailed tutorial and calculation example.
In short: use a Kaplan-Meier curve to describe survival probabilities over time, use a log-rank test to compare survival curves between groups, and use Cox regression when you want to include several explanatory variables.
| Research question | Descriptive method | Group comparison or regression |
|---|---|---|
| How long until one event occurs? | Kaplan-Meier curve | Log-rank test or Cox regression |
| Which of several mutually exclusive events occurs first? | Cumulative incidence function | Gray's test or Fine-Gray regression |
Kaplan-Meier curve
The Kaplan-Meier curve is used to graphically represent the estimated survival function. Here, time is plotted on the x-axis and the estimated survival probability is plotted on the y-axis.
What is the survival probability? At this point, we go back to the tooth filling example. Suppose we have collected data on how long it takes for a filling to fail. In the Kaplan-Meier curve, you can now read the estimated probability that a filling will last longer than a certain time.
In this context, you might be interested, for example, in the probability that your filling will last longer than 5 years. To do this, simply move to 5 years on the x-axis of the graph and see what the estimated survival probability (y-axis) is. At 5 years, the Kaplan-Meier curve gives you a value of 0.7.
The estimated probability that a filling lasts longer than 5 years is therefore 70%. Of course, the data are purely fictitious. If you are interested in how the Kaplan Meier curve is created from existing data, please watch my video. Now you might be interested in whether this curve differs for different filling materials, e.g. whether one filling material is better than another. To answer this question the Log Rank Test will help you.
Median survival is another useful summary measure and is often reported in research reports. It is the time at which half of the subjects are expected to remain event-free. It is usually read as the earliest time at which the Kaplan-Meier estimate reaches or falls below 0.50. For the example data shown here, this point is not reached.
Full tutorial Kaplan Meier curveLog-rank test
The Log Rank Test compares the distribution of the time until an event occurs of two or more independent samples. For example, you might be interested in whether there is a difference in the survival time of two different materials. In this example, you use material A for half of the subjects and material B for the other half.
The Log Rank Test now gives you an answer to the following question: Is there a significant difference between the two curves? Or in other words: Is filling material associated with the distribution of the filling's "survival time"?
The null hypothesis is therefore: There is no tendency for one group to survive less than the other.
Full tutorial Log Rank TestCox Regression
What if you now want to examine several explanatory variables? Let's say you want to know whether the material and the age of the participants are associated with survival time. Cox regression is an appropriate method for this question.
Full tutorial Cox Regression
Competing risks analysis
Sometimes another observed event makes the event of interest impossible. For example, death before relapse prevents a later relapse. Treating that death as ordinary censoring in a Kaplan-Meier analysis can overestimate relapse incidence.
In this setting, cumulative incidence functions describe each event, Gray's test compares incidence curves between groups, and Fine-Gray regression estimates adjusted subdistribution hazard ratios.
Full tutorial competing risks analysisCalculate survival analysis online
Load example dataWith numiqo you can calculate a survival analysis online. You need at least a time column. In most real studies, you also need a status column that shows whether the event occurred or whether the case is censored. Group variables or other explanatory variables can be added when you want to compare groups or calculate Cox regression. If the status contains code 2, numiqo retains it as a competing event and displays the competing risks analysis.
To try it, go to the (1) Survival Analysis Calculator, (2) copy your own data into the table, and (3) click on "Plus" and then on Survival Analysis.
In the example above, we have a column with the "time" and a column that tells us whether the "event occurred" or whether the case is censored. Here 1 stands for "occurred" and 0 for "censored". This is a common coding convention, but the important point is that the status column clearly separates observed events from censored cases. Then we have the variable "Material" with the two materials A and B and we have the "Age". Depending on what you click here, the appropriate methods will be calculated.
If you select only the variable "Time", the Kaplan-Meier Survival Curve will be displayed and you will get the corresponding survival time table. If no variable is specified with the status, the calculation assumes that no case is censored. If this is not the case, you can simply click on the variable "Status", which contains the information about whether the event has occurred or not.
If you now select another factor, e.g. the "Material", the log-rank test will be calculated. Then you get the null and the alternative hypothesis as well as the p-value for the log-rank test.
The null hypothesis is: There is no difference between groups A and B in the distribution of the time until the event occurs.
If you go further down in the results section, you will find the p-value. If you don't know exactly how this is interpreted, you can simply click on "Summary in words":
A log-rank test was calculated to see if there was a difference between groups A and B in terms of the distribution of time until the event occurs.
For the present data, the log-rank test showed that there is a difference between the groups in terms of the distribution of the time until the event occurs, p < 0.001. The null hypothesis is thus rejected.
On the other hand, in the case where the "material" and the "age" were selected, the Cox regression is calculated. Then you can examine whether the factors are statistically associated with the event rate after accounting for the other included factors. You can find more information about this in the Cox Regression tutorial.
Statistics made easy
- many illustrative examples
- ideal for exams and theses
- statistics made easy on 464 pages
- 8th revised edition (March 2026)
Only €8.99
Free sample
"Super simple written"
"It could not be simpler"
"So many helpful examples"