**Practical exercise 3**

In this exercise we consider two ways of handling tied failure times when computing Nelson-Aalen estimates. For illustration we will use the leukemia data described in exercise 3.1 in the ABG-book. The data may be read into R by the command:

leukemia=read.table("http://folk.uio.no/borgan/abg-2008/data/leukemia.txt", header=T)

The leukemia data contain a number of ties failure times. As described in section 3.1.3 in the ABG-book there are two ways these may be handled; cf. formulas (3.12) and (3.13).

The following commands compute Nelson-Aalen estimates for the placebo group according to the two ways of handling tied observations (the estimates are found as minus the logarithm of an estimate of the survival function):

fit.b=coxph(Surv(time,status)~1, data=leukemia, subset=(treat==1), method="breslow")

surv.b=survfit(fit.b)

fit.e=coxph(Surv(time,status)~1, data=leukemia, subset=(treat==1), method="efron")

surv.e=survfit(fit.e)

cbind(surv.b$time,-log(surv.b$surv),-log(surv.e$surv))

Note that the difference between the commands is the choice of method for handling tied failure times, specified as the "breslow" method and the "efron" method (the latter being the default in R).

a) Perform the commands above and inspect the output. Make sure that the Nelson-Aalen estimates you get correspond to those obtained from formulas (3.12) and (3.13) in the ABG-book. Which of the two methods in R corresponds to (3.12) and which corresponds to (3.13)?

From the computations above the standard errors of the Nelson-Aalen estimates are given by surv.b$std.err and surv.e$std.err.

Thus the command

cbind(surv.b$time,surv.b$std.err^2,surv.e$std.err^2)

gives a table of the estimated variances.

b) Perform the command above and inspect the estimated variances. One of them corresponds to (3.15) in the ABG-book. Which one? Does the other correspond to (3.16)? If not, how is it computed?