Re: [R] question about scale() function

2008-01-03 Thread Domenico Vistocco
tom soyer wrote: > oops, it should be: rms=(sum((x-mean(x))^2)/(length(x)-1))^(1/2) > sd(x) does the same thing. domenico > On 1/3/08, tom soyer <[EMAIL PROTECTED]> wrote: > >> Thanks Jim. Yes it does... but I calculated the root mean square (rms), >> and couldn't reproduce the result withou

Re: [R] question about scale() function

2008-01-03 Thread tom soyer
oops, it should be: rms=(sum((x-mean(x))^2)/(length(x)-1))^(1/2) On 1/3/08, tom soyer <[EMAIL PROTECTED]> wrote: > > Thanks Jim. Yes it does... but I calculated the root mean square (rms), > and couldn't reproduce the result without multiplying the rms by 2. I don't > know why... > > > x=c(2,4,3,

Re: [R] question about scale() function

2008-01-03 Thread tom soyer
Thanks Jim. Yes it does... but I calculated the root mean square (rms), and couldn't reproduce the result without multiplying the rms by 2. I don't know why... > x=c(2,4,3,4,5) > mean(x) [1] 3.6 > x-mean(x) [1] -1.6 0.4 -0.6 0.4 1.4 > scale(x) [,1] [1,] -1.4032928 [2,] 0.3508232 [3

Re: [R] question about scale() function

2008-01-03 Thread jim holtman
Does this give you what you want? > x=c(2,4,3,4,5) > ?scale > scale(x,scale=FALSE) [,1] [1,] -1.6 [2,] 0.4 [3,] -0.6 [4,] 0.4 [5,] 1.4 attr(,"scaled:center") [1] 3.6 > Default is to performance scaling: "If scale is TRUE then scaling is done by dividing the (centered) columns of x by thei

Re: [R] question about scale() function

2008-01-03 Thread tom soyer
Never mind. I forgot the scale= parameter. On 1/3/08, tom soyer <[EMAIL PROTECTED]> wrote: > > Hi, > > The documentation for scale() states:"If center is TRUE then centering is > done by subtracting the column means (omitting NAs) of x from their > corresponding columns". But it seems that R is su

[R] question about scale() function

2008-01-03 Thread tom soyer
Hi, The documentation for scale() states:"If center is TRUE then centering is done by subtracting the column means (omitting NAs) of x from their corresponding columns". But it seems that R is subtracting something else instead of the column mean: > x=c(2,4,3,4,5) > mean(x) [1] 3.6 > x-mean(x) [1