I am also interested in resolving this problem, although, decided not to create separate thread for it yet. This is kind of continuation of previous question below.
https://stats.stackexchange.com/questions/34396/im-getting-jumpy-loadings-in-rollapply-pca-in-r-can-i-fix-it
In factor analysis, specifically PCA, sign of the loadings does not mean anything, but if someone, like me, wants to project time series to selected principal component then we will see the picture like on the link above - jumpy loadings.
All answers that I have seen speculated with multiplying vector by minus 1 if you think that particular vector with loadings jumps too much. There are even answers that suggest how exactly to identify that "too much" by comparing two vectors - actual and previous. But it is still not enough because even according to the answers I will be able to identify sign changes only in the middle of the sequence, when I have calculated 2 vectors and am able to compare them. It is not enough because I still need to be sure that first sign was defined properly and here is the problem - you assume that first eigenvector is correct, compute next one and realize that sign needs to be changed, the same for the rest of the sequence and when you plot this to the chart you realize that loadings are not jumpy anymore but the whole chart is inverted because when you calculated first eigenvector it was wrong and nobody yet suggested how to check exactly FIRST eigenvector without comparing it with the others.
At the moment, I have three suggestions of how these jumps in loadings can be removed.
- summarize all values in eigenvector to predict what eigenspace it lays in
eigenvector [-0.5, 0.2, 0.4]
-0.5 + 0.2 + 0.4 = 0.1 > 0 = sign is correct and should not change
eigenvector [-0.5, 0.2, 0.1]
-0.5 + 0.2 + 0.1 = -0.2 < 0 = change sign
- compute dot product between actual and previous vectors
vectorActual [-0.5, 0.2]
vectorPrev [0.3, -0.1]
-0.5 * 0.3 + 0.2 * -0.1 = -0.17 < 0 = change sign
- compute difference between actual and previous vectors
vectorActual [-0.5, 0.2]
vectorPrev [0.3, -0.1]
Diff = MathAbs(-0.5 - 0.3) + MathAbs(0.2 - -0.1) = 1.1
Sum = MathAbs(-0.5 + 0.3) + MathAbs(0.2 + -0.1) = 0.3
Diff > Sum = change sign
I am attaching image with a chart to show what I mean.
As far as you can see, simple summary shows good results without inversion but in some case jumps are possible. At the same time, Dot Product and comparison between Diff - Sum show chart without jumps at all but it is inverted, which is wrong!
High resolution image - http://snag.gy/zCqHx.jpg

So, as far as this may be an answer to the question in this topic I am still interested in how to check that orientation of the FIRST vector in a sequence is correct?