## Two-sample test
survdiff(Surv(futime, fustat) ~ rx,data=ovarian)
## Stratified 7-sample test
survdiff(Surv(time, status) ~ pat.karno + strata(inst), data=lung)
## Expected survival for heart transplant patients based on
## US mortality tables
expect <- survexp(futime ~ ratetable(age=(accept.dt - birth.dt),
sex=1,year=accept.dt,race="white"), jasa, cohort=FALSE,
ratetable=survexp.usr)
## actual survival is much worse (no surprise)
survdiff(Surv(jasa$futime, jasa$fustat) ~ offset(expect))
Run the code above in your browser using DataLab