Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 21

Kaplan-Meier Confidence Intervals: Greenwood's Formula

Recommended resources

Introduction

In our previous lesson, you mastered the construction of the Kaplan-Meier (KM) estimator, , a powerful tool for estimating the survival function from censored data. We saw that it produces a point estimate—a single step function representing our best guess for the true survival curve. However, as a statistician, you know that any estimate derived from a sample is subject to uncertainty. A different sample from the same population would likely yield a slightly different KM curve.

This lesson addresses that uncertainty head-on. Our goal is to calculate confidence intervals for the Kaplan-Meier estimate. This will allow us to move from a single estimated curve to a "confidence band" that represents a range of plausible values for the true, unknown survival function. We will focus on the standard method for this, which is based on Greenwood's formula for the variance of the KM estimator. You will learn the formula itself, how to apply it in practice, and also discuss common transformations used by statistical software to ensure the resulting intervals are sensible.


Quantifying Uncertainty: The Role of Standard Error

Just as we compute a confidence interval for a sample mean using its standard error, we can compute a pointwise confidence interval for the survival probability at any specific time . For a 95% confidence level, the structure is familiar:

The main task, therefore, is to find the standard error, , which is the square root of the variance, . The most widely used formula for this variance is Greenwood's formula, sometimes called Greenwood's approximation.


Greenwood's Formula

Greenwood's formula provides an estimate for the variance of the Kaplan-Meier estimator . It is derived using the delta method, a concept you will be familiar with from probability theory, applied to the product-limit form of the KM estimator.

The formula for the estimated variance is:

Let's dissect this:

  • : The variance is proportional to the square of the survival estimate itself. As survival probability decreases, so does the absolute size of the variance.
  • : The summation is over all distinct event times up to or at time . This means the variance accumulates over time.
  • : This is the component of variance added at each event time . It depends on , the number of events, and , the number at risk.

The standard error is simply the square root of this value:

The following video provides a clear, step-by-step walkthrough of calculating the variance and the resulting confidence interval for a small dataset. This will help you see the formula in action.

Kaplan Meier curve – explained

This video, "Kaplan Meier curve – explained" by TileStats, gives a concise demonstration of calculating confidence bands.

Please watch the section explaining the calculation using Greenwood's formula, from the introduction of the formula. Pay close attention to how the variance is calculated cumulatively at each event time and then used to construct the upper and lower bounds of the confidence interval.


Practical Issues and Transformations

As the video and your statistical intuition might suggest, there's a practical problem with the straightforward confidence interval . Since the survival function is a probability, it must lie within the range [0, 1]. However, this "plain" or "linear" confidence interval can produce an upper bound greater than 1 or a lower bound less than 0, especially when is close to 1 or 0, or with small sample sizes.

To address this, it is standard practice to use transformations. We compute the confidence interval on a transformed scale where the range is unrestricted, and then transform the interval's endpoints back to the original [0, 1] scale. This ensures the resulting interval for is always valid.

The two most common methods are:

  1. Log Transformation: This method constructs the confidence interval for . Since ranges from to 0, the back-transformed interval will be bounded by 0 and . We then truncate any upper bound greater than 1. This prevents negative lower bounds. The resulting 95% CI for is:

    Notice that , which is the standard error of .

  2. Log-Log Transformation: This method uses the transformation , which maps the [0, 1] interval for to the entire real line (). A confidence interval constructed on this scale and transformed back will always lie within (0, 1), without any need for truncation. This is often the preferred method in software.

The following reading provides a clear summary of these three approaches ("plain", "log", and "log-log") and discusses their relative merits.

[PDF] Estimating the Survival Function

This PDF from the University of Michigan clearly explains the practical issues with plain confidence intervals and the rationale for using transformations.

First, read the section "Back to confidence intervals" on page 22. This succinctly states the problem with the plain Greenwood interval and introduces the log-log transformation as a better approach. Then, review the "Summary of Confidence Intervals" on pages 25-26. This is a crucial practical summary that outlines the three main methods and, importantly, tells you the default method used by major statistical packages like R (S-plus), SAS, and Stata.


Worked Example Continued

Let's continue the example from our last lesson to solidify these concepts.

Data (n=21): 6, 6, 6, 6+, 7, 9+, 10, 10+, 11+, 13, 16, 17+, 19+, 20+, 22, 23, 25+, 32+, 32+, 34+, 35+

In the previous lesson, we started building the KM table. Let's add columns for the variance calculation. The key column we need is for the term .

Time At Risk Events Censored
6 21 3 1 at 6+ 0.857 0.00794
7 17 1 1 at 9+ 0.807 0.01162
10 15 1 2 at 10+, 11+ 0.753 0.01638
13 12 1 0 0.690 0.02396
16 11 1 3 at 17+, 19+, 20+ 0.627 0.03305
22 7 1 0 0.538 0.05686
23 6 1 5 at 25+, 32+, 32+, 34+, 35+ 0.448 0.09019

Let's calculate the 95% "plain" confidence interval for the survival probability at t = 16.

  1. Find the KM estimate: From the table, .
  2. Find the variance sum: The cumulative sum of the variance terms up to is 0.03305.
  3. Calculate the Standard Error:
  4. Construct the "Plain" CI:

Now, let's calculate the log-transformed 95% CI at t = 16.

  1. Find the SE of the log-survival:
  2. Construct CI on log scale:
  3. Transform back:

Notice the asymmetry of the log-transformed interval compared to the plain one. As mentioned in the resources, this is the default method in R's survival package (conf.type='log').

The following video shows how different confidence interval types (plain, log, log-log) can be specified and plotted in R. This provides excellent context for how these theoretical options translate into practical data analysis.

Kaplan-Meier Curves and Log-rank Test - [Survival Analysis 4/8]

The video "Kaplan-Meier Curves and Log-rank Test" by zedstatistics provides a practical demonstration in R.

Watch the final segment on implementing these methods in R, from the start of the R Studio demo. Focus on the conf.type argument in the ggsurvplot function. The presenter compares the results for 'log', 'log-log', and 'plain' confidence intervals, reinforcing the concepts we've just discussed.


Conclusion

In this lesson, we have added a crucial layer of interpretation to the Kaplan-Meier curve by quantifying its uncertainty. You are now equipped to not only estimate a survival function but also to provide a statistically sound range for its true value.

Key Takeaways:

  • The uncertainty of the Kaplan-Meier estimate is captured by a pointwise confidence interval.
  • Greenwood's formula is the industry standard for estimating the variance of . The variance is calculated cumulatively at each event time.
  • The "plain" or "linear" confidence interval, , can yield bounds outside the valid [0, 1] range.
  • To solve this, transformations (log, and especially log-log) are used to construct the interval on an unbounded scale before transforming the endpoints back. These methods are the defaults in most statistical software packages.

In our next lesson, we will explore a different but related non-parametric approach: the Nelson-Aalen estimator. Instead of estimating the survival function directly, it estimates the cumulative hazard function . This will provide another valuable tool for your survival analysis toolkit.