On Mon, 3 Nov 2008, EVANS David-William wrote:

Hello fellow Rers,


I have a no-doubt simple question which is turning into a headache so
would be grateful for any help.



I want to do a principal components analysis directly on a correlation
matrix object rather than inputting the raw data (and specifying cor =
TRUE or the like).  The reason behind this is I need to use polychoric
correlation coefficients calculated with John Fox's hetcor function. Is
there a way to do this with princomp or prcomp, or any other principal
components function in other R packages?
See ?princomp, and

  covmat: a covariance matrix, or a covariance list as returned by
          'cov.wt' (and 'cov.mve' or 'cov.mcd' from package 'MASS'). If
          supplied, this is used rather than the covariance matrix of
          'x'.

A correlation matrix *is* a covariance matrix (of scaled data, and scaling does matter for PCA, of course).
That this is possible is the main advantage of princomp over prcomp.
Compare

princomp(covmat=cor(USArrests))
Call:
princomp(covmat = cor(USArrests))

Standard deviations:
   Comp.1    Comp.2    Comp.3    Comp.4
1.5748783 0.9948694 0.5971291 0.4164494

 4  variables and  NA observations.

with the help-page examples



Again, very grateful for any help.



David Evans.




        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

--
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to