Population Variance and Sample Variance - Cross Validated most recent 30 from stats.stackexchange.com 2019-09-15T14:32:46Z https://stats.stackexchange.com/feeds/question/51237 https://creativecommons.org/licenses/by-sa/4.0/rdf https://stats.stackexchange.com/q/51237 4 Population Variance and Sample Variance user21498 https://stats.stackexchange.com/users/0 2013-03-03T13:31:16Z 2013-03-03T21:40:10Z <p>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.</p> <p>I mean how is dividing the whole expression by $n-1$ in sample variance better than dividing by $n$?</p> <p>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}$$</p> <p>Thank You.</p> https://stats.stackexchange.com/questions/51237/-/51239#51239 2 Answer by ocram for Population Variance and Sample Variance ocram https://stats.stackexchange.com/users/3019 2013-03-03T14:25:33Z 2013-03-03T14:25:33Z <p>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. </p> <p>I just came across <a href="https://maxwell.ict.griffith.edu.au/sso/biased_variance.pdf" rel="nofollow">this pdf</a> where the formula for the bias is derived.</p> <p>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.</p> <p>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. </p> https://stats.stackexchange.com/questions/51237/-/51264#51264 0 Answer by Tom for Population Variance and Sample Variance Tom https://stats.stackexchange.com/users/17124 2013-03-03T21:40:10Z 2013-03-03T21:40:10Z <p>As a supplement to the math stat derivation of Bessel's correction, how about a simulation to help show what is going on?</p> <pre><code>#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 &lt;- 6 m &lt;- 1E+6 mu &lt;- 0 sigma &lt;- 1 v.pop &lt;- numeric(m) v.sam &lt;- numeric(m) for (i in 1:m) { x &lt;- rnorm(n,mu,sigma) x.bar &lt;- mean(x) v.sam[i] &lt;- sum((x-x.bar)^2) / n v.pop[i] &lt;- 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 mean(v.pop) #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 mean(v.sam) #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) </code></pre>