1 | med1way.crit(n, alpha = 0.05, iter = 1000, TEST = NA, SEED = TRUE)
|
n |
|
alpha |
|
iter |
|
TEST |
|
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 | ##---- 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 (n, alpha = 0.05, iter = 1000, TEST = NA, SEED = TRUE)
{
J <- length(n)
x <- list()
w <- vector("numeric", J)
xbar <- vector("numeric", J)
if (SEED)
set.seed(2)
chk <- NA
grp <- c(1:J)
for (it in 1:iter) {
for (j in 1:J) {
x[[j]] <- rnorm(n[j])
w[j] <- 1/msmedse(x[[grp[j]]])^2
xbar[j] <- median(x[[grp[j]]])
n[j] <- length(x[[grp[j]]])
}
u <- sum(w)
xtil <- sum(w * xbar)/u
chk[it] <- sum(w * (xbar - xtil)^2)/(J - 1)
}
chk <- sort(chk)
iv <- round((1 - alpha) * iter)
crit.val <- chk[iv]
pval <- NA
if (!is.na(TEST))
pval <- sum((TEST <= chk))/iter
list(crit.val = crit.val, p.value = pval)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.