# Does the sign of scores or of loadings in PCA or FA have a meaning? May I reverse the sign?

I performed principal component analysis (PCA) with R using two different functions (prcomp and princomp) and observed that the PCA scores differed in sign. How can it be?

Consider this:

set.seed(999)
prcomp(data.frame(1:10,rnorm(10)))$x PC1 PC2 [1,] -4.508620 -0.2567655 [2,] -3.373772 -1.1369417 [3,] -2.679669 1.0903445 [4,] -1.615837 0.7108631 [5,] -0.548879 0.3093389 [6,] 0.481756 0.1639112 [7,] 1.656178 -0.9952875 [8,] 2.560345 -0.2490548 [9,] 3.508442 0.1874520 [10,] 4.520055 0.1761397 set.seed(999) princomp(data.frame(1:10,rnorm(10)))$scores
Comp.1     Comp.2
[1,]  4.508620  0.2567655
[2,]  3.373772  1.1369417
[3,]  2.679669 -1.0903445
[4,]  1.615837 -0.7108631
[5,]  0.548879 -0.3093389
[6,] -0.481756 -0.1639112
[7,] -1.656178  0.9952875
[8,] -2.560345  0.2490548
[9,] -3.508442 -0.1874520
[10,] -4.520055 -0.1761397


Why do the signs (+/-) differ for the two analyses? If I was then using principal components PC1 and PC2 as predictors in a regression, i.e. lm(y ~ PC1 + PC2), this would completely change my understanding of the effect of the two variables on y depending on which method I used! How could I then say that PC1 has e.g. a positive effect on y and PC2 has e.g. a negative effect on y?

In addition: If the sign of PCA components is meaningless, is this true for factor analysis (FA) as well? Is it acceptable to flip (reverse) the sign of individual PCA/FA component scores (or of loadings, as a column of loading matrix)?

• +1. This question gets asked a lot on this forum, in different variations (sometimes about PCA, sometimes about factor analysis). This one is the most popular thread covering the issue (thanks to @January's excellent answer), so it would be convenient to mark other existing and future questions as duplicates of this one. I took the liberty to make your question slightly more general by changing the title and by mentioning factor analysis in the end. I hope you will not mind. I have also provided an additional answer. – amoeba Jan 15 '15 at 23:55
• Sign is arbitrary; substantive meaning logically depends on the sign. You may always change the sign of any factor labelled "X" to the opposite sign, and label it then "opposite X". It is true for loadings, for scores. Some implementations would - for convenience - change the sign of a factor so that the positive values (in scores or loadings) in it will dominate, in sum. Other implementations do nothing and leave the decision whether to reverse the sign on you - if you care. Statistical meaning (such as effect strength) do not change apart from its "direction" gets reversed. – ttnphns Mar 31 '16 at 8:11

PCA is a simple mathematical transformation. If you change the signs of the component(s), you do not change the variance that is contained in the first component. Moreover, when you change the signs, the weights (prcomp( ... )$rotation) also change the sign, so the interpretation stays exactly the same: set.seed( 999 ) a <- data.frame(1:10,rnorm(10)) pca1 <- prcomp( a ) pca2 <- princomp( a ) pca1$rotation

                 PC1       PC2

and pca2$loadings show Loadings: Comp.1 Comp.2 X1.10 -0.99 -0.14 rnorm.10. 0.14 -0.99 Comp.1 Comp.2 SS loadings 1.0 1.0 Proportion Var 0.5 0.5 Cumulative Var 0.5 1.0  So, why does the interpretation stays the same? You do the PCA regression of y on component 1. In the first version (prcomp), say the coefficient is positive: the larger the component 1, the larger the y. What does it mean when it comes to the original variables? Since the weight of the variable 1 (1:10 in a) is positive, that shows that the larger the variable 1, the larger the y. Now use the second version (princomp). Since the component has the sign changed, the larger the y, the smaller the component 1 -- the coefficient of y< over PC1 is now negative. But so is the loading of the variable 1; that means, the larger variable 1, the smaller the component 1, the larger y -- the interpretation is the same. Possibly, the easiest way to see that is to use a biplot. library( pca3d ) pca2d( pca1, biplot= TRUE, shape= 19, col= "black" )  shows The same biplot for the second variant shows pca2d( pca2$scores, biplot= pca2$loadings[,], shape= 19, col= "black" )  As you see, the images are rotated by 180°. However, the relation between the weights / loadings (the red arrows) and the data points (the black dots) is exactly the same; thus, the interpretation of the components is unchanged. • I even added pictures now :-) – January Mar 5 '14 at 12:50 • This is true, but what about the projections in PCA? I am coding up PCA myself, and some of my eigenvectors are flipped as compared with MATLAB built-in princomp. So during the projection, my projected data are also flipped in sign in some of the dimensions. My goal is to do classification on the coefficients. The sign still doesn't matter here? – Sibbs Gambling Apr 23 '15 at 2:58 • So, if simply for reason of easier understanding of my PCs, I'd like to swap the signs of the scores, is that valid? – user45065 May 18 '17 at 10:58 This question gets asked a lot on this forum, so I would like to supplement @January's excellent answer with a bit more general considerations. In both principal component analysis (PCA) and factor analysis (FA), we use the original variables$x_1, x_2, ... x_d$to estimate several latent components (or latent variables)$z_1, z_2, ... z_k$. These latent components are given by PCA or FA component scores. Each original variable is a linear combination of these components with some weights: for example the first original variable$x_1$might be well approximated by twice$z_1$plus three times$z_2$, so that$x_1 \approx 2z_1 + 3z_2$. If the scores are standardized, then these weights ($2$and$3$) are known as loadings. So, informally, one can say that $$\mathrm{Original\: variables} \approx \mathrm{Scores} \cdot \mathrm{Loadings}.$$ From here we can see that if we take one latent component, e.g.$z_1$, and flip the sign of its scores and of its loadings, then this will have no influence on the outcome (or interpretation), because $$-1\cdot -1 = 1.$$ The conclusion is that for each PCA or FA component, the sign of its scores and of its loadings is arbitrary and meaningless. It can be flipped, but only if the sign of both scores and loadings is reversed at the same time. • This is true, but what about the projections in PCA? I am coding up PCA myself, and some of my eigenvectors are flipped as compared with MATLAB built-in princomp. So during the projection, my projected data are also flipped in sign in some of the dimensions. My goal is to do classification on the coefficients. The sign still doesn't matter here? – Sibbs Gambling Apr 23 '15 at 2:59 • Still doesn't matter. Why would it? Flipped data are exactly equivalent to non-flipped data for all purposes, including classification. – amoeba Apr 23 '15 at 17:44 • Well, not for all purposes. For consistency between algorithm, I too really would like to match signs. However, it's not all flipped when looking at the components. How is R choosing the sign so I can do the same? – Myoch Jun 28 '17 at 12:12 • @Myoch I would recommend to invent your own convention and apply it everywhere, as opposed to trying to figure out what R is doing. You can choose the sign such that the first value is positive, or that more than half of the values are positive, etc. – amoeba Jun 28 '17 at 12:13 • @user_anon There is no inverse. – amoeba Sep 14 '18 at 19:53 This was well answered above. Just to provide some further mathematical relevance, the directions that the principal components act correspond to the eigenvectors of the system. If you are getting a positive or negative PC it just means that you are projecting on an eigenvector that is pointing in one direction or$180^\circ\$ away in the other direction. Regardless, the interpretation remains the same! It should also be added that the lengths of your principal components are simply the eigenvalues.