Description Usage Arguments Value METHOD References Examples
Tests if there is a difference between two or more survival curves using the Grho family of tests, or for a single curve against a known alternative.
1 
formula 
a formula expression as for other survival models, of the form

data 
an optional data frame in which to interpret the variables occurring in the formula. 
subset 
expression indicating which subset of the rows of data should be used in the fit. This can be a logical vector (which is replicated to have length equal to the number of observations), a numeric vector indicating which observation numbers are to be included (or excluded if negative), or a character vector of row names to be included. All observations are included by default. 
na.action 
a missingdata filter function. This is applied to the 
rho 
a scalar parameter that controls the type of test. 
a list with components:
n 
the number of subjects in each group. 
obs 
the weighted observed number of events in each group. If there are strata, this will be a matrix with one column per stratum. 
exp 
the weighted expected number of events in each group. If there are strata, this will be a matrix with one column per stratum. 
chisq 
the chisquare statistic for a test of equality. 
var 
the variance matrix of the test. 
strata 
optionally, the number of subjects contained in each stratum. 
This function implements the Grho family of
Harrington and Fleming (1982), with weights on each death of S(t)^rho,
where S is the KaplanMeier estimate of survival.
With rho = 0
this is the logrank or MantelHaenszel test,
and with rho = 1
it is equivalent to the Peto & Peto modification
of the GehanWilcoxon 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.
Harrington, D. P. and Fleming, T. R. (1982). A class of rank test procedures for censored survival data. Biometrika 69, 553566.
1 2 3 4 5 6 7 8 9 10 11 12 13 14  ## Twosample test
survdiff(Surv(futime, fustat) ~ rx,data=ovarian)
## Stratified 7sample 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))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.