0
$\begingroup$

I have a dataset with 400 variables and have to find the most representative variable by using PCA in Matlab.

I normalized the data X and used:

[coeff,score,latent,tsquared,explained,mu] = pca(X);

The first 3 PC make up about 60% of the variance.

I know that the columns in coeff represent the PCs and the rows in coeff represent the variables.

However, I fail to understand how I can now find the most representative variable.

The whole task is odd to me since PCA is used for dimension reduction.

Since "explained" shows the percentage of each PC's variance and the columns of coeff represent the PC I tried the following:

    %Weight PC of coeffs with var% and calc sum for each variable
    WeightedCoeff=coeff*explained/100;
    %find maximum
    MaxVar=max(WeightedCoeff);
    %find position of maximum
    InMaxVariable=find(WeightedCoeff==MaxVar);

As a result, I would get the variable at column 194 as the most representative one. (Which could be true since this variable correlates positively for the first 10 PCs ~85% of variance).

Is this approach right?

$\endgroup$
2
  • $\begingroup$ Because "representative" has no standard statistical definition and because as commonly understood it's not related to variance at all, please explain what you mean by "most representative." $\endgroup$
    – whuber
    Commented Aug 2, 2019 at 18:26
  • $\begingroup$ Thanks for your reply! I mean the variable that contributes the most to the variance $\endgroup$
    – M08
    Commented Aug 2, 2019 at 18:51

1 Answer 1

0
$\begingroup$

Please take this answer with caution because I am not expert at finding “the most representative variable” in a set of variable and usually use PCA for reduction purposes. I just try because I see that an answer is still missing and just want to share some thoughts with you, so that you can decide whether this fits your needs.

First imagine to transform the variables using the eigenvectors as usual. Then we know that the total variance of the data is the trace of the eigenvalues matrix, which is nothing less than the sum of the variances of pca linear combinations. Then, if we ideally represent each linear combination, we know that the variance of each linear combination is the sum of the variances and covariances of its elements weighted by the weights of the linear combination (I am referring to the usual variance of combination formula). Therefore you could identify the variable that explains the most of the total variance as the variable which contributes the most to such sum of variances of the linear combinations by expliciting the sum as a function of variances/covarinces between the initial variables and isolating each variance/covariance term in which each variable appears and summing those, and finally comparing the numbers obtained for each variable. This is indeed something that a software can handle.

And we would have used Matlab to find the variable that contributes the most to the total variance of the features passing through PCA formulas (I.e using the trace of the matrix that stores the variance of each PCA linear combination to depict the total variance of the data). I hope it is clear enough without formulas.

$\endgroup$
3
  • $\begingroup$ Thanks for your answer! If I understand you right my initial thought was right and I have to weight my Principal Components with each variance and sum them up for every variable. However, one question remains for me: Should I take negative correlations into account or should I use the absolute value? $\endgroup$
    – M08
    Commented Aug 4, 2019 at 14:04
  • $\begingroup$ You must take into account negative correlations (or better covariances) because the total variance of the features is the sum of the variances of the PCA-transformed (i.e. the trace of the eigenvalues diagonal matrix), therefore summing the diagonal means that you sum all covariances of the PCA features (which in their turn are linear combinations of the initial variables so the variance of each is the variance of a linear combination, which can be rewritten as a sum of covariances, all covariances even negative, and of course the sign is important because it determines the result of the sum) $\endgroup$
    – Fr1
    Commented Aug 4, 2019 at 14:35
  • $\begingroup$ Ok, thanks! I thought that if I just sum them up, the negative and positive values could compensate each other and therefore I should use the absolute value. $\endgroup$
    – M08
    Commented Aug 4, 2019 at 18:27

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.