#Commands to Practical exercise 4

 

 

# Read the data into R and attach the survival library

melanoma=read.table("http://www.uio.no/studier/emner/matnat/math/STK4080/h08/computing/melanoma.txt", header=T)

library(survival)

 

 

# a) Log-rank test for the hypothesis that the mortality is the same for the two genders:

survdiff(Surv(lifetime,status==1)~sex, data=melanoma)

 

# b) Log-rank test for the hypothesis that the mortality is the same for patients with ulceration present and absent:

survdiff(Surv(lifetime,status==1)~ulcer, data=melanoma)

 

 

# c) Log-rank test for the hypothesis that the mortality is the same for patients in the three thickness groups 0-1 mm, 2-5 mm, and 5+ mm:

survdiff(Surv(lifetime,status==1)~grthick, data=melanoma)