Description Usage Arguments Details Value Examples
One-sided exact / approximate permutation and asymptotic log-rank test
1 | exactLR(B, formula, data = parent.frame(), type = "exact")
|
B |
number of random permutations (only used if type="approximate") |
formula |
a formula object, as used by |
data |
data.frame or list containing the variables in "formula", by default "formula" is evaluated in the parent frame |
type |
if type="exact" performs complete enumeration of all permutations, if type="approximate" draw random permutations, if type="asymptotic" perform asymptotic log-rank test |
This function performs a standard exact or approximate permutation test which is only valid under the extended null hypothesis of equal survival AND censoring distributions.
A list containing the exact or approximate permutation p-value and the observed test statistic
1 2 3 4 5 6 7 8 9 10 11 12 | T <- rexp(20)
C <- rexp(20)
data <- data.frame(time=pmin(T, C), status=(T<=C), trt=rbinom(20, 1, 0.5))
# Approximate permutation test using 1000 random permutations
x <- exactLR(1000, Surv(time, status) ~ trt, data, "approximate")
print(paste("Approximate permutation p-value:", x$p))
# Exact permutation test
y <- exactLR(0, Surv(time, status) ~ trt, data, "exact")
print(paste("Exact permutation p-value:", y$p))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.