1 |
x |
|
est |
|
nboot |
|
alpha |
|
SEED |
|
MC |
|
... |
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 37 | ##---- 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 = spatcen, nboot = 599, alpha = 0.05, SEED = TRUE,
MC = FALSE, ...)
{
if (!is.list(x) && !is.matrix(x))
stop("Data must be store in list mode or in an n by J matrix.")
if (is.list(x)) {
m <- matrix(0, length(x[[1]]), length(x))
for (j in 1:length(x)) m[, j] <- x[[j]]
}
if (is.matrix(x))
m <- x
xcen <- m
locval = est(m, ...)$center
locval = as.vector(locval)
for (j in 1:ncol(m)) xcen[, j] <- m[, j] - locval[j]
if (SEED)
set.seed(2)
data <- matrix(sample(nrow(m), size = nrow(m) * nboot, replace = TRUE),
nrow = nboot)
data = listm(t(data))
if (MC)
bvec <- mclapply(data, bd1GLOB1, xcen = xcen, est = est,
...)
if (!MC)
bvec <- lapply(data, bd1GLOB1, xcen = xcen, est = est,
...)
bvec = as.vector(matl(bvec))
icrit <- floor((1 - alpha) * nboot + 0.5)
test <- (length(locval) - 1) * var(locval)
pv = mean((test < bvec))
list(test = test, estimates = locval, p.value = pv)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.