# How to create a PCA-based index from two variables when their directions are opposite?

I wanted to use principal component analysis to create an index from two variables of ratio type. I am using the correlation matrix between them during the analysis. I want to use the first principal component scores as an index.

Higher values of one of these variables mean better condition while higher values of the other one mean worse condition. That is the lower values are better for the second variable. What I want is to create an index which will indicate the overall condition. Is there anything I should do before running PCA to get the first principal component scores in this situation?

• The first principal component resulting can be given whatever sign you prefer. The bigger deal is that the usefulness of the first PC depends very much on how far the two variables are linearly related, so that you could consider whether transformation of either or both variables makes things clearer. – Nick Cox Feb 29 '16 at 9:03
• @Blain, if you care about the sign of your PC scores, you need to fix it after doing PCA. You can e.g. fix the sign so that it is the same as your variable 1 (this means: do PCA, check correlation of the PC with variable 1, if it is negative, flip the sign). However, can you tell us if you are going to standardize your variables (make them both unit variance) before running PCA or not? – amoeba says Reinstate Monica Feb 29 '16 at 11:25
• I am asking because any correlation matrix of two variables has the same eigenvectors, see my answer here: stats.stackexchange.com/questions/140434. So you don't need to do bother with PCA, you can just flip the sign of one of your variables and average them. You will get exactly the same thing. – amoeba says Reinstate Monica Feb 29 '16 at 11:56
• @amoeba I think you might have overlooked the scaling that occurs in going from a covariance matrix to a correlation matrix. Your recipe works provided the standardized variables are being averaged, not the original variables themselves. – whuber Feb 29 '16 at 21:29
• @whuber: Yes, averaging the standardized variables is indeed what I meant, just did not write it precise enough in a hurry. – amoeba says Reinstate Monica Feb 29 '16 at 21:38

That said, note that you are planning to do PCA on the correlation matrix of only two variables. Any correlation matrix of two variables has the same eigenvectors, see my answer here: Does a correlation matrix of two variables always have the same eigenvectors? So in fact you do not need to bother with PCA; you can center and standardize ($z$-score) both variables, flip the sign of one of them and average the standardized variables ($z$-scores). You will get exactly the same thing as PC1 from the actual PCA.