1 | winall(m, tr = 0.2)
|
m |
|
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 | ##---- 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 (m, tr = 0.2)
{
if (is.data.frame(m))
m = as.matrix(m)
if (!is.matrix(m))
stop("The data must be stored in a n by p matrix")
wcor <- matrix(1, ncol(m), ncol(m))
wcov <- matrix(0, ncol(m), ncol(m))
siglevel <- matrix(NA, ncol(m), ncol(m))
for (i in 1:ncol(m)) {
ip <- i
for (j in ip:ncol(m)) {
val <- wincor(m[, i], m[, j], tr)
wcor[i, j] <- val$cor
wcor[j, i] <- wcor[i, j]
if (i == j)
wcor[i, j] <- 1
wcov[i, j] <- val$cov
wcov[j, i] <- wcov[i, j]
if (i != j) {
siglevel[i, j] <- val$p.value
siglevel[j, i] <- siglevel[i, j]
}
}
}
cent = apply(m, 2, mean, tr)
list(cor = wcor, cov = wcov, center = cent, p.values = siglevel)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.