The relationship between SCORE and LOADING from PCA using princomp in MATLAB
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Aditya
el 5 de Feb. de 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 comentarios
Ver también
Categorías
Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!