Skip to content
Prev 248720 / 398506 Next

how to get coefficient and scores of Principal component analysis in R?

By coefficients do you mean loadings?

Anyway, if you read the help for princomp -- ?princomp -- will
get that, you'll see that it says, in part:

     ?princomp? returns a list with class ?"princomp"? containing the
     following components:

    sdev: the standard deviations of the principal components.

loadings: the matrix of variable loadings (i.e., a matrix whose columns
          contain the eigenvectors).  This is of class ?"loadings"?:
          see ?loadings? for its ?print? method.

  scores: if ?scores = TRUE?, the scores of the supplied data on the
          principal components.  These are non-null only if ?x? was
          supplied, and if ?covmat? was also supplied if it was a
          covariance list.  For the formula method, ?napredict()? is
          applied to handle the treatment of values omitted by the
          ?na.action?.

So for instance,

myprincomp <- princomp(mydata)
myprincomp$scores # shows the scores

Sarah
On Fri, Jan 28, 2011 at 2:16 PM, Zunqiu Chen <chener at ohsu.edu> wrote: