basis.var: This is the basis variance function

Usage Arguments Examples

Usage

1
basis.var(fracs, V, Vmin = 1e-04, excluded = NULL, Covmat = NULL, M = NULL)

Arguments

fracs
V
Vmin
excluded
Covmat
M

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
##---- 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, Vmin = 1e-04, excluded = NULL, Covmat = NULL, 
    M = NULL) 
{
    Vsize <- dim(V)
    Vvec <- apply(V, 1, sum)
    if (is.null(Covmat)) 
        Covmat <- matrix(0, nrow = Vsize[1], ncol = Vsize[2])
    Covvec <- apply(Covmat - diag(Covmat), 1, sum)
    if (is.null(M)) {
        M <- matrix(1, nrow = Vsize[1], ncol = Vsize[2])
        diag(M) <- Vsize[1] - 1
    }
    Minv <- solve(M)
    Vbase <- Minv %*% (Vvec + 2 * Covvec)
    Vbase[Vbase < 0] <- Vmin
    return(list(Vbase = Vbase, M = M))
  }

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