The difference between population variance and sample variance is on the denominator of the formula. In particular, the denominator for population variance is N, whereas sample variance is n-1. The following uses formulas and examples to explain the difference between them.
Data Example
The following are 5 numbers that we are going to calculate variance. The mean of these 5 numbers is 56.
Formula and Example for Population Variance
The following is the formula for population variance.
\[\sigma ^2=\frac{\sum_{i=1}^N (x_i-\mu)^2}{N} \]
where
- μ: Population mean
- xi: The ith element from the population
- N: Population size
Suppose that the 5 numbers shown above are all the numbers in a population. Then, we can then calculate the variance as follows.
\[\sigma ^2=\frac{\sum_{i=1}^N (x_i-\mu)^2}{N}=\frac{(20-56)^2+(50-56)^2+(30-56)^2+(80-56)^2+(100-56)^2}{5}=904\]
Formula and Example for Sample Variance
For sample variance, the formula is as follows.
\[S^2=\frac{\sum_{i=1}^n (x_i-\bar{x})}{n-1} \]
where
- \( \bar{x} \): sample mean
- xi: The ith element from the population
- n: sample size
Thus, if the 5 numbers shown above are a sample of data from a population (which should have more than 5 numbers), the denominator should be 4, rather than 5, since we use one degree of freedom to estimate the mean.
\[S^2=\frac{\sum_{i=1}^n (x_i-\bar{x})}{n-1} =\frac{(20-56)^2+(50-56)^2+(30-56)^2+(80-56)^2+(100-56)^2}{5-1}=1130\]
Conclusion and Further Reading
To conclude, this tutorial shows the formulas for population variance and sample variance. Further, this tutorial uses examples to further illustrate the difference between them.
Note that, there are related concepts such as sum of squares. The relationship between variance and sum of squares is that sum of squares is the numerator of variance, regardless of population variance or sample variance. To have a better understanding of sum of squares, please check the following tutorial.