1 |
m |
|
nullv |
|
cop |
|
MM |
|
SEED |
|
nboot |
|
plotit |
|
MC |
|
xlab |
|
ylab |
|
STAND |
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | ##---- 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 (m, nullv = rep(0, ncol(m)), cop = 3, MM = FALSE, SEED = TRUE,
nboot = 500, plotit = TRUE, MC = FALSE, xlab = "VAR 1", ylab = "VAR 2",
STAND = TRUE)
{
if (SEED)
set.seed(2)
m <- elimna(m)
n <- nrow(m)
est = smean(m, MC = MC, cop = cop, STAND = STAND)
crit.level <- 0.05
if (n <= 120)
crit.level <- 0.045
if (n <= 80)
crit.level <- 0.04
if (n <= 60)
crit.level <- 0.035
if (n <= 40)
crit.level <- 0.03
if (n <= 30)
crit.level <- 0.025
if (n <= 20)
crit.level <- 0.02
data <- matrix(sample(n, size = n * nboot, replace = TRUE),
nrow = nboot)
val <- matrix(NA, ncol = ncol(m), nrow = nboot)
for (j in 1:nboot) {
mm <- m[data[j, ], ]
val[j, ] <- smean(mm, MC = MC, cop = cop, STAND = STAND)
}
if (!MC)
temp <- pdis(rbind(val, nullv), center = est)
if (MC)
temp <- pdisMC(rbind(val, nullv), center = est)
sig.level <- sum(temp[nboot + 1] < temp[1:nboot])/nboot
if (ncol(m) == 2 && plotit) {
plot(val[, 1], val[, 2], xlab = xlab, ylab = ylab)
temp3 <- est
points(temp3[1], temp3[2], pch = "+")
ic <- round((1 - crit.level) * nboot)
if (!MC)
temp <- pdis(val, center = est)
if (MC)
temp <- pdisMC(val, center = est)
temp.dis <- order(temp)
xx <- val[temp.dis[1:ic], ]
xord <- order(xx[, 1])
xx <- xx[xord, ]
temp <- chull(xx)
lines(xx[temp, ])
lines(xx[c(temp[1], temp[length(temp)]), ])
}
list(p.value = sig.level)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.