#Commands to Practical exercise 2

 

# Read the data into R and attach survival library

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

library(survival)

 

# a) Different survival function estimates:

 
# Kaplan-Meier (default)
fit.ka=survfit(Surv(time,status)~treat, data=leukemia, type="ka", conf.type="none")
summary(fit.ka)

 

# exp{-Nelson-Aalen} with Nelson-Aalen given by (3.13):
fit.fl=survfit(Surv(time,status)~treat, data=leukemia, type="fl", conf.type="none")
summary(fit.fl)

 

# exp{-Nelson-Aalen} with Nelson-Aalen given by (3.12):
fit.fh=survfit(Surv(time,status)~treat, data=leukemia, type="fh", conf.type="none") 
summary(fit.fh)
 

# Compare results:

cbind(fit.ka$surv, fit.fl$surv, fit.fh$surv)

plot(fit.ka,mark.time=F)

lines(fit.fh,mark.time=F,lty=2)

lines(fit.fl,mark.time=F,lty=3)

 

# Note that fit.ka$surv <= fit.fh$surv <= fit.fl$surv

 

 

# b) Different standard error estimates:

 
# Greenwood (default)
fit.g=survfit(Surv(time,status)~treat, data=leukemia, error="g", conf.type="none")
summary(fit.ka)

 

# Standard error estimate using (3.27):
fit.t=survfit(Surv(time,status)~treat, data=leukemia, error="t", conf.type="none")
summary(fit.fl)

 

# Comparison of standard error estimates:

cbind(fit.g$surv*fit.g$std.err, fit.g$surv*fit.t$std.err)

 

# Note that (e.g.) fit.g$std.err gives the standard error estimate divided by estimated survival