Centering data in PCA - PC1 does not pass through 0
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Caroline
le 2 Mar 2017
Réponse apportée : Darshan Ramakant Bhat
le 6 Mar 2017
I've a question regarding the pca function. I'm using it on a [28x79] matrix and the resulting principal component coefficients are confusing me somewhat. According to the documentation, pca centers the column data by subtracting the mean. However, when I plot the coordinates of the coefficients of principal components 1-3 in state space (i.e x-axis contains principal component 1 (PC1), y-axis contains principal component 2 (PC2), z-axis contains principal component 3 (PC3), principal component 1 does not pass through 0. Instead the typical range is somewhere between [0.05 2]. Could you explain this? PC2 and PC3 behave as I would expect after centering, in that their range contains 0.
Thank you for your help.
0 commentaires
Réponse acceptée
Darshan Ramakant Bhat
le 6 Mar 2017
I think you are mixing up something. The pca() documentation says " by default, pca centers the data and uses the singular value decomposition (SVD) algorithm". This means when you do _coeff = pca(X), the data X will be centered. That means the function will preprocess the data ' X' by subtracting the means from from its column.It is equivalent to doing
[m n]=size(X);
X_processed=zeros(m,n)
for i=1:n
X_processed(:,i)=X(:,i)-mean(X(:,i));
end
This is nothing to do with PCA coefficients, this can vary from any range. Try pca() function with X and X_processed, ideally you should get the same result.
I hope this answer will help you.
Regards
Darshan Bhat
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dimensionality Reduction and Feature Extraction dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!