[Rd] stats:::biplot.prcomp: Scaling, typo in the help file?

Thaler, Thorn, LAUSANNE, Applied Mathematics Thorn.Thaler at rdls.nestle.com
Wed May 11 09:11:10 CEST 2011


Dear all,

>From the documentation of biplot.prcomp:

scale: The variables are scaled by 'lambda ^ scale' and the
       observations are scaled by 'lambda ^ (1-scale)' where
       'lambda' are the singular values as computed by 'princomp'.

>From the source code of prcomp:

    lam <- x$sdev[choices]
    n <- NROW(scores)
    lam <- lam * sqrt(n)
    if (scale < 0 || scale > 1) 
        warning("'scale' is outside [0, 1]")
    if (scale != 0) 
        lam <- lam^scale
    else lam <- 1
    if (pc.biplot) 
        lam <- lam/sqrt(n)
    biplot.default(t(t(scores[, choices])/lam), t(t(x$rotation[, 
        choices]) * lam), ...)


Thus, the observations are divided by the scale factor, i.e. they are scaled by lambda^(-scale) and not by lambda^(1-scale).

Am I missing something?

Kind Regards,

Thorn Thaler
Mathematician

Applied Mathematics Group 
Nestlé Research Center
PO Box 44 
CH-1000 Lausanne 26, Switzerland
Phone: +41 21 785 8220
Fax: +41 21 785 8556



More information about the R-devel mailing list