Skip to main content
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
Show menu

Kaplan-Meier survival analysis

Next selectSurvival analysis
Next selectKaplan-Meier survival analysis


Performs survival analysis and generates a Kaplan-Meier survival plot.

In clinical trials the investigator is often interested in the time until participants in a study present a specific event or endpoint. This event usually is a clinical outcome such as death, disappearance of a tumor, etc.

The participants will be followed beginning at a certain starting-point, and the time will be recorded needed for the event of interest to occur.

Usually, the end of the study is reached before all participants have presented this event, and the outcome of the remaining patients is unknown. Also the outcome is unknown of those participants who have withdrawn from the study. For all these cases the time of follow-up is recorded (censored data).

In MedCalc, these data can be analyzed by means of a life-table, or Kaplan-Meier curve, which is the most common method to describe survival characteristics.

How to enter data

To be able to analyze the data, you need to enter the data in the spreadsheet as follows:

The order of these columns is of course not important. Also, the rows do not have to be sorted in any way.

How to enter data for Kaplan-Meier survival analysis

The case in row 1 belonged to group 1, and reached the endpoint after 10 units of time. The case in row 3 also belonged to group 1 and was followed for 9 units of time. The outcome of this case is unknown (withdrawn from study, or end of study) (data from Freireich et al., Blood 1963; 21:699-716).

From these data, MedCalc can easily calculate and construct the Kaplan-Meier curve.

Required input

Dialog box for Kaplan-Meier surival analysis

In this dialog box the following data need to be entered:

When all data have been entered click OK. MedCalc will open 2 windows: one with the survival graphs, and one with the statistical results.


The survival curves are drawn as a step function, as shown in the following example:

Kaplan Meier survival curves

With the option "Include 95% CI in graph" selected, the graph looks like this:

Kaplan Meier survival curves with 95% confidence intervals

When the option "Number at risk table below graph" is selected, the result is:

Kaplan Meier survival curves with numbers at risk table


Cases summary

This table shows the number of cases that reached the endpoint (Number of events), the number of cases that did not reach the endpoint (Number censored), and the total number of cases.

Kaplan Meier - Cases summary

Mean and median survival

The mean and median survival time are reported with their 95% confidence interval (CI).

The mean survival time is estimated as the area under the survival curve in the interval 0 to tmax (Klein & Moeschberger, 2003).

The median survival is the smallest time at which the survival probability drops to 0.5 (50%) or below. If the survival curve does not drop to 0.5 or below then the median time cannot be computed. The median survival time and its 95% CI is calculated according to Brookmeyer & Crowley, 1982.

Kaplan Meier - Mean and median survival

Restricted Mean Survival Time

The restricted mean survival time (RMST) is reported with its 95% confidence interval. If groups are defined then a table is displayed with the differences of RMST between groups, the 95% CI of the difference, and associated P-value (Royston & Karmar, 2013).

Kaplan Meier - Restricted Mean Survival Time

Survival table

At each observed timepoint, the survival proportions (with standard error) are listed for all groups, as well as the overall survival proportion.

Kaplan Meier survival table

Comparison of survival curves (Logrank test)

When you scroll down, you see the result of the logrank test for the comparison between the two survival curves:

In this example, 9 cases in group 1 and 21 cases in group 2 presented the outcome of interest. The Chi-squared statistic was 16.79 with associated P-value of less than 0.0001. The conclusion therefore is that, statistically, the two survival curves differ significantly, or that the grouping variable has a significant influence on survival time.

Kaplan-Meier - Comparison of survival curves (Logrank test)

Hazard ratios with 95% Confidence Interval

When you have specified a factor then MedCalc also calculates the hazard ratios with 95% confidence interval (CI). Hazard is a measure of how rapidly the event of interest occurs. The hazard ratio compares the hazards in two groups.

In the example the hazard ratio is 5.1462 so that the estimated relative risk of the event of interest occurring in group 2 is 5.1462 higher than in group 1. This hazard ratio is significantly different from the value 1 (corresponding to equal hazards) since the confidence interval 2.3506 to 11.2663 does not include the value 1.

The hazard ratios and confidence intervals are calculated according to Altman et al., 2000.

Note that the computation of the hazard ratio assumes that the ratio is consistent over time, so therefore if the survival curves cross, the hazard ratio statistic should be ignored.

Kaplan-Meier - CHazard ratios with 95% Confidence Interval

Logrank test for trend

If more than two survival curves are compared, and there is a natural ordering of the groups, then MedCalc can also perform the logrank test for trend. This tests the probability that there is a trend in survival scores across the groups.


See also

Recommended book

Book cover

Survival Analysis: Techniques for Censored and Truncated Data
John P. Klein, Melvin L. Moeschberger

Buy from Amazon

The analysis of survival experiments is complicated by issues of censoring, where an individual's life length is known to occur only in a certain period of time, and by truncation, where individuals enter the study only if they survive a sufficient length of time or individuals are included in the study only if the event has occurred by a given date. The use of counting process methodology has allowed for substantial advances in the statistical theory to account for censoring and truncation in survival experiments. This book makes these complex methods more accessible to applied researchers without an advanced mathematical background. The authors present the essence of these techniques, as well as classical techniques not based on counting processes, and apply them to data. Practical suggestions for implementing the various methods are set off in a series of Practical Notes at the end of each section. Technical details of the derivation of the techniques are sketched in a series of Technical Notes. This book will be useful for investigators who need to analyze censored or truncated life time data, and as a textbook for a graduate course in survival analysis. The prerequisite is a standard course in statistical methodology.