フィルターのクリア

Results of PCA function

1 回表示 (過去 30 日間)
Tiago Dias
Tiago Dias 2018 年 6 月 27 日
コメント済み: Tiago Dias 2018 年 6 月 28 日
Hello, I got some trouble understanding why I get a different result than the PCA function that is incorporated on Matlab. I have uploaded the data that i worked on to get the results
load('X_imputed');
[coeff,score,latent] = pca(X_imputed,'algorithm','eig');
If I got it right, coeff is the Loadings.
I tried to replicate the results on my own, I got the same absolute value that coeff and score, but the signals are different, and I would like to know what I did wrong? or perhaps in my calculation there a sign that is wrong, because i got the absolute valuthe same.
meanX = mean(X_imputed);
Z = (X_imputed-ones(75,1)*mean(X_imputed)); % Centering
covZ = cov(Z); % Covariance
[vec_p,lambda_aux] = eig(covZ);
val_p = diag(lambda_aux);
[lambda,ind_ord] = sort(val_p,'descend');
L1 = vec_p(:,ind_ord); % Loadings
T1 = Z * L1; % Scores
Thanks for your time and help.

回答 (1 件)

David Goodmanson
David Goodmanson 2018 年 6 月 27 日
編集済み: David Goodmanson 2018 年 6 月 27 日
Hi Tiago,
It's good to verify things as you are doing, and I don't believe that there is any problem. The eigenvalues agree. The columns of the coeff matrix (your L1) are normalized eigenvectors with real coefficients. Assuming they should stay real, eigenvectors are still undetermined within a factor of +-1. In this case, coeff and L1 differ by a factor of -1 in columns 2,5,6,7,8. Nothing wrong with that. Accordingly, score and your T1 differ by a factor of -1 in those same columns.
  1 件のコメント
Tiago Dias
Tiago Dias 2018 年 6 月 28 日
Yeah i guess there is no problem since the absolute value, and + or - is related with the orientation, and a direction has 2 orientation + or -.
I was just curious why it happens because in both cases I use 'eig' algorithm.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by