Centering data in PCA - PC1 does not pass through 0
2 ビュー (過去 30 日間)
古いコメントを表示
Caroline
2017 年 3 月 2 日
回答済み: Darshan Ramakant Bhat
2017 年 3 月 6 日
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 件のコメント
採用された回答
Darshan Ramakant Bhat
2017 年 3 月 6 日
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!