PCA of dataset that contains 4 samples, how to compare principal component results between samples and use biplot to visually compare?
Show older comments
I am performing a pca of dataset A, 163x5. Within A, there are 4 samples that I would like to eventually compare with row indices of A1 = A(1:45,:); A2= A(46:83,:); A3 = A(84:125,:); A4 = A(126:163,:).
Performed pca on all of A by: [coeff,score,latent,explained,tsquare] = pca(zscore(A)); Then, I am using biplot to illustrate results and want to differentiate between samples A1 through A4 in dataset. In order to compare all of the samples, the biplot must be applied to the entire dataset at one time. In other words, the method of: biplot(coeff(:,1:2),'Scores',score(1:45,1:2),'VarLabels',{'DO' 'K' 'TOM' 'dh' 'N'} 'Marker','s','MarkerEdgeColor','g','MarkerSize', 9); hold on biplot(coeff(:,1:2),'Scores',score(46:83,1:2),'VarLabels',{'DO' 'K' 'TOM' 'dh' 'N'} 'Marker','d','MarkerEdgeColor','b','MarkerSize', 9); etc.... will not work. So I can go to plot editor, and in the plot browser count the number of plots that match A1, change to a different marker, and thus differentiate between samples A1,A2,... But this not a great way to do it!!!!!! Any ideas? Also, as part of this I would like to find the centroid of each sample. Again this is not as simple as average of x and average of y for each sample because of the manipulation biplot performs. Any help is greatly appreciated. Thanks! George
Answers (1)
George McFadden
on 19 Nov 2012
Categories
Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!