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