matchICA: match independent components using the Hungarian method

Description Usage Arguments Value Author(s) References See Also Examples

Description

The ICA model is only identifiable up to signed permutations of the ICs. This function finds the signed permutation of a matrix S such that ||S%*%P - template|| is minimized. Optionally also matches the mixing matrix M.

Usage

1
matchICA(S, template, M = NULL)

Arguments

S

the n x d matrix of ICs to be matched

template

the n x d matrix that S is matched to.

M

an optional d x p mixing matrix corresponding to S that will also be matched to the template

Value

Returns the signed permutation of S that is matched to the template. If the optional argument M is provided, returns a list with the permuted S and M matrices.

Author(s)

Benjamin Risk

References

Kuhn, H. The Hungarian Method for the assignment problem Naval Research Logistics Quarterly, 1955, 2, 83 - 97

Risk, B.B., D.S. Matteson, D. Ruppert, A. Eloyan, B.S. Caffo. In review, 2013. Evaluating ICA methods with an application to resting state fMRI.

See Also

frobICA clue::solve_LSAP

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
set.seed(999)
nObs <- 1024
nComp <- 3
# simulate from some gamma distributions:
simS<-cbind(rgamma(nObs, shape = 1, scale = 2),
            rgamma(nObs, shape = 3, scale = 2),
            rgamma(nObs, shape = 9, scale = 0.5))

simM <- matrix(rnorm(9),3)
pMat <- matrix(c(0,-1,0,1,0,0,0,0,-1),3)
permS <- simS%*%pMat
permM <- t(pMat)%*%simM

matchedS <- matchICA(S = permS, template = simS, M = permM)
sum(abs(matchedS$S - simS))
sum(abs(simM - matchedS$M))

steadyICA documentation built on May 2, 2019, 7:30 a.m.