How is it that lowering the number of frequence,$n$ by $1$ in the for formula for Population and Sample Variance account for the discrepency of using sample rather than population.

I mean how is dividing the whole expression by $n-1$ in sample variance better than dividing by $n$?

I am referring to the formula $$s^2=\frac{\sum_{i=1}^{n}({x_i-x_{avg}})^2}{n-1}$$ more accurate than $$s^2=\frac{\sum_{i=1}^{n}({x_i-x_{avg}})^2}{n}$$

Thank You.


If you use $$ s^2 = \frac{\sum_i^n (x_i - \bar{x})^2}{n} $$ as an estimate, based on a sample of size $n$, of the population variance then your estimate results to be biased. The formula for the bias however shows that $$ \tilde{s}^2 := \frac{n}{n-1} s^2 $$ is unbiased.

I just came across this pdf where the formula for the bias is derived.

With a sample of size $n$, the usual practice is then to use $$ \tilde{s}^2 = \frac{\sum_i^n (x_i - \bar{x})^2}{n-1} $$ as an estimate of the population variance.

If, on the other hand, the $x_i$'s form the whole population, then there is no discussion about bias or anything, and we just apply the definition of the variance.

  • $\begingroup$ Well, of course,if the entire population is sampled, then there is no bias. $\endgroup$ – russellpierce Mar 3 '13 at 15:43
  • $\begingroup$ @Russell I think what ocram is alluding to is that when the entire population is sampled, then $\tilde{s}^2$ is biased. This shows that a key issue has not yet been discussed: this variance estimate is unbiased only for certain forms of sampling. $\endgroup$ – whuber Mar 3 '13 at 18:40
  • $\begingroup$ @whuber: Ah, yes, of course. $\endgroup$ – russellpierce Mar 3 '13 at 19:25

As a supplement to the math stat derivation of Bessel's correction, how about a simulation to help show what is going on?

#Draw 6 values from a N(0,1) distribution and calculate
#the variance using the true population mean and the 
#mean calculated from the sample - repeat 1E6 times
n <- 6
m <- 1E+6
mu <- 0
sigma <- 1
v.pop <- numeric(m)
v.sam <- numeric(m)
for (i in 1:m) {
  x <- rnorm(n,mu,sigma)
  x.bar <- mean(x)
  v.sam[i] <- sum((x-x.bar)^2) / n
  v.pop[i] <- sum((x-mu)^2) / n

#if you use the true population mean to calculate the estimate of
#the population variance, on the average you will get a good estimate

#if you use the sample mean in place of the population mean, on
#the average your estimate of the population variance will be too 
#small because the individuals in a sample tend to be more closely 
#clustered around their own mean than they are around the population mean

#the ratio of the estimate of population variance made with the
#population mean to the estimate of population variance made with 
#the sample mean is 
mean(v.pop) / mean(v.sam)

#which happens to look a lot like
n / (n-1)

#which we use to adjust upward the estimate of the population
#variance made with the sample mean
n / (n-1) * mean(v.sam)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy