# 2017 update, exact tests for aml data
> library(survival)
> data(leukemia)
> aml = leukemia #rename for typing ease > #status = 0 are right-censored observations
> #log-rank test for equality of survival curves (asymptotic)
> survdiff(Surv(time, status) ~ x, data = aml)
Call:
survdiff(formula = Surv(time, status) ~ x, data = aml)
N Observed Expected (O-E)^2/E (O-E)^2/V
x=Maintained 11 7 10.69 1.27 3.4
x=Nonmaintained 12 11 7.31 1.86 3.4
Chisq= 3.4 on 1 degrees of freedom, p= 0.0653
> sqrt(3.4)
[1] 1.843909
> install.packages("coin")
> library(coin)
> #from package coin, permutation test ('exact') see HSAUR p.205
> # used to be surv_test(Surv(time, status) ~ x, data = aml, distribution = "exact")
> # nowadays in coin look at SurvivalTests, use instead logrank_test
> logrank_test(Surv(time, status) ~ x, data = aml)
Asymptotic Two-Sample Logrank Test
data: Surv(time, status) by x (Maintained, Nonmaintained)
Z = 1.8345, p-value = 0.06657
alternative hypothesis: true theta is not equal to 1
> logrank_test(Surv(time, status) ~ x, data = aml, distribution = "exact")
Exact Two-Sample Logrank Test
data: Surv(time, status) by x (Maintained, Nonmaintained)
Z = 1.8345, p-value = 0.06469
alternative hypothesis: true theta is not equal to 1
> logrank_test(Surv(time, status) ~ x, data = aml, distribution = approximate(B = 10000))
Approximative Two-Sample Logrank Test
data: Surv(time, status) by x (Maintained, Nonmaintained)
Z = 1.8345, p-value = 0.0708
alternative hypothesis: true theta is not equal to 1
> logrank_test(Surv(time, status) ~ x, data = aml, distribution = approximate(B = 10000))
Approximative Two-Sample Logrank Test
data: Surv(time, status) by x (Maintained, Nonmaintained)
Z = 1.8345, p-value = 0.0633
alternative hypothesis: true theta is not equal to 1
> logrank_test(Surv(time, status) ~ x, data = aml, distribution = approximate(B = 10000))
Approximative Two-Sample Logrank Test
data: Surv(time, status) by x (Maintained, Nonmaintained)
Z = 1.8345, p-value = 0.0631
alternative hypothesis: true theta is not equal to 1
> logrank_test(Surv(time, status) ~ x, data = aml, distribution = approximate(B = 10000))
Approximative Two-Sample Logrank Test
data: Surv(time, status) by x (Maintained, Nonmaintained)
Z = 1.8345, p-value = 0.0646
alternative hypothesis: true theta is not equal to 1
> # for larger problems this resampling alternative maybe useful, but even here varies a bit over replications with B = 10000