[R] Standard Deviation in R
arun
smartpink111 at yahoo.com
Wed Jun 11 12:04:20 CEST 2014
Hi Bob,
You may check:
library(multicon)
?popsd()
sd(1:3)
#[1] 1
popsd(1:3)
#[1] 0.8164966
sd(1:3)*sqrt(2/3)
#[1] 0.8164966
A.K.
The formula I generally use to compute the standard deviation is the square root of the variance where the variance is E(X^2) - (E(x))^2. That is, the divisor is n , not n-1. I think it would have been better if the R documentation would have explicitly told me that it was using n-1 not n. By the way, is there another standard function in R, that will compute either the variance or the standard deviation by dividing by n instead of n-1?
Thanks
Bob
On Sunday, June 8, 2014 10:33 PM, Greg Snow <538280 at gmail.com> wrote:
Which formula for standard deviation are you using?
If you know the population mean then you should divide by n (3 in this
case), but if you don't know the population mean and use the mean
calculated from the sample then it is more usual to use n-1 as the
denominator (this makes the variance an unbiased estimator of the
population variance). That is what the R sd function does since it is
much more common to use it on a sample rather than an entire
population.
On Sun, Jun 8, 2014 at 1:17 AM, arun <smartpink111 at yahoo.com> wrote:
> Hi,
> Please check this link:
> http://stats.stackexchange.com/questions/25956/what-formula-is-used-for-standard-deviation-in-r
>
> A.K.
>
>
> It is my understanding that the R function SD finds the standard deviation of a random variable or a list. Please consider the following list: { 1, 2, 3 }. I claim that the standard deviation of this list is not 1. However, the following R statement returns 1:
> sd ( seq(1:3) )
> What am I missing?
>
> I thank the group in advance for their responses.
>
> Bob
>
>
> ______________________________________________
> 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.
--
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com
More information about the R-help
mailing list