11.9 Log-Rank test

As discussed in the book, Section 11.4, we can perform a log-rank test to compare the survival of males to females, using the survdiff() function.

See also Exercise 7 to go into depth on this!

logrank.test <- survdiff(Surv(time, status) ~ sex, data = BrainCancer)
logrank.test
## Call:
## survdiff(formula = Surv(time, status) ~ sex, data = BrainCancer)
## 
##             N Observed Expected (O-E)^2/E (O-E)^2/V
## sex=Female 45       15     18.5     0.676      1.44
## sex=Male   43       20     16.5     0.761      1.44
## 
##  Chisq= 1.4  on 1 degrees of freedom, p= 0.2

The resulting \(p\)-value is \(0.23\), indicating no evidence of a difference in survival between the two sexes.