I used PCA on 9-D data. I want to plot PCs direction

1 回表示 (過去 30 日間)
farshad jahangiri
farshad jahangiri 2022 年 9 月 28 日
回答済み: the cyclist 2022 年 9 月 29 日
Hi , I extract 2 PC and know I want to plot direction of PCs but I don't know how.
I attached data and code
clc;
clear;
data=importdata('data.txt');
n_data=zscore(data);
[coeff,scores,latent] = pca(n_data,'Algorithm','eig');
p=scatter(scores(:,1),scores(:,2),'filled')
p =
Scatter with properties: Marker: 'o' MarkerEdgeColor: 'none' MarkerFaceColor: 'flat' LineWidth: 0.5000 XData: [-2.6987 -2.9086 -2.6022 -2.7088 -2.5972 -2.6443 -2.4184 -2.6105 -2.6442 -2.6342 -2.7498 -2.8929 -3.0329 -2.9947 -2.7199 -2.6996 -2.6480 -2.6630 -2.5890 -2.4588 -2.3512 -2.6149 -2.6046 -2.6306 -2.7813 -2.9008 -2.8532 -2.5646 … ] YData: [-1.1820 -0.3770 -1.9835 -1.6290 -1.4321 -0.6428 -1.4788 -1.7337 -1.9207 -2.0610 -2.2508 -1.8076 0.1766 -0.5802 -1.0807 -1.6126 -1.1661 -1.0277 -2.4950 -1.5415 -1.4948 -1.3786 -0.6466 0.3495 0.0197 -0.0436 0.5450 0.6005 0.2341 … ] SizeData: 36 CData: [0 0.4470 0.7410] Show all properties
xlabel('Principal Component 1');
ylabel('Principal Component 2');
  3 件のコメント
the cyclist
the cyclist 2022 年 9 月 28 日
I am confused by what you mean by "direction of PCs".
Because you are plotting the scores variable, you are plotting in principal component space (not the original coordinate space). I would say that the x- and y- axes are the "direction of the PCs" in this plot. (The other 7 PCs are orthogonal to these.)
If this does not make sense, or does not capture what you mean, maybe you could explain some more. What are you trying to illustrate?
farshad jahangiri
farshad jahangiri 2022 年 9 月 29 日
移動済み: the cyclist 2022 年 9 月 29 日
@the cyclist Hi . I am confused about this. in some researches like this picture they showed direction of principal components. I want to show when covariance matrix changes, the PCs direction will be change.
I think we just can show this direction in not transformed data and in original axis, not transformed data (scores).
In this case How can I show the direction of PCs in original data and what data should be used instead of scores? I am confused because the scores have all 9 dimensions and can be shown in one dimension, but the original data cannot

サインインしてコメントする。

採用された回答

the cyclist
the cyclist 2022 年 9 月 29 日
Your comment was helpful. I think the biplot function may do what you need.
The biplot illustrates what the original axes look like in (two or three dimensions of) PC space.
I think that making a biplot of the inverse of coeff would illustrate what the PC vectors look like in the original space. (I am not certain of this last statement. I'd need to think about it more, and experiment a bit.)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by