comp {survMisc} | R Documentation |
compare survival curves
Description
compare survival curves
Usage
comp(x, ...)
## S3 method for class 'ten'
comp(x, ..., p = 1, q = 1, scores = seq.int(attr(x, "ncg")), reCalc = FALSE)
Arguments
x |
A |
... |
Additional arguments (not implemented). |
p |
|
q |
|
scores |
scores for tests for trend |
reCalc |
Recalcuate the values?
|
Details
The log-rank tests are formed from the following elements, with values for each time where there is at least one event:
-
W_i
, the weights, given below. -
e_i
, the number of events (per time). -
\hat{e_i}
, the number of predicted events, given bypredict
. -
COV_i
, the covariance matrix for timei
, given byCOV
.
It is calculated as:
Q_i = \sum{W_i (e_i - \hat{e}_i)}^T
\sum{W_i \hat{COV_i} W_i^{-1}}
\sum{W_i (e_i - \hat{e}_i)}
If there are K
groups, then K-1
are selected (arbitrary).
Likewise the corresponding variance-covariance matrix is reduced to the
appropriate K-1 \times K-1
dimensions.
Q
is distributed as chi-square with K-1
degrees of freedom.
For 2
covariate groups, we can use:
-
e_i
the number of events (per time). -
n_i
the number at risk overall. -
e1_i
the number of events in group1
. -
n1_i
the number at risk in group1
.
Then:
Q = \frac{\sum{W_i [e1_i - n1_i (\frac{e_i}{n_i})]} }{
\sqrt{\sum{W_i^2 \frac{n1_i}{n_i}
(1 - \frac{n1_i}{n_i})
(\frac{n_i - e_i}{n_i - 1}) e_i }}}
Below, for the Fleming-Harrington weights,
\hat{S}(t)
is the Kaplan-Meier (product-limit) estimator.
Note that both p
and q
need to be \geq 0
.
The weights are given as follows:
1 | log-rank | |
n_i | Gehan-Breslow generalized Wilcoxon | |
\sqrt{n_i} | Tarone-Ware | |
S1_i | Peto-Peto's modified survival estimate |
\bar{S}(t)=\prod{1 - \frac{e_i}{n_i + 1}} |
S2_i | modified Peto-Peto (by Andersen) |
\tilde{S}(t)=\bar{S} - \frac{n_i}{n_i + 1} |
FH_i | Fleming-Harrington |
The weight at t_0 = 1 and thereafter is:
\hat{S}(t_{i-1})^p [1-\hat{S}(t_{i-1})^q]
|
The supremum (Renyi) family of tests are designed
to detect differences in survival curves which cross.
That is, an early difference in survival in favor of one group
is balanced by a later reversal.
The same weights as above are used.
They are calculated by finding
Z(t_i) = \sum_{t_k \leq t_i} W(t_k)[e1_k - n1_k\frac{e_k}{n_k}], \quad i=1,2,...,k
(which is similar to the numerator used to find Q
in the log-rank test for 2 groups above).
and it's variance:
\sigma^2(\tau) = \sum_{t_k \leq \tau} W(t_k)^2 \frac{n1_k n2_k (n_k-e_k) e_k}{n_k^2 (n_k-1)}
where \tau
is the largest t
where both groups have at least one subject at risk.
Then calculate:
Q = \frac{ \sup{|Z(t)|}}{\sigma(\tau)}, \quad t<\tau
When the null hypothesis is true,
the distribution of Q
is approximately
Q \sim \sup{|B(x)|, \quad 0 \leq x \leq 1}
And for a standard Brownian motion (Wiener) process:
Pr[\sup|B(t)|>x] = 1 - \frac{4}{\pi}
\sum_{k=0}^{\infty}
\frac{(- 1)^k}{2k + 1} \exp{\frac{-\pi^2(2k + 1)^2}{8x^2}}
Tests for trend are designed to detect ordered differences in survival curves.
That is, for at least one group:
S_1(t) \geq S_2(t) \geq ... \geq S_K(t) \quad t \leq \tau
where \tau
is the largest t
where all groups have at least one subject at risk.
The null hypothesis is that
S_1(t) = S_2(t) = ... = S_K(t) \quad t \leq \tau
Scores used to construct the test are typically s = 1,2,...,K
,
but may be given as a vector representing a numeric characteristic of the group.
They are calculated by finding:
Z_j(t_i) = \sum_{t_i \leq \tau} W(t_i)[e_{ji} - n_{ji} \frac{e_i}{n_i}],
\quad j=1,2,...,K
The test statistic is:
Z = \frac{ \sum_{j=1}^K s_jZ_j(\tau)}{\sqrt{\sum_{j=1}^K \sum_{g=1}^K s_js_g \sigma_{jg}}}
where \sigma
is the the appropriate element in the
variance-covariance matrix (see COV
).
If ordering is present, the statistic Z
will be greater than the
upper \alpha
-th
percentile of a standard normal distribution.
Value
The tne
object is given
additional attributes
.
The following are always added:
lrt |
The log-rank family of tests |
lrw |
The log-rank weights (used in calculating the tests). |
An additional item depends on the number of covariate groups.
If this is =2
:
sup |
The supremum or Renyi family of tests |
and if this is >2
:
tft |
Tests for trend. This is given as a |
Note
Regarding the Fleming-Harrington weights:
-
p = q = 0
gives the log-rank test, i.e.W=1
-
p=1, q=0
gives a version of the Mann-Whitney-Wilcoxon test (tests if populations distributions are identical) -
p=0, q>0
gives more weight to differences later on -
p>0, q=0
gives more weight to differences early on
The example using alloauto
data illustrates this.
Here the log-rank statistic
has a p-value of around 0.5
as the late advantage of allogenic transplants
is offset by the high early mortality. However using
Fleming-Harrington weights of p=0, q=0.5
,
emphasising differences later in time, gives a p-value of 0.04.
Stratified models (stratTen
) are not yet supported.
References
Gehan A. A Generalized Wilcoxon Test for Comparing Arbitrarily Singly-Censored Samples. Biometrika 1965 Jun. 52(1/2):203–23. ‘http://www.jstor.org/stable/2333825’ JSTOR
Tarone RE, Ware J 1977 On Distribution-Free Tests for Equality of Survival Distributions. Biometrika;64(1):156–60. ‘http://www.jstor.org/stable/2335790’ JSTOR
Peto R, Peto J 1972 Asymptotically Efficient Rank Invariant Test Procedures. J Royal Statistical Society 135(2):186–207. ‘http://www.jstor.org/stable/2344317’ JSTOR
Fleming TR, Harrington DP, O'Sullivan M 1987 Supremum Versions of the Log-Rank and Generalized Wilcoxon Statistics. J American Statistical Association 82(397):312–20. ‘http://www.jstor.org/stable/2289169’ JSTOR
Billingsly P 1999 Convergence of Probability Measures. New York: John Wiley & Sons. ‘http://dx.doi.org/10.1002/9780470316962’ Wiley (paywall)
Examples
## Two covariate groups
data("leukemia", package="survival")
f1 <- survfit(Surv(time, status) ~ x, data=leukemia)
comp(ten(f1))
## K&M 2nd ed. Example 7.2, Table 7.2, pp 209--210.
data("kidney", package="KMsurv")
t1 <- ten(Surv(time=time, event=delta) ~ type, data=kidney)
comp(t1, p=c(0, 1, 1, 0.5, 0.5), q=c(1, 0, 1, 0.5, 2))
## see the weights used
attributes(t1)$lrw
## supremum (Renyi) test; two-sided; two covariate groups
## K&M 2nd ed. Example 7.9, pp 223--226.
data("gastric", package="survMisc")
g1 <- ten(Surv(time, event) ~ group, data=gastric)
comp(g1)
## Three covariate groups
## K&M 2nd ed. Example 7.4, pp 212-214.
data("bmt", package="KMsurv")
b1 <- ten(Surv(time=t2, event=d3) ~ group, data=bmt)
comp(b1, p=c(1, 0, 1), q=c(0, 1, 1))
## Tests for trend
## K&M 2nd ed. Example 7.6, pp 217-218.
data("larynx", package="KMsurv")
l1 <- ten(Surv(time, delta) ~ stage, data=larynx)
comp(l1)
attr(l1, "tft")
### see effect of F-H test
data("alloauto", package="KMsurv")
a1 <- ten(Surv(time, delta) ~ type, data=alloauto)
comp(a1, p=c(0, 1), q=c(1, 1))