Different results in calculating SD of 2 numbers

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Different results in calculating SD of 2 numbers

Ron_M
Hi all,

Can anyone tell me why I am getting different results in calculating SD of 2 numbers ?

> (1.25-0.95)/2
[1] 0.15
> sd(c(1.25, 0.95))
[1] 0.2121320          # why it is different from 0.15?

Regards,

Send instant messages to your online friends http://uk.messenger.yahoo.com 
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Different results in calculating SD of 2 numbers

Bjørn-Helge Mevik-3
Ron Michael <[hidden email]> writes:

> Can anyone tell me why I am getting different results in calculating
> SD of 2 numbers ?
>
>> (1.25-0.95)/2
> [1] 0.15

Because this is not the SD?  Try

> (1.25-0.95)/sqrt(2)

:-)

>> sd(c(1.25, 0.95))
> [1] 0.2121320          # why it is different from 0.15?

--
Bjørn-Helge Mevik

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Different results in calculating SD of 2 numbers

Daniel Nordlund
In reply to this post by Ron_M
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Ron Michael
> Sent: Wednesday, January 16, 2008 12:15 AM
> To: [hidden email]
> Subject: [R] Different results in calculating SD of 2 numbers
>
> Hi all,
>
> Can anyone tell me why I am getting different results in calculating SD of 2 numbers ?
>
> > (1.25-0.95)/2
> [1] 0.15

Because the above is not the standard deviation of two numbers.  The sample based estimate of the population standard deviation of a set of numbers (which is what sd() computes) is

(sum((x-mean(x))^2 )/(length(x)-1))^.5

which for your two numbers would be

( (1.25 - 1.1)^2 + (.95 - 1.1)^2 )^.5

> > sd(c(1.25, 0.95))
> [1] 0.2121320          # why it is different from 0.15?
>
> Regards,
>

Hope this is helpful,

Dan

Daniel Nordlund
Bothell, WA  USA

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Different results in calculating SD of 2 numbers

Martin Maechler
In reply to this post by Ron_M
>>>>> "RM" == Ron Michael <[hidden email]>
>>>>>     on Wed, 16 Jan 2008 00:14:56 -0800 (PST) writes:

    RM> Hi all,
    RM> Can anyone tell me why I am getting different results in calculating SD of 2 numbers ?

    >> (1.25-0.95)/2
    RM> [1] 0.15
    >> sd(c(1.25, 0.95))
    RM> [1] 0.2121320          # why it is different from 0.15?

because  1 is different from 2 !
If 2 was 1, than sqrt(2) == 1 as well, but actually I don't
think the universe and we all would exist in that case ....

Martin Maechler, ETH

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Different results in calculating SD of 2 numbers

Ted.Harding-2
On 16-Jan-08 08:45:04, Martin Maechler wrote:

>>>>>> "RM" == Ron Michael <[hidden email]>
>>>>>>     on Wed, 16 Jan 2008 00:14:56 -0800 (PST) writes:
>
>     RM> Hi all,
>     RM> Can anyone tell me why I am getting different results in
> calculating SD of 2 numbers ?
>
>     >> (1.25-0.95)/2
>     RM> [1] 0.15
>     >> sd(c(1.25, 0.95))
>     RM> [1] 0.2121320          # why it is different from 0.15?
>
> because  1 is different from 2 !
> If 2 was 1, than sqrt(2) == 1 as well, but actually I don't
> think the universe and we all would exist in that case ....
> Martin Maechler, ETH

Of course we would!! -- Since FALSE implies X is TRUE for any X.

But FALSE would also imply that X is FALSE, so you are entitled
to your view as well, Martin.

With best wishes,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 16-Jan-08                                       Time: 09:47:20
------------------------------ XFMail ------------------------------

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Different results in calculating SD of 2 numbers

Jim Lemon
(Ted Harding) wrote:

