1 | sparcc(x, max.iter = 20, th = 0.1, exiter = 10)
|
x |
|
max.iter |
|
th |
|
exiter |
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 | ##---- 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, max.iter = 20, th = 0.1, exiter = 10)
{
xdim <- dim(x)
Vlist <- matrix(NA, nrow = xdim[2], ncol = max.iter)
Corlist <- array(, dim = c(max.iter, xdim[2], xdim[2]))
Covlist <- array(, dim = c(max.iter, xdim[2], xdim[2]))
for (i in 1:max.iter) {
cat("Iteration: %d\n", i)
tmpres <- compute.corr(x, iter = exiter, th = th)
Vlist[, i] <- tmpres[["Vbase"]]
Corlist[i, , ] <- tmpres[["Cor.mat"]]
Covlist[i, , ] <- tmpres[["Cov.mat"]]
}
vdef <- apply(Vlist, 1, median)
cor.def <- apply(Corlist, 2:3, median)
vdefsq <- vdef^0.5
ttmp <- cor.def * vdefsq
cov.def <- t(ttmp) * vdefsq
return(list(CORR = cor.def, COV = cov.def, VBASIS = vdef))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.