## 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 ~ 1, data=jasa, cohort=FALSE,
rmap= list(age=(accept.dt - birth.dt), sex=1, year=accept.dt),
ratetable=survexp.us)
## actual survival is much worse (no surprise)
survdiff(Surv(jasa$futime, jasa$fustat) ~ offset(expect))
# The free light chain data set is close to the population.
e2 <- survexp(futime ~ 1, data=flchain, cohort=FALSE,
rmap= list(age= age*365.25, sex=sex,
year=as.Date(paste0(sample.yr, "-07-01"))),
ratetable= survexp.mn)
survdiff(Surv(futime, death) ~ offset(e2), flchain)
Run the code above in your browser using DataLab