• No results found

Kaplan–Meier and Log Rank Test

Time to Event Analysis

6.1 Introduction

In survival or reliability analysis the investigator is interested in time to an event of interest as the outcome variable. Often in a clinical trial the goal is to evaluate the effectiveness of a new treatment at prolonging survival; i.e.

to extend the time to the event of death. It is usually the case that at the end of followup a portion of the subjects in the trial have not experienced the event; for these subjects the outcome variable is censored. Similarly, in engineering studies, often the lifetimes of mechanical or electrical parts are of interest. In a typical experimental design, lifetimes of these parts are recorded along with covariates (including design variables). Often the lifetimes are called failure times, i.e., times until failure. As in a clinical study, at the end of the experiment, there may be parts which are still functioning (censored observations).

In this chapter we discuss standard nonparametric and semiparametric methods for analysis of time to event data. In Section 6.2, we discuss the Kaplan–Meier estimate of the survival function for these models and asso-ciated nonparametric tests. Section 6.3 introduces the proportional hazards analysis for these models, while in Section 6.4 we discuss rank-based fits of accelerated failure time models, which include proportional hazards models.

We illustrate our discussion with analyses of real datasets based on compu-tation by R functions. For a more complete introduction to survival data we refer the reader to Chapter 7 of Cook and DeMets (2008) or to the monograph by Kalbfleisch and Prentice (2002). Therneau and Grambsch (2000) provide a thorough treatment of modeling survival data using SAS and R/S.

6.2 Kaplan–Meier and Log Rank Test

Let T denote the time to an event. Assume T is a continuous random vari-able with cdf F (t). The survival function is defined as the probability that a subject survives until at least time t; i.e., S(t) = P (T > t) = 1 − F (t). When all subjects in the trial experience the event during the course of the study, 153

TABLE 6.1

Survival Times (in months) for Treatment of Pulmonary Metastasis.

11 13 13 13 13 13 14 14 15 15 17

so that there are no censored observations, an estimate of S(t) may be based on the empirical cdf. However, in most studies there are a number of subjects who are not known to have experienced the outcome prior to the study com-pletion. Kaplan and Meier (1958) developed their product-limit estimate as an estimate of S(t) which incorporates information from censored observations.

In this section we briefly discuss estimates of the survival function and also illustrate them via small samples. The focus, however, is on the R syntax for analysis. We describe how to store time to event data and censoring in R, as well as computation of the Kaplan–Meier estimate and the log-rank test – which is a standard test for comparing two survival distributions.

We begin with a brief overview of survival data as well as simple examples which illustrate the calculation of the Kaplan–Meier estimate.

Example 6.2.1 (Treatment of Pulmonary Metastasis). In a study of the treatment of pulmonary metastasis arising from osteosarcoma, survival time was collected; the data are provided in Table 6.1.

As there are no censored observation an estimate of the survival function at time t is

S(t) =ˆ #{ti> t}

n (6.1)

which is based on the empirical cdf. Because of the low number of distinct time points the estimate (6.1) is easily calculated by hand which we briefly illustrate next. Since n = 11, the result is

S(t) =ˆ

The estimated survival function is plotted in Figure 6.1.

Though (6.1) aids in the understanding of survival functions, it is not often useful in practice. In most clinical studies, at the end of followup there are subjects who have yet to experience the event being studied. In this case, the Kaplan–Meier product limit estimate is used which we describe briefly next.

Suppose n experimental units are put on test. Let t(1)< . . . < t(k)denote the ordered distinct event times. If there are censored responses, then k < n. Let

0 5 10 15

0.00.20.40.60.81.0

Time (in months)

Survival

FIGURE 6.1

Estimated survival curve ( ˆS(t)).

ni= #subjects at risk at the beginning of time t(i)and di= #events occurring at time t(i)(i.e., during that day, month, etc.). The Kaplan–Meier estimate of the survival function is defined as

S(t) =ˆ Y

t(i)≤t

 1 − di

ni



. (6.2)

Note that when there is no censoring (6.2) reduces to (6.1). To aid in inter-pretation, we illustrate the calculation in the following example.

