Comparing survival distributions

setwd("D:\\TEMP")
library(survival)
dat <- read.table("addict.csv", header = TRUE, sep = ",")

Kaplan-Meier survival function of days to relapse, stratifying by clinic:

addict.km <- survfit(Surv(stop, status) ~ clinic, type = "kaplan-meier", data = dat)
plot(addict.km, xlab = "Days to relapse", ylab = "Cumulative proportion to experience event", lty = c(1,2))
legend(x = "topright", legend = c("Clinic 1", "Clinic 2"), lty = c(1,2), bty = "n")

In the survdiff function the argument rho = 0 returns the log-rank or Mantel-Haenszel test, rho = 1 returns the Peto and Peto modification of the Gehan-Wilcoxon test. Mantel-Haenszel test:

survdiff(Surv(stop, status) ~ clinic, data = dat, na.action = na.omit, rho = 0)

Peto and Peto modification of the Gehan-Wilcoxon test:

survdiff(Surv(stop, status) ~ clinic, data = dat, na.action = na.omit, rho = 1)