1 |
x |
|
y |
|
alpha |
|
nboot |
|
SEED |
|
... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, y, alpha = 0.05, nboot = 1000, SEED = TRUE, ...)
{
x <- elimna(x)
y <- elimna(y)
mvec <- NA
mvec[1] <- median(x)
mvec[2] <- median(y)
bvec <- NA
if (SEED)
set.seed(2)
datax <- matrix(sample(x, size = length(x) * nboot, replace = TRUE),
nrow = nboot)
datay <- matrix(sample(y, size = length(x) * nboot, replace = TRUE),
nrow = nboot)
bvec1 <- apply(datax, 1, median)
bvec2 <- apply(datay, 1, median)
test <- sum((bvec1 > bvec2))/nboot
tv <- sum(bvec1 == bvec2)/nboot
test <- test + 0.5 * tv
if (test > 0.5)
test <- 1 - test
test <- 2 * test
dvec <- sort(bvec1 - bvec2)
icl <- round(alpha * nboot/2) + 1
icu <- nboot - icl - 1
cilow <- dvec[icl]
ciup <- dvec[icu]
list(p.value = test, est.1 = mvec[1], est.2 = mvec[2], est.dif = mvec[1] -
mvec[2], ci.low = cilow, ci.up = ciup)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.