[R] What is the 'scale' in princomp() function?

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jan 13 08:35:07 CET 2008


On Sun, 13 Jan 2008, Xingwang Ye wrote:

> Dear R users,
> When I tried to use princomp() from stats packages to do Principal
> Components Analysis, I am not very clear what is the "scale".
> And the scores are different from "PROC PRINCOMP" procedure from SAS.
>
> Using the example data from this package:
>
> restpc <- princomp(USArrests, cor = TRUE)
> > restpc$scale
> Murder Assault UrbanPop Rape
> 4.311735 82.500075 14.329285 9.272248
> > sd(USArrests)
> Murder Assault UrbanPop Rape
> 4.355510 83.337661 14.474763 9.366385
>
> Why 'restpc$scale' is different from 'sd(USArrests)'?

Please do read the help before posting, as the posting guide asks. It says

      Note that the default calculation uses divisor 'N' for the
      covariance matrix.

And please note that unlike SAS, you can read the code to ascertain the 
precise computations done.

> felix
>
> ______________________________________________
> 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,                  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