I need to use the survdiff
function to statistically compare (using log-rank test) the following survival functions:
(1) Male (Sex=1) and Female (Sex=2)
(2) Patients <= 65 years-old and Patients > 65 years-old
I used the following command
Male <- survdiff(Surv(time,Status)~sex==1,data=myeloma)
Female <- survdiff(Surv(time,Status)~sex==2,data=myeloma)
is that correct ?
Best Answer
The examples provided in
?survdiff
are pretty clear. Using some example data included insurvival
, thisIs testing for a difference in survival between individuals with
rx = 1
andrx = 2
. For your data, this will compare survival for males versus femalesAnd this will compare survival for <= 65 versus >65.