Example 6.2.2 (Cancer Remission: Time to Relapse.). The data in Table 6.2 represent time to relapse (in months) in a cancer study. Notice, based on the

TABLE 6.2

Time in Remission (in months) in Cancer Study.

Relapse 3 6.5 6.5 10 12 15

Lost to followup 8.4

Alive and in remission at at end of study 4 5.7 10

TABLE 6.3

Illustration of the Kaplan–Meier Estimate.

t n d 1 − d/n S(t)

3 10 1 9/10 = 0.9 0.9

6.5 7 2 5/7 = 0.71 0.9*0.71 = 0.64 10 4 1 3/4 = 0.75 0.64*0.75 = 0.48 12 2 1 1/2 = 0.5 0.48*0.5 = 0.24

15 1 1 0/1 = 0.0 0

top row of the table, that there are k = 5 distinct survival event times. Table 6.3 illustrates the calculation of of the Kaplan–Meier estimate for this dataset.

Often a study on survival involves the effect that different treatments have on survival time. Suppose we have r independent groups (treatments). Let H0

be the null hypothesis that the distributions of the groups are the same; i.e., the population survival functions are the same. Obviously, overlaid Kaplan–

Meier survival curves provide an effective graphical comparison of the times until failure of the different treatment groups. A nonparametric test that is often used to test for a difference in group survival times is the log-rank test.

This test is complicated and complete details can be found, for example, in Kalbfleisch and Prentice (2002). Briefly, as above, let t1 < t2 < · · · < tk be the distinct failure times of the combined samples. Then at each time point tj, it can be shown that the number of failures in Group i conditioned on the total number of failures has a distribution-free hypergeometric distribution under H0. Based on this a goodness-of-fit type test statistic (called the log-rank test) can be formulated which has a χ2-distribution with r − 1 degrees of freedom under H0. The next example illustrates this discussion for the time until relapse of two groups of patients who had survived a lobar intracerebral hemorrhage.

Example 6.2.3 (Hemorrhage Data). For demonstration we use the hemor-rhage data discussed in Chapter 6 of Dupont (2002). The study population consisted of patients who had survived a lobar intracerebral hemorrhage and whose genotype was known. The outcome variable was the time until recur-rence of lobar intracerebral hemorrhage. The investigators were interested in examining the genetic effect on recurrence as there were three common alleles e2, e3, and e4. The analysis was focused on the effect of homozygous e3/e3 (Group 1) versus at least one e2 or e4 (Group 2). The data are available at the author’s website. The following code segment illustrates reading the data into R and converting it to a survival dataset which includes censoring infor-mation. Many of the functions for survival data are available in the R package survival(Therneau 2013).

> with(hemorrhage,Surv(round(time,2),recur))

[1] 0.23 1.05+ 1.22 1.38+ 1.41 1.51+ 1.58+ 1.58 3.06 3.32 [11] 3.52 3.55 4.04+ 4.63+ 4.76 8.08+ 8.44+ 9.53 10.61+ 10.68+

[21] 11.86+ 12.32 13.27+ 13.60+ 14.69+ 15.57 16.72+ 17.84+ 18.04+ 18.46+

[31] 18.46+ 18.46+ 18.66+ 19.15 19.55+ 19.75+ 20.11+ 20.27+ 20.47+ 24.77 [41] 24.87 25.56+ 25.63+ 26.32+ 26.81+ 28.09 30.52+ 32.95+ 33.05+ 33.61 [51] 34.99+ 35.06+ 36.24+ 37.03+ 37.52 37.75+ 38.54+ 38.97+ 39.16+ 40.61+

[61] 42.22+ 42.41+ 42.78+ 42.87 43.27+ 44.65+ 45.24+ 46.29+ 46.88+ 47.57+

[71] 53.88+

