PCA with IRIS Data Scatter Plot

Hi All,

I am attempting to use PCA to analyze some data. I wanted to start with something simple to I decided to use the iris data set (https://en.wikipedia.org/wiki/Iris_flower_data_set#Data_set). I modified principle.C (available in the math directory in the tutorials) and seem to be getting reasonable results.

My issue is that I am not sure how to pull out correlated entries in the histograms for the individual principal components. Basically, I would like to plot PCA1 versus PCA2 or any combination of the principal components. I have provided the script I am currently using. principal.C (2.5 KB)

Thanks,
Jason

I guess @moneta can help you.
note that your macro has an undeclared variable:

Processing principal.C...
In file included from input_line_9:1:
/Users/couet/Downloads/principal.C:27:63: error: use of undeclared identifier 'c'
   cout << "*  Number of dependent variables: " << setw(4) << c
                                                              ^

My mistake. Please see the updated version attached. principal.C (2.3 KB)

I believe I just use the X2P() function… I am not sure how I missed this earlier. Attached is a plot of the first two principal components.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.