# Thread: variance and standard deviation

1. ## variance and standard deviation

Why do we average by divivding by n-1 rather than n in calculating the variance? the formula I am using is s^2=[ sum of (x- X)^2]/(n-1) where X= mean. Thank you very much for your help!

2. Originally Posted by 0123
Why do we average by divivding by n-1 rather than n in calculating the variance? the formula I am using is s^2=[ sum of (x- X)^2]/(n-1) where X= mean. Thank you very much for your help!
Because you are using s^2 to estimate the population variance, and dividing
by n results in a biased estimate while dividing by n-1 gives an unbiased
estimator.

RonL

3. could you be more clear? because I do not understand why it is unbiased in the case on n-1. Thanks again.

4. Originally Posted by 0123
could you be more clear? because I do not understand why it is unbiased in the case on n-1. Thanks again.
Take my word for it, the proof is longer than I am prepared to reproduce here.

I can illustrate it by example:

Code:
>x=normal(100,5);
>m=sum(x)/5;         ..100 means of samples of size 5
>v=sum(x^2)/5-m^2;   ..100 (1/n) variances of samples of size 5
>vv=sum(s')/100      .. average of 100 (1/n) variance of sample of size 5
0.80403236
>vv*5/4              .. corrected to 1/(n-1) variances
1.00504045
>
Here we see the average variance of samples of size 5 from a population of
variance 1 is ~0.8, while the corrected average variance is ~1, as required.

RonL