Practical exercise 4


The survfit command in R can be used to (i) to estimate the survival function directly form right-censored and/or left-truncated survival data, or (ii) to estimate the survival function from a fitted Cox-model. In this exercise we will look at the various options for the survfit command when used in the first of these two situations.


The survfit command may compute three different estimates for the survival function. These are specified by the type-option. The possibilities are type="kaplan-meier" (default) type="fleming-harrington", and type="fh2" (only the first two characters are necessary).


Here "kaplan-meier" computes the Kaplan-Meier estimator given by (3.26) and (3.32) in ABG, while the two other options computes the survival estimate as exp{-Nelson-Aalen}. The difference between the two is the treatment of ties for the Nelson-Aalen estimator. Type "fleming-harrington" computes the Nelson-Aalen estimator using (3.13) in ABG, while type "fh2" uses (3.12).


For comparison of the different survival estimates, we will use the leukemia data from Exercise 3.1. You may read the data into R by the command:

leukemia=read.table("", header=T)


a) Compute the three estimates for the survival function and compare the results. Which estimates is the smallest and which is the largest?


The survfit command may also compute two different estimates of the standard error. These are specified by the error-command. The possibilites are error="greenwood" and error="tsiatis" (only the first character is necessary).


Here error="greenwood" together with type="kaplan-meier" (both are defaults) computes Greenwood's formula given by (3.28) and (3.33) in ABG, while error="tsiatis" together with type="fh2" computes (3.27), using the modification (3.15) when there are ties [cf. the comment just above (3.33) in ABG].


b) Compute the two standard error estimates and compare the results.