biplot diagram of PCA analysis differs from plot of variables
1
0
Entering edit mode
@juditsessler-8275
Last seen 6.3 years ago
Hungary

I made a PCA analysis of mz 94x20 matrix:

pca_<-dudi.pca(df = rg, scannf = F, nf = 2)

and displayed the result with scatter(pca_, posieig = "bottomright").

I wanted to see only the variables, so I wrote

 plot(pca_$co)
 text(pca_$co,row.names(pca_$co))

The variables were grouped differently on the first plot then on the second. Why?

 

r pca biplot • 1.3k views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 4 hours ago
United States

This question is only tangential to Bioconductor, as the made4 package uses the CRAN ade4 package internally. So one could argue that it is better asked on R-help.

That said, you need to read and understand the help page for the functions you are using. In the help page for dudi.pca() it says:

Value:

     Returns a list of classes ‘pca’ and ‘dudi’ (see dudi) containing
     the used information for computing the principal component
     analysis :

     tab: the data frame to be analyzed depending of the transformation
          arguments (center and scale)

      cw: the column weights

      lw: the row weights

     eig: the eigenvalues

    rank: the rank of the analyzed matrice

      nf: the number of kept factors

      c1: the column normed scores i.e. the principal axes

      l1: the row normed scores

      co: the column coordinates

      li: the row coordinates i.e. the principal components

So if you use scatterplot(), you get a PCA plot. If you directly plot pca_$co, you do not because you aren't plotting the principal components.

ADD COMMENT

Login before adding your answer.

Traffic: 357 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6