Function scale (PR#2209)

Ben Bolker bolker@zoo.ufl.edu
Thu, 24 Oct 2002 10:21:22 -0400 (EDT)


  The function is behaving as documented ...

   "If `scale' is `TRUE' then scaling is done by dividing the (centered)
    columns of `x' by their root-mean-square, and if `scale' is `FALSE',
    no scaling is done.

   "The root-mean-square for a column is obtained by computing the
    square-root of the sum-of-squares of the non-missing values in the
    column divided by the number of non-missing values minus one."

   It says "root-mean-square", not "standard error" or "standard
deviation".  If you set center=TRUE, then the two are equivalent. If you
*want* it to scale by standard deviation just set scale=sd(l) [or in the
matrix case, scale=apply(l,2,sd)].

  Ben Bolker

On Thu, 24 Oct 2002 lucas@toulouse.inra.fr wrote:

> I found a problem with scale function,
> while using center=FALSE and scale=TRUE:
> 
> all column are not divided by standard error,
> but divided by sqrt (1/(n-1) sum Xi^2 )
> 
> Example:
> > l<- c(1,2,3)
> > scale(l,F,T)
>           [,1]
> [1,] 0.3779645
> [2,] 0.7559289
> [3,] 1.1338934
> attr(,"scaled:scale")
> [1] 2.645751
> 
> 2.645751 = sqrt( 1/2 * (1+4+9) )
> 
> 
> Antoine Lucas & Aymeric Labourdette 
> 
> --
> Antoine  Lucas        
> INRA, Unité de biométrie et     |  Tel 05 61 28 53 34
> intelligence artificielle       |  Fax 05 61 28 53 35
> http://genopole.toulouse.inra.fr/~lucas
> 
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-- 
318 Carr Hall                                bolker@zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._