Re: [R] questions about principle component analysis (princomp)

From: Thomas Petzoldt <>
Date: Thu 22 Jul 2004 - 16:29:37 EST

Yunfeng Hu wrote:
> Hi, I am a new R user and am currently using princomp to conduct a PCA.
> I have read the help(princomp) and still do not quite understand
> everything in the help. Basically I want to get the covariance matrix,
> and eigenvector/eigenvalues (loadings()?) so that I can find the
> principle components. Thanks!


you may start with the examples at the bottom of the help page to get more understanding. Here is a modified version of that example:

  pc<- princomp(USArrests)



# some other useful methods mentioned on the help page:

  cov(USArrests) # covariance matrix   eigen(cov(USArrests)) # eigenvalues/vector

# and a way to show, what things are stored in pc


# so they can be extracted as shown on the help page.

# Please note, that the scaled version (correlation matrix) # would be more appropriate there, e.g.

  pc<- princomp(USArrests, cor=TRUE)

Hope it helps

Thomas P. mailing list PLEASE do read the posting guide! Received on Thu Jul 22 16:38:06 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:37:27 EST