In the output are survival times (in months) for 71 subjects. However, one subject’s genotype information is missing and is excluded from analysis. Of the remaining 70 subjects, 32 are in Group 1 and 38 are in Group 2. A + sign indicates a censored observation; meaning that at that point in time the subject had yet to report recurrence. The study could have ended or the subject could have been lost to followup. Kaplan–Meier estimates are available through the command survfit. The resulting estimates may then be plotted, as is usually the case for Kaplan–Meier estimates, as the following code illustrates. If confidence bands are desired, one may use the conf.type option to survfit. Setting conf.type=’plain’ returns the usual Greenwood (1926) estimates.

> fit<-with(hemorrhage, survfit(Surv(time,recur)~genotype))

> plot(fit,lty=1:2,

+ ylab=’Probability of Hemorrhage-Free Survival’, + xlab=’Time (in Months)’

+ )

> legend(’bottomleft’,c(’Group 1’, ’Group 2’),lty=1:2,bty=’n’) As illustrated in Figure 6.2, patients that were homozygous e3/e3 (Group 1) seem to have significantly greater survival.

> with(hemorrhage, survdiff(Surv(time,recur)~genotype)) Call:

survdiff(formula = Surv(time, recur) ~ genotype) n=70, 1 observation deleted due to missingness.

N Observed Expected (O-E)^2/E (O-E)^2/V

genotype=0 32 4 9.28 3.00 6.28

genotype=1 38 14 8.72 3.19 6.28

Chisq= 6.3 on 1 degrees of freedom, p= 0.0122

Note that the log-rank test statistic is 6.3 with p-value 0.0122 based on a null χ2-distribution with 1 degree of freedom. Thus the log-rank test confirms the difference in survival time of the two groups.

0 10 20 30 40 50

0.00.20.40.60.81.0

Time (in Months)

Probability of Hemorrhage−Free Survival

Group 1 Group 2

FIGURE 6.2

Plots of Kaplan–Meier estimated survival distributions.

6.2.1 Gehan’s Test

Gehan’s test, (see Higgins (2003)), sometimes referred to as the Gehan–

Wilcoxon test, is an alternative to the log-rank test. Gehan’s method is a generalization of the Wilcoxon procedure discussed in Chapter 3. Suppose in a randomized controlled trial subjects are randomized to one of two treat-ments, say, with survival times represented by X and Y . Represent the sample as X1, . . . , Xn1 and Y1, . . . , Yn2 with a censored observation denoted by with a plus sign, Xi+, for example. Only unambiguous pairs of observations are used.

Not used are ambiguous observations such as when an observed X is greater than a censored Y (Xi > Yj+) or when both observations are censored. The test statistic is defined as the number of times each of the X clearly beats Y minus the number of times Y clearly beats X. Let S1denote the set of uncen-sored observations, S2 denote the set of observations for which X is censored and Y is uncensored, and S3 denote the set where Y is censored and X is uncensored. Then Gehan’s test statistic can be represented as

U = #S1{Xi> Yj} + #S2{Xi+≥ Yj}

− #S1{Yj> Xi} + #S3{Yj+≥ Xi} .

TABLE 6.4

Survival Times (in days) for Undergoing Standard Treatment (S) and a New Treatment (N).

S 94 180+ 741 1133 1261 382 567+ 988 1355+

N 155 375 951+ 1198 175 521 683+ 1216+

Example 6.2.4 (Higgins’ Cancer Data). Example 7.3.1 of Higgins (2003) describes an experiment to assess the effect of a new treatment relative to a standard. The data are in the dataset cancertrt, but for convenience the data are also given in Table 6.4. We illustrate the computation of Gehan’s test based on the npsm function gehan.test. There are three required arguments to the function: the survival time, an indicator variable indicating that the survival time corresponds to an event (and is not censored), and a dichotomous variable representing one of two treatments; see the output of the args function below.

> args(gehan.test)

function (time, event, trt) NULL

We use the function gehan.test next on the cancertrt dataset.

> with(cancertrt,gehan.test(time,event,trt)) statistic = -0.6071557 , p-value = 0.5437476

The results agree with those in Higgins. The two-sided p-value = 0.5437 which is not significant. As a final note, using the survdiff function with rho=1 gives the Peto–Peto modification of the Gehan test.