1 |
x |
|
grp |
|
alpha |
|
crit |
|
iter |
|
SEED |
|
pr |
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 | ##---- 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, grp = NA, alpha = 0.05, crit = NA, iter = 1000,
SEED = TRUE, pr = T)
{
if (is.data.frame(x))
x = as.matrix(x)
if (is.matrix(x)) {
y <- list()
for (j in 1:ncol(x)) y[[j]] <- x[, j]
x <- y
}
if (is.na(sum(grp[1])))
grp <- c(1:length(x))
if (!is.list(x))
stop("Data are not stored in a matrix or in list mode.")
J <- length(grp)
n <- vector("numeric", J)
w <- vector("numeric", J)
xbar <- vector("numeric", J)
for (j in 1:J) {
xx <- !is.na(x[[j]])
val <- x[[j]]
x[[j]] <- val[xx]
w[j] <- 1/msmedse(x[[grp[j]]])^2
xbar[j] <- median(x[[grp[j]]])
n[j] <- length(x[[grp[j]]])
}
pval <- NA
u <- sum(w)
xtil <- sum(w * xbar)/u
TEST <- sum(w * (xbar - xtil)^2)/(J - 1)
if (is.na(crit)) {
temp <- med1way.crit(n, alpha, SEED = SEED, iter = iter,
TEST = TEST)
crit.val <- temp$crit.val
}
if (!is.na(crit))
crit.val <- crit
list(TEST = TEST, crit.val = crit.val, p.value = temp$p.value)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.