I have a correlation matrix:
cor.table <- matrix( sample( c(0.9,-0.9) , 2500 , prob = c( 0.8 , 0.2 ) , repl = TRUE ) , 50 , 50 )
diag(cor.table) <- 1
I try to do eigenvalue decomposition:
library(psych)
fit<-principal(cor.table, nfactors=50,rotate="none")
or
stopifnot( eigen( cor.table )$values > 0 )
In both cases I get the error:
Error in eigens$values < .Machine$double.eps :
invalid comparison with complex values
What am I doing wrong?