1

After running a PCA with real-valued data and a symmetric correlation matrix I'm getting back complex numbers in the principle components. When I do random sampling on the underlying data I see that sometimes the principal components are real-valued and sometimes complex. Is it safe to say the imaginary components of the complex numbers are due to rounding errors, and if so can I just ignore those and use the real-valued components?

Here's a sample of the output from the PCA (numpy ndarray):

[[ 0.05569296+0.j          0.06106935+0.j         -0.16634077+0.j        ...,
  -0.36472664+0.j          0.05560288+0.11046671j  0.05560288-0.11046671j]
 [-0.23671305+0.j         -0.04771023+0.j          0.29670382+0.j         ...,
  -0.07562527+0.j          0.19574243-0.01649267j  0.19574243+0.01649267j]
benten
  • 1,995
  • 2
  • 23
  • 38
  • 1
    `Is it safe to say the imaginary components of the complex numbers are due to rounding errors` no. ` if so can I just ignore those and use the real-valued components?` no. I think it is an indication you don't have symmetric real matrix as input to eigendecomposition – Severin Pappadeux Mar 25 '16 at 18:42
  • It's symmetric, as I meentioned in the title and body. It's also real as I mentioned in the body. Thanks for the valuable feedback. – Jan-Samuel Wagner Mar 25 '16 at 23:09
  • 1
    I'm sorry, but that is hard to believe. For example, which term, do you think, in `0.05560288-0.11046671j` is due to rounding? – Severin Pappadeux Mar 25 '16 at 23:51
  • Basically, you have to make good test for eigendecomposition. Eigenvalues and eigenvectors together with symmetric original matrix suppose to satisfy pretty simple relations, aren't they? – Severin Pappadeux Mar 26 '16 at 00:42
  • The reason I thought it might be due to rounding is because when I iterate and randomly sample from my dataset the principle components are only sometimes complex. At other times they are real valued. This seems very strange to me. – Jan-Samuel Wagner Mar 28 '16 at 13:41

0 Answers0