I used PCA on 9-D data. I want to plot PCs direction
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
farshad jahangiri
le 28 Sep 2022
Réponse apportée : the cyclist
le 29 Sep 2022
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')
xlabel('Principal Component 1');
ylabel('Principal Component 2');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1139420/image.jpeg)
3 commentaires
the cyclist
le 28 Sep 2022
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?
Réponse acceptée
the cyclist
le 29 Sep 2022
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 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!