1 |
x |
|
alpha |
|
null.val |
|
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 | ##---- 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, alpha = 0.05, null.val = NA, nboot = 500, SEED = TRUE,
...)
{
x <- elimna(x)
if (SEED)
set.seed(2)
data <- matrix(sample(x, size = length(x) * nboot, replace = TRUE),
nrow = nboot)
bvec <- apply(data, 1, median)
test <- NULL
if (!is.na(null.val)) {
tv <- sum(bvec == null.val)/nboot
test <- sum(bvec > null.val)/nboot + 0.5 * tv
if (test > 0.5)
test <- 1 - test
test <- 2 * test
}
bvec <- sort(bvec)
icl <- round(alpha * nboot/2) + 1
icu <- nboot - icl - 1
cilow <- bvec[icl]
ciup <- bvec[icu]
list(ci.low = cilow, ci.up = ciup, p.value = test)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.