variation.mat: Compute the variation matrix

Usage Arguments Examples

Usage

1

Arguments

fracs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
##---- 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 (fracs) 
{
    V <- matrix(NA, ncol = dim(fracs)[2], nrow = dim(fracs)[2])
    tmplog <- apply(fracs, 2, log)
    idx <- combn(1:dim(fracs)[2], 2)
    ttmp <- tmplog[, idx[1, ]] - tmplog[, idx[2, ]]
    vartmp <- apply(ttmp, 2, var)
    for (i in 1:length(vartmp)) {
        V[idx[1, i], idx[2, i]] <- V[idx[2, i], idx[1, i]] <- vartmp[i]
    }
    diag(V) <- 1
    return(V)
  }

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