survdiff(formula, data, rho=0, subset)
formula
|
a formula expression as for other survival models, of the form
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
survival probability of each subject. For a k-sample test, each unique
combination of predictors defines a subgroup.
To cause missing values in the predictors to be treated as a separate
group, rather than being omitted, use the strata function with its
na.group=T argument.
|
data
| an optional data frame in which to interpret the variables occurring in the formula. |
rho
| a parameter that controls the type of test. |
subset
| subset of the observations to be used in the fit. |
n
| the number of subjects in each group. |
obs
| the weighted observed number of events in each group. |
exp
| the weighted expected number of events in each group. |
chisq
| the chisquare statistic for a test of equality. |
rho = 0
this is the log-rank or Mantel-Haenszel test,
and when 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.
survdiff.print
.survdiff(Surv(futime, fustat) ~ rx) expect <- survexp(entry, birth, sex, futime) survdiff(Surv(futime, fustat) ~ offset(expect$surv)) #One sample log-rank