Assume we have a matrix X = randn(5,3). I am doing two things:
1) [S D1 V1] = svd(X);
2) [V2 D2] = eig(X'*X);
I am getting:
V1 =
-0.6220 0.5046 0.5987
-0.6549 -0.7544 -0.0446
-0.4292 0.4198 -0.7997
and
V2 =
0.5987 0.5046 0.6220
-0.0446 -0.7544 0.6549
-0.7997 0.4198 0.4292
First question: How can we interpret the difference between V1 and V2? why some negative values are getting positive and the values are in reverse order?
Second question: in principal component analysis, one can compute the principal components (PCs) as Z = S*D1 or Z = X*V2. But in this case S*D1 is not equal to X*V2 but X*V1. So the PCs are Z = X*V1 not X*V2 right?
eigfunction tends to order the eigenvectors in the order of increasing eigenvalues; thesvdfunction tends to order them in the decreasing order. Hence the order is flipped. One should never rely on the ordering and re-order the components based on the eigenvalues. You can computeZasX*V1or asX*V2and you will get the same thing, just possibly with different signs and in different order. – amoeba Feb 17 '16 at 14:47eig,V2is probably to be complex if the matrix dimension becomes large, whereas withsvd,V1is always real. How can you interpret this fact? Do you think that computingZ=X*V1is more preferable? – Christina Feb 17 '16 at 14:57V2=real(V2)and it's going to be fine. But it's better to use SVD. – amoeba Feb 17 '16 at 15:03Y=X*beta + e = S * D1 * V1' * beta + e = Z * V1' * beta + e= Z * alpha + e. SinceZ = S*D1 = X*V1. am I right? thank you very much for your help. – Christina Feb 17 '16 at 15:10Z=U*theta(I am just talking about the article in page 5). It will be interesting if you can integrate your comments as an answer :-) – Christina Feb 17 '16 at 15:18