I used PCA on 9-D data. I want to plot PCs direction
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
farshad jahangiri
il 28 Set 2022
Risposto: the cyclist
il 29 Set 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 Commenti
the cyclist
il 28 Set 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?
Risposta accettata
the cyclist
il 29 Set 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Dimensionality Reduction and Feature Extraction in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!