[R] Help about princomp

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Apr 23 11:56:59 CEST 2007

On Mon, 23 Apr 2007, annina wrote:

> Hello,
> I have a problem with the princomp method, it seems stupid but I don't know
> how to handle it.
> I have a dataset with some regular data and some outliers. I want to
> calculate a PCA on the regular data and get the scores for all data,
> including the outliers. Is this possible on R?

Yes.  Do you know which are the outliers?

You can either fit to the 'regular data' with princomp and use predict() 
to get the 'scores' for all the data, or use a robust method to find the 
'covmat' argument (as the help page says, you could use cov.mcd from 
MASS) and call princomp() on all the data.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
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

More information about the R-help mailing list