annina <wossona <at> yahoo.co.uk> writes:

> 
> 
> 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? 
> Thank you for helping!!!


Dear Annina,

Yes, this is possible in R.

Both  'prcomp' (that I recommend) and 'princompä have 'predict' method which can
have 'newdata' as an argument. The following assumes that 'keep' is a vector
which is TRUE for cases you keep, and FALSE for those ignored:

pc <- prcomp(x[keep,])
predict(pc, newdata=x)

cheers, Jari Oksanen

______________________________________________
[email protected] 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