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:


            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

         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)?

  • 13
    $\begingroup$ +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. $\endgroup$
    – amoeba
    Commented Jan 15, 2015 at 23:55
  • 1
    $\begingroup$ 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. $\endgroup$
    – ttnphns
    Commented Mar 31, 2016 at 8:11

4 Answers 4


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 )


                 PC1       PC2
X1.10      0.9900908 0.1404287
rnorm.10. -0.1404287 0.9900908

and pca2$loadings show

          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"  )


enter image description here

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.

enter image description here

  • $\begingroup$ I even added pictures now :-) $\endgroup$
    – January
    Commented Mar 5, 2014 at 12:50
  • 2
    $\begingroup$ 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? $\endgroup$ Commented Apr 23, 2015 at 2:58
  • $\begingroup$ So, if simply for reason of easier understanding of my PCs, I'd like to swap the signs of the scores, is that valid? $\endgroup$
    – user45065
    Commented May 18, 2017 at 10:58
  • $\begingroup$ Of course it matters: why would you want to rotate the axis to point in the opposite direction and then multiply it by a negative number to make the result positive again? It's like saying that "up" is not "up" but "down with a negative number", e.g. "throw the ball down by -1 meter". $\endgroup$
    – Confounded
    Commented Apr 23, 2020 at 15:25

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.

  • $\begingroup$ 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? $\endgroup$ Commented Apr 23, 2015 at 2:59
  • 2
    $\begingroup$ Still doesn't matter. Why would it? Flipped data are exactly equivalent to non-flipped data for all purposes, including classification. $\endgroup$
    – amoeba
    Commented Apr 23, 2015 at 17:44
  • $\begingroup$ 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? $\endgroup$
    – Myoch
    Commented Jun 28, 2017 at 12:12
  • 2
    $\begingroup$ @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. $\endgroup$
    – amoeba
    Commented Jun 28, 2017 at 12:13
  • 1
    $\begingroup$ @user_anon There is no inverse. $\endgroup$
    – amoeba
    Commented Sep 14, 2018 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.


It is easy to see that the sign of scores does not matter when using PCA for classification or clustering. But it seems to matter for regression. Consider a case where you have just one principal component or one common factor underlying several variables. Then lm(y ~ PC1) will give you different predictions of y compared to lm(y ~ -PC1). If y and PC1 have a positive linear relationship, y and -PC1 have a negative linear relationship. Maybe for regression, you should consider other alternatives discussed here, for example lasso regression.

  • 3
    $\begingroup$ The signs of the scores matter in exactly the same way in PCA for clustering, classification or regression. Suppose, for example, that one component represents the overall size of an organism. It might be "bigness" or (if the sign is reversed) "smallness". That matters for classification (big ones over here ... small over there), clustering (this cluster is big, red rock eaters and that cluster is small green rock eaters) or regression. $\endgroup$
    – Peter Flom
    Commented Jan 28, 2020 at 10:13
  • 3
    $\begingroup$ Emmanuel, did you perhaps mean "give you different parameter estimates" rather than different predictions? The latter is incorrect, but the former is true (although only in the very limited sense of negating the coefficient). $\endgroup$
    – whuber
    Commented Jan 28, 2020 at 14:01
  • $\begingroup$ Oh yeah, I see, the predictions would be the same. $\endgroup$ Commented Jan 29, 2020 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.