The relationship between SCORE and LOADING from PCA using princomp in MATLAB
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Aditya
il 5 Feb 2025
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 Commenti
Vedere anche
Categorie
Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!