prcomp and princomp

Prof Brian Ripley Prof Brian Ripley <ripley@stats.ox.ac.uk>
Mon, 24 Aug 1998 16:35:17 +0100 (BST)


> plot.prcomp <- function(obj, x=1, y=2, main="Scree Plot",
>   xlab=paste("Principle component", x),
>   ylab=paste("Principle component", y), ...) {
>     if (is.null(obj$x))
>  stop("Rotated x has not be calculated by prcomp. Use retx=T in prcomp.")
>     plot(obj$x[,c(x,y)], main=main, xlab=xlab, ylab=ylab, ...)
> }

> plot.princomp <- function(obj, x=1, y=2, main="Scree Plot",
>   xlab=paste("Principle component", x),
>   ylab=paste("Principle component", y), ...) {
>     plot(obj$scores[,c(x,y)], main=main, xlab=xlab, ylab=ylab, ...)
> }

Ouch. Enough of my students think that it is the spelling already!
This is _not_ what is meant by a scree plot, which plots the singular
values or eigenvalues.

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._