surv2.ks {surv2sample} | R Documentation |
Performs the Kolmogorov–Smirnov, Cramer–von Mises and Anderson–Darling test to compare the distribution of survival times in two samples of censored data.
surv2.ks(x, group, process = "w", approx = "lwy", nsim = 2000, nsim.plot = 50)
x |
a "Surv" object, as returned by the Surv
function. |
group |
a vector indicating to which group each observation belongs. May contain values 1 and 2 only. |
process |
the type of the test process. Possible values are
"w" for the difference of Nelson–Aalen estimates
(asymptotically a Brownian motion, i.e., Wiener process),
"b" for a transformation of this process (asymptotically
a Brownian bridge). |
approx |
the method of approximating the distribution of
test statistics. Possible values are "lwy" or "mart"
for the martingale-based simulation, "perm" for permutations,
"boot" for the bootstrap. |
nsim |
the number of simulations (martingale simulations, permutations or bootstrap samples). |
nsim.plot |
the number of simulated paths of the test process
to be returned (for possible plotting). Must be at most nsim . |
The function implements tests based on functionals of the logrank
process U(t) (which is the process of logrank statistics computed
from observations in (0,t), see Section 7.5 of Fleming and
Harrington (1991)). This process (properly normalised) is
asymptotically a Brownian motion in transformed
time. If process
is "w"
, the supremum (KS) and integral
(CM, AD) test statistics are computed from this process.
If process
is "b"
, the tests are instead based on the
process U(t)(1+v(t)/v(tau))^(-1),
which is asymptotically a Brownian bridge in transformed time.
A list with class attributes "surv2.int"
and "lwy.test"
,
with main components:
stat.ks |
the Kolmogorov–Smirnov statistic. |
pval.ks |
the corresponding p-value. |
pval.ks.asympt |
the asymptotic p-value. |
stat.cm |
the Cramer–von Mises statistic. |
pval.cm |
the corresponding p-value. |
stat.ad |
the Anderson–Darling statistic. |
pval.ad |
the corresponding p-value. |
time |
sorted times. |
test.process |
the test process. |
test.process.sim |
simulated paths of the test process
(a matrix with nsim.plot columns). |
Some of input arguments are also contained in the output.
David Kraus (http://www.davidkraus.net/)
Andersen, P. K., Borgan, O., Gill, R. D. and Keiding, N. (1993) Statistical Models Based on Counting Processes. Springer, New York.
Fleming, T. R. and Harrington, D. P. (1991) Counting Processes and Survival Analysis. Wiley, New York.
See the plot
method inherited from
the class "lwy.test"
.
See also surv2.neyman
, surv2.logrank
,
survdiff
, survfit.
## gastric cancer data data(gastric) ## print results print(a <- surv2.ks(Surv(gastric$time, gastric$event), gastric$treatment)) ## plot the test process and simulated paths plot(a)