1 |
x |
|
y |
|
grp |
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 | ##---- 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, y = NULL, grp = NA)
{
if (is.list(x))
x <- matl(x)
if (!is.null(y[1]))
x = cbind(x, y)
x <- elimna(x)
if (is.na(grp[1]))
grp <- c(1:ncol(x))
if (!is.matrix(x))
stop("Data are not stored in a matrix or in list mode.")
K <- length(grp)
Jb <- matrix(1, K, K)
Ib <- diag(1, K)
Pb <- Ib - Jb/K
y <- matrix(rank(x), ncol = ncol(x))
ybar <- apply(y, 2, mean)
N <- ncol(x) * nrow(x)
vhat <- var(y)/N^2
test <- nrow(x) * sum((ybar - (N + 1)/2)^2)/N^2
trval <- sum(diag(Pb %*% vhat))
test <- test/trval
nu1 <- trval^2/sum(diag(Pb %*% vhat %*% Pb %*% vhat))
sig.level <- 1 - pf(test, nu1, 1e+06)
list(test.stat = test, nu1 = nu1, p.value = sig.level)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.