comp(x, ...)
## S3 method for class 'survfit':
comp(x, ..., FHp = 1, FHq = 1,
lim = 10000, scores = NULL)
## S3 method for class 'coxph':
comp(x, ..., FHp = 1, FHq = 1,
scores = NULL, lim = 10000)
survfit
or coxph
objecttne
and tests
.
The first is a data.table
with one row for
each time at which an event occurred. Columns show time,
no. at risk and no. events (by stratum and overall).
The second contains the tests, as a list.
The
first element is the log-rank family of tests.
The
following additional tests depend on the no. of strata:
For a survfit
or a coxph
object with 2
strata, these are the Supremum (Renyi) family of tests.
For a survfit
or coxph
object with at
least 3 strata, there are tests for trend.covMatSurv
.
The sum is taken to the largest observed survival time
(i.e. censored observations are excluded).
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 strata this simplifies to: $$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 }}}$$
Here $e$ and $n$ refer to the no. events and no.
at risk overall and $e1$ and $n1$ refer to the
no. events and no. at risk in group $1$.
The
weights are given as follows: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object] 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)} ,t<\tau$$ 0="" when="" the="" null="" hypothesis="" is="" true,="" distribution="" of="" $q$="" approximately="" $$q="" \sim="" \sup{|b(x)|,="" \quad="" \leq="" x="" 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 (as in covMatSurv
).
If ordering
is present, the statistic $Z$ will be greater than
the upper $\alpha$th percentile of a standard
normal distribution.\tau$$>### 2 curves
data(kidney,package="KMsurv")
s1 <- survfit(Surv(time=time, event=delta) ~ type, data=kidney)
comp(s1)
### 3 curves
data(bmt, package="KMsurv")
comp(survfit(Surv(time=t2, event=d3) ~ group, data=bmt))
### see effect of F-H test
data(alloauto, package="KMsurv")
s3 <- survfit(Surv(time, delta) ~ type, data=alloauto)
comp(s3, FHp=0, FHq=1)
### trend tests
data(larynx, package="KMsurv")
s4 <- survfit(Surv(time, delta) ~ stage, data=larynx)
comp(s4)
### Renyi tests
data(gastric)
s5 <- survfit(Surv(time, event) ~ group, data=gastric)
comp(s5)
data(kidney,package="KMsurv")
c1 <- coxph(Surv(time=time, event=delta) ~ type, data=kidney )
comp(c1)
Run the code above in your browser using DataLab