# EXERCISE 3.4 # ============= # Read leukemia data: leukemia=read.table("http://folk.uio.no/borgan/abg-2008/data/leukemia.txt",header=T) # We compute Kaplan-Meier estimates for the placebo # and 6_MP group and plot them in one figure #(Remember that you have to load the survival-library) fit.3.4=survfit(Surv(time,status)~strata(treat),data=leukemia) plot(fit.3.4, mark.time=F,xlim=c(0,25),xlab="Weeks",lty=1:2) legend("topright",c("Placebo","6-MP"),lty=1:2) # EXERCISE 3.7 # ============= # We compute Kaplan-Meier estimates for the placebo group # with 95% log-minus-log transformed confidence limits: fit.3.7=survfit(Surv(time,status)~1,data=leukemia,subset=(treat==1),conf.type="log-log") plot(fit.3.7, mark.time=F,xlim=c(0,25),xlab="Weeks",lty=1:2) # We may add a horizontal line at 0.50 to easier read off the # estimated median with confidence intervals: abline(0.5,0,lty=3) # Note we obtain the estimated median with # confidence intervals by the command: print(fit.3.7)