1 |
x |
|
est |
|
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 36 | ##---- 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, est = mest, nboot = 599, SEED = TRUE, ...)
{
if (is.data.frame(x))
x = as.matrix(x)
if (is.matrix(x))
x <- listm(x)
if (!is.list(x))
stop("Data must be stored in list mode or a matrix.")
J <- length(x)
for (j in 1:J) x[[j]] = elimna(x[[j]])
nval <- vector("numeric", length(x))
gest <- vector("numeric", length(x))
if (SEED)
set.seed(2)
bvec <- matrix(0, J, nboot)
for (j in 1:J) {
nval[j] <- length(x[[j]])
gest[j] <- est(x[[j]])
xcen <- x[[j]] - est(x[[j]], ...)
data <- matrix(sample(xcen, size = length(x[[j]]) * nboot,
replace = TRUE), nrow = nboot)
bvec[j, ] <- apply(data, 1, est, ...)
}
teststat <- wsumsq(gest, nval)
testb <- apply(bvec, 2, wsumsq, nval)
p.value <- 1 - sum(teststat >= testb)/nboot
teststat <- wsumsq(gest, nval)
if (teststat == 0)
p.value <- 1
list(teststat = teststat, p.value = p.value)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.