Josh B
2010-Jun-15 22:02 UTC
[R] Getting the eigenvectors for the dependent variables from principal components analysis
Dear listserv, I am trying to perform a principal components analysis and create an output table of the eigenvalues for the dependent variables. What I want is to see which variables are driving each principal components axis, so I can make statements like, "PC1 mostly refers to seed size" or something like that. For instance, if I try the example from ?prcomp> prcomp(USArrests, scale = TRUE)Now what? None of the components of prcomp-class objects appear to have this information. "rotation" will give me the eigenvectors for the individual data points, NOT the eigenvectors for the dependent variables for each PC axis. Alternatively, I could try the example from ?princomp> princomp(USArrests, cor = TRUE)But I have the same problem -- now what? None of the components of princomp-class objects appear to have the information I'm after. Thanks very much in advance for any help! ----------------------------------- Josh Banta, Ph.D Center for Genomics and Systems Biology New York University 100 Washington Square East New York, NY 10003 Tel: (212) 998-8465 http://plantevolutionaryecology.org [[alternative HTML version deleted]]
David Winsemius
2010-Jun-15 23:17 UTC
[R] Getting the eigenvectors for the dependent variables from principal components analysis
On Jun 15, 2010, at 6:02 PM, Josh B wrote:> Dear listserv, > > I am trying to perform a principal components analysis and create an > output table of the eigenvalues for the dependent variables. What I > want is to see which variables are driving each principal components > axis, so I can make statements like, "PC1 mostly refers to seed > size" or something like that. > > For instance, if I try the example from ?prcomp > >> prcomp(USArrests, scale = TRUE) > > Now what? None of the components of prcomp-class objects appear to > have this information. "rotation" will give me the eigenvectors for > the individual data points, NOT the eigenvectors for the dependent > variables for each PC axis.I think you are confused on this point. The $rotation matrix is only 4x4 in the example you used. The help page says "the matrix of variable loadings (i.e., a matrix whose columns contain the eigenvectors). The function princomp returns this in the element loadings." (Which certainly might have confused me also if I had not looked at the result with str(), )> > Alternatively, I could try the example from ?princomp > >> princomp(USArrests, cor = TRUE) > > But I have the same problem -- now what? None of the components of > princomp-class objects appear to have the information I'm after.Have you looked at $x in the returned object? It's 50 x 4, despite not asserting retx. (Unfortunately, I remain unclear what you do want.) -- David Winsemius, MD West Hartford, CT