1 |
J |
|
K |
|
x |
|
tr |
|
JK |
|
grp |
|
alpha |
|
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | ##---- 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 (J, K, x, tr = 0.2, JK = J * K, grp = c(1:JK), alpha = 0.05,
SEED = TRUE)
{
if (is.matrix(x)) {
y <- list()
for (j in 1:ncol(x)) y[[j]] <- x[, j]
x <- y
}
JK <- J * K
if (JK != length(x))
stop("Something is wrong. Expected ", JK, " groups but x contains ",
length(x), "groups instead.")
MJ <- (J^2 - J)/2
MK <- (K^2 - K)/2
JMK <- J * MK
MJMK <- MJ * MK
Jm <- J - 1
data <- list()
for (j in 1:length(x)) {
data[[j]] <- x[[grp[j]]]
}
x <- data
output <- matrix(0, MJMK, 9)
dimnames(output) <- list(NULL, c("A", "A", "B", "B", "psihat",
"p.value", "p.crit", "EF.xi", "EF.WMW"))
jp <- 1 - K
kv <- 0
kv2 <- 0
test <- NA
for (j in 1:J) {
jp <- jp + K
xmat <- matrix(NA, ncol = K, nrow = length(x[[jp]]))
for (k in 1:K) {
kv <- kv + 1
xmat[, k] <- x[[kv]]
}
xmat <- elimna(xmat)
for (k in 1:K) {
kv2 <- kv2 + 1
x[[kv2]] <- xmat[, k]
}
}
m <- matrix(c(1:JK), J, K, byrow = T)
ic <- 0
for (j in 1:J) {
for (jj in 1:J) {
if (j < jj) {
for (k in 1:K) {
for (kk in 1:K) {
if (k < kk) {
ic <- ic + 1
output[ic, 1] <- j
output[ic, 2] <- jj
output[ic, 3] <- k
output[ic, 4] <- kk
x1 <- x[[m[j, k]]] - x[[m[j, kk]]]
x2 <- x[[m[jj, k]]] - x[[m[jj, kk]]]
temp <- yuenv2(x1, x2, SEED = SEED)
output[ic, 5] <- mean(x1, tr) - mean(x2,
tr)
test[ic] <- temp$p.value
output[ic, 6] <- test[ic]
output[ic, 8] <- temp$Effect.Size
output[ic, 9] = cid(x1, x2)$summary.dvals[1]
}
}
}
}
}
}
ncon <- length(test)
dvec <- alpha/c(1:ncon)
temp2 <- order(0 - test)
zvec <- dvec[1:ncon]
sigvec <- (test[temp2] >= zvec)
output[temp2, 7] <- zvec
output[, 7] <- output[, 7]
output
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.