# About correlations and SVD [closed]

I'm trying to do SVD on the correlation matrix of a panel of 60 samples of 500 random variables. I expect the singular values of the matrix add up to 500.

The problem is that on rare occasions, I get insane singular values: they sum up to over 1000. There are two other clues: 1. If I try different correlation algorithms ... pearson, spearman, etc ... one may work when the other fails. Each of the correlation algorithms seems to produce insane singular values at times. I tried using R and Python correlation libraries 2. If I try dropping one row from the correlation matrix, often times, the singular values become sane again.

The way I'm going around this bug is to find the correlation in different ways till I find one where the Singular values add up to a sane value. I guess I could patch the algorithm to try all possible combinations of algorithms and row exclusions to get a very high probability of getting sane singular values, but I'm hoping there is a method to this madness.

Thanks !

-

## closed as off-topic by Ricardo Andrade, Stefan Kohl, Carlo Beenakker, Andrey Rekalo, Chris GodsilDec 8 '13 at 19:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question does not appear to be about research level mathematics within the scope defined in the help center." – Ricardo Andrade, Stefan Kohl, Carlo Beenakker, Andrey Rekalo, Chris Godsil
If this question can be reworded to fit the rules in the help center, please edit the question.

I'm not sure you've given enough context or information for the problem to be apparent or to have a definite answer. Why would you expect the singular values to add up to a certain number? Also, it's not clear to me how different correlation metrics and dropping rows/columns are relevant. If A is your matrix, then the squares of the singular values add up to $\operatorname{tr} A A^T$. Other than using the Cauchy-Schwartz inequality, I don't see how you can get more a priori information about the sum of the first powers of the singular values. – Igor Khavkine Nov 20 '11 at 13:32
Check out the Herbert-Schmidt Norm: en.wikipedia.org/wiki/… ... since the trace of a correlation matrix is n for an n dimensional matrix, I think the singular values should add to n. Also, I've verified that this does work experimentally. I could provide a working example that shows this bug in action. I don't know how to provide example files. – fodon Nov 23 '11 at 13:38

The sum of the eigenvalues equals the number of variables $(p=\sum_j \lambda_j)$ only when the correlation matrix $\mathbf{R}$ is used, so obviously make sure you aren't using the covariance matrix $\mathbf{C}$. (often people write or mention that the "correlation matrix was used" but actually used the covariance matrix because occasionally the terminology is loose. Loose terminology abounds when all the data are mean-zero standardized, i.e., when $\mathbf{R}=\mathbf{C}$). This may not apply to your case, however.
Mean-zero standardizing is another issue you might want to address. Thus, try generating a $\mathbf{Z}$ matrix first, with elements $z_{ij}=(x_{ij} - \bar{x}_j)/\sigma_j$, where $\bar{x}_j$ is the mean of variable $j$ and $\sigma_j$ is the s.d of variable $j$. Then determine $\mathbf{R}$ using $\mathbf{Z}$.
Last, there can be pathologies in $\mathbf{R}$, causing negative eigenvalues as well.