> On 16-Jan-08 08:45:04, Martin Maechler wrote:
>
>>>>>>>"RM" == Ron Michael <[hidden email]>
>>>>>>>    on Wed, 16 Jan 2008 00:14:56 -0800 (PST) writes:
>>
>>    RM> Hi all,
>>    RM> Can anyone tell me why I am getting different results in
>>calculating SD of 2 numbers ?
>>
>>    >> (1.25-0.95)/2
>>    RM> [1] 0.15
>>    >> sd(c(1.25, 0.95))
>>    RM> [1] 0.2121320          # why it is different from 0.15?
>>
>>because  1 is different from 2 !
>>If 2 was 1, than sqrt(2) == 1 as well, but actually I don't
>>think the universe and we all would exist in that case ....
>>Martin Maechler, ETH
>
>
> Of course we would!! -- Since FALSE implies X is TRUE for any X.
>
> But FALSE would also imply that X is FALSE, so you are entitled
> to your view as well, Martin.
>
Then again, as pi might have been equal to 1 prior to the Big Bang, I
see no reason why sqrt(2) shouldn't have been equal to 1 as well. After
all, in those days we were all one...

Jim

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Different results in calculating SD of 2 numbers

Heinz Tuechler
At 11:32 16.01.2008, Jim Lemon wrote:

>(Ted Harding) wrote:
> > On 16-Jan-08 08:45:04, Martin Maechler wrote:
> >
> >>>>>>>"RM" == Ron Michael <[hidden email]>
> >>>>>>>    on Wed, 16 Jan 2008 00:14:56 -0800 (PST) writes:
> >>
> >>    RM> Hi all,
> >>    RM> Can anyone tell me why I am getting different results in
> >>calculating SD of 2 numbers ?
> >>
> >>    >> (1.25-0.95)/2
> >>    RM> [1] 0.15
> >>    >> sd(c(1.25, 0.95))
> >>    RM> [1] 0.2121320          # why it is different from 0.15?
> >>
> >>because  1 is different from 2 !
> >>If 2 was 1, than sqrt(2) == 1 as well, but actually I don't
> >>think the universe and we all would exist in that case ....
> >>Martin Maechler, ETH
> >
> >
> > Of course we would!! -- Since FALSE implies X is TRUE for any X.
> >
> > But FALSE would also imply that X is FALSE, so you are entitled
> > to your view as well, Martin.
> >
>Then again, as pi might have been equal to 1 prior to the Big Bang, I
>see no reason why sqrt(2) shouldn't have been equal to 1 as well. After
>all, in those days we were all one...
>
>Jim
>

Of course the question is off topic, but I like it. In my
understanding mathematics is a theoretical model, that may or may not
describe properly certain aspects of a "reality". I cannot see, why a
theoretical model should have any influence on our existence, as long
as we don't apply it in an unreasonable way.
To believe in our existence or to prove it is a totally different case.

Heinz

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [PS] Different results in calculating SD of 2 numbers

Ben Fairbank
In reply to this post by Ron_M
And another problem, in addition to the points made by others, is that
the formula for the SD gives a biased estimate (it underestimates it) of
the population SD for small n when sampling from a normal distribution.
When n is about twelve or so or more, the bias can usually be ignored
(it is about 2.2%), but when you have only two numbers, the correction
factor is about 1.25.

The approximate correction formula, as I understand it, is
(n-.75)/(n-1), so if n = 2, then it is 1.25/1, but this is not exact.
The "real" formula is more complex (not difficult, but involves the
gamma function) and my reference to it is not at this office, or I would
give it.

HTH,

Ben

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
On Behalf Of Ron Michael
Sent: Wednesday, January 16, 2008 2:15 AM
To: [hidden email]
Subject: [PS] [R] Different results in calculating SD of 2 numbers

Hi all,

Can anyone tell me why I am getting different results in calculating SD
of 2 numbers ?

> (1.25-0.95)/2
[1] 0.15
> sd(c(1.25, 0.95))
[1] 0.2121320          # why it is different from 0.15?

Regards,

Send instant messages to your online friends
http://uk.messenger.yahoo.com 
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.