The relationship between SCORE and LOADING from PCA using princomp in MATLAB

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?

답변 (1개)

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

카테고리

도움말 센터File Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

질문:

2013년 11월 30일

답변:

2025년 2월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by