The relationship between SCORE and LOADING from PCA using princomp in MATLAB
2 ビュー (過去 30 日間)
古いコメントを表示
I'm doing PCA using princomp.
I'd like to confirm score is derived from X and loading. As far as I know, score = X*loading
My code is [loadb fact] = princomp( X , 'econ' );
But, "X*loadb" and "fact" are different.
Is there anybody explain how can I get score from loading and X?
0 件のコメント
回答 (1 件)
Aditya
約13時間 前
Hi Torsionfree,
When you perform PCA using MATLAB's princomp function (or its successor pca), the output score (also known as fact in your code) represents the principal component scores, which are the projections of the original data X onto the principal component axes defined by the loadings (or loadb).
Following is aan example for data centering:
% Example data matrix X
% X = [...]; % Your data matrix
% Perform PCA using princomp
[loadb, fact, latent, tsquared, explained, mu] = princomp(X, 'econ');
% Manually compute the scores
X_centered = X - mean(X); % Center the data
manual_fact = X_centered * loadb;
% Compare the manually computed scores with those from princomp
disp('Difference between computed scores and princomp scores:');
disp(norm(fact - manual_fact));
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!