survdiff(formula, data, subset, na.action, rho=0)
Surv(time, status) ~ predictors
. For a one-sample test, the predictors
must consist of a single offset(sp)
term, where sp
is a vector giving the
survivamodel.frame
after any
subset argument has been used. Default is options()$na.action
.rho = 0
this is the log-rank or Mantel-Haenszel test,
and with rho = 1
it is equivalent to the Peto & Peto modification
of the Gehan-Wilcoxon test.
If the right hand side of the formula consists only of an offset term,
then a one sample test is done.
To cause missing values in the predictors to be treated as a separate
group, rather than being omitted, use the factor
function with its
exclude
argument.
## need "date" package for this example if (require("date",quietly=TRUE)){ data(heart) data(ratetables) ## 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=F, ratetable=survexp.usr) ## actual survival is much worse (no surprise) print(survdiff(Surv(jasa$futime, jasa$fustat) ~ offset(expect))) detach("package:date") rm(jasa,jasa1,heart,survexp.az,survexp.azr,survexp.fl,survexp.flr,survexp.mn,survexp.mnwhite,survexp.us,survexp.usr,survexp.wnc) }