### asymptotic tests for carcinoma data
surv_test(Surv(time, event) ~ stadium, data = ocarcinoma)
survdiff(Surv(time, event) ~ stadium, data = ocarcinoma)
### example data given in Callaert (2003)
exdata <- data.frame(time = c(1, 1, 5, 6, 6, 6, 6, 2, 2, 2, 3, 4, 4, 5, 5),
event = rep(TRUE, 15),
group = factor(c(rep(0, 7), rep(1, 8))))
### p = 0.0523
survdiff(Surv(time, event) ~ group, data = exdata)
### p = 0.0505
surv_test(Surv(time, event) ~ group, data = exdata,
distribution = exact())
### p = 0.0468
surv_test(Surv(time, event) ~ group, data = exdata,
distribution = exact(), ties = "average")
### lung cancer example from StatXact
`lungcancer` <- structure(list(time = c(257, 476, 355, 1779, 355, 191,
563, 242, 285, 16, 16, 16, 257, 16),
event = c(0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1),
group = structure(c(2L, 2L, 2L, 2L, 2L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("control", "newdrug"),
class = "factor")),
.Names = c("time", "event", "group"),
row.names = c("1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12", "13", "14"),
class = "data.frame")
### StatXact 6 manual, page 414
logrank_trafo(Surv(lungcancer$time, lungcancer$event),
ties = "average")
### StatXact 6 manual, page 415
surv_test(Surv(time, event) ~ group, data = lungcancer,
ties = "average", distribution = exact())
Run the code above in your browser using DataLab