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

From: Daniel Nordlund <res90sx5_at_verizon.net>
Date: Wed, 16 Jan 2008 00:39:00 -0800

> -----Original Message-----
> From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf
> Of Ron Michael
> Sent: Wednesday, January 16, 2008 12:15 AM
> To: r-help_at_stat.math.ethz.ch
> 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



R-help_at_r-project.org 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. Received on Wed 16 Jan 2008 - 08:59:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Jan 2008 - 10:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive