sparcc: This is the main function

Usage Arguments Examples

Usage

1
sparcc(x, max.iter = 20, th = 0.1, exiter = 10)

Arguments

x
max.iter
th
exiter

Examples

 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))
  }

MPBA/r-sparcc documentation built on May 8, 2019, 3:22 p.m.