I have asked this on stack overflow but couldn't get an answer. I am using the fastICA implementation in R. Example code:
library(fastICA)
#repeating ICA analysis 10 times
icaResults<-list()
for(i in 1:10) icaResults[[i]]<-fastICA(myMatrix, 5)$S
#calculating reproducibility of components
corMatrix<-matrix(nrow = 5, ncol=10)
ica1<-icaResults[[1]]
for(i in 2:10)
for(c in 1:5)
corMatrix[c, i]<-max( abs(cor(ica1[,c], icaResults[[i]])) )
It seems that the ICA doesn't give me the same results upont 10x repetition:
> round(corMatrix, 3)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] NA 0.933 0.997 0.996 0.951 0.985 0.651 0.998 0.999 0.992
[2,] NA 0.980 0.994 0.994 0.992 0.943 0.875 0.992 0.995 1.000
[3,] NA 0.975 0.990 0.990 0.995 0.945 0.837 0.986 0.992 1.000
[4,] NA 0.921 0.995 0.995 0.943 0.885 0.740 0.993 0.996 1.000
[5,] NA 0.996 0.998 0.996 1.000 0.994 0.998 0.998 1.000 0.992
The results are often similar but sometimes there is quite a variability in the resulting ica$S
matrices. E.g. Repertition 7 in the code above seems to be quite different. I know that the order of the components can be random, but this problem is independent from the order.
Why is that? Is that inherent to ICA analysis that there is some randomness?
I noticed that it also depends on the actual values in the matrix and the number of components (for some matrices the results are more consistent than for others and it seems to be less consistent with more components).
UPDATE: I have update the code examples
myMatrix
and you have not set the seed. More information on how to make a reproducible example: stackoverflow.com/help/minimal-reproducible-example $\endgroup$ – Sycorax♦ Sep 19 '19 at 13:23