I'm trying to estimate a correlation matrix from the 5 largest eigenvalues and associated eigenvectors of the sample correlation matrix. My problem is that the output from the following Matlab code results in much higher average correlation (0.8 v 0.4) for the financial data I'm looking at.
[V,D] = eig(InputCorr);
eigvals = diag(D);
eigvals(1:(end-5)) = 0;
eigvals = eigvals*size(InputCorr,1)/sum(eigvals);
BB = bsxfun(@times,V,eigvals')* V';
T = 1 ./ sqrt(diag(BB));
OutputCorr = 0.5*(BB+BB') .* (T*T');
Is such a marked increase in average correlation to be expected or am I doing something wrong?
Update: The $A=λ_{1}v_{1}v_{1}' + ... + λ_{n}v_{n}v_{n}'$ decomposition suggested by @Jonathan Lisic is very useful. If I truncate it to just the first five terms, then the off-diagonal elements of the matrix are what I expect (similar to the corresponding elements of the original matrix and similar average correlation), but the diagonal elements are well below 1. So the increase in correlation is caused by rescaling the matrix to get the diagonal elements to equal to one. I am actually only interested in the off-diagonal elements, is it kosher to use these directly without doing any rescaling?
0.5*(BB+BB')in the last line?BBis symmetric, soBB=0.5*(BB+BB'). – mpiktas Sep 22 '11 at 8:03