1 |
J |
|
K |
|
x |
|
grp |
|
p |
|
tr |
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 | ##---- 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, grp = c(1:p), p = J * K, tr = 0.2)
{
if (is.list(x))
x <- elimna(matl(x))
if (is.matrix(x))
x <- elimna(x)
data <- x
if (is.matrix(data))
data <- listm(data)
if (!is.list(data))
stop("Data are not stored in list mode or a matrix")
if (p != length(data)) {
print("The total number of groups, based on the specified levels, is")
print(p)
print("The number of groups stored in x is")
print(length(data))
print("Warning: These two values are not equal")
}
if (p != length(grp))
stop("Apparently a subset of the groups was specified that does not match the total number of groups indicated by the values for J and K.")
tmeans <- 0
h <- length(data[[grp[1]]])
v <- matrix(0, p, p)
for (i in 1:p) tmeans[i] <- mean(data[[grp[i]]], tr = tr,
na.rm = TRUE)
v <- covmtrim(data, tr = tr)
ij <- matrix(c(rep(1, J)), 1, J)
ik <- matrix(c(rep(1, K)), 1, K)
jm1 <- J - 1
cj <- diag(1, jm1, J)
for (i in 1:jm1) cj[i, i + 1] <- 0 - 1
km1 <- K - 1
ck <- diag(1, km1, K)
for (i in 1:km1) ck[i, i + 1] <- 0 - 1
cmat <- kron(cj, ik)
Qa <- trimww.sub(cmat, tmeans, v, h, J, K)
Qa.siglevel <- 1 - pf(Qa, J - 1, 999)
cmat <- kron(ij, ck)
Qb <- trimww.sub(cmat, tmeans, v, h, J, K)
Qb.siglevel <- 1 - pf(Qb, K - 1, 999)
cmat <- kron(cj, ck)
Qab <- trimww.sub(cmat, tmeans, v, h, J, K)
Qab.siglevel <- 1 - pf(Qab, (J - 1) * (K - 1), 999)
list(Qa = Qa, Qa.siglevel = Qa.siglevel, Qb = Qb, Qb.siglevel = Qb.siglevel,
Qab = Qab, Qab.siglevel = Qab.siglevel)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.