# This R code is posted as benignbreast.R # The data file is posted as benignbreast.txt # It does not have variable names on # the first line. First enter the data # into a data frame. set1 <- read.table("c:/stat565/bbreast.txt", header=F, col.names=c("stratum", "obs", "agmt", "fndx", "higd", "deg", "chk", "agp1", "agmn", "nlv", "liv", "wt", "aglp", "mst")) set1$time <- rep(2,length(set1$fndx))-set1$fndx set1$nvmr <-set1$mst set1$nvmr[set1$nvmr<5] <- 0 set1$nvmr <- set1$nvmr/5 # Attach the library with survival analysis functions library(survival) coxout <- coxph(Surv(time,fndx) ~ chk + wt + agmn + nvmr +strata(stratum), data=set1, method="exact") summary(coxout)