[R] Getting the eigenvectors for the dependent variables from principal components analysis

David Winsemius dwinsemius at comcast.net
Wed Jun 16 01:17:01 CEST 2010


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



More information about the R-help mailing list