1

I was given the following sample {9,8 ; 10,2 ; 10,4 ; 9,8 ; 10 ; 10,2 ; 9,6}. So if I compute the mean I obtain 10. If I compute the standard deviation with:

$\sqrt{\frac{1}{6} \sum{(x_i-10)^2}}$

I obtain 0,2828. But if first I compute the mean of the squared values, which gives 100,0685714, and then use the formula:

$\sqrt{100,0685714 - 10^2}$

I obtain 0,2618. Where is my mistake?

EDIT

I found the reason of the error. If I divide by 7 instead of 6 (population mean), both formulas give the same. Which brings new questions. Does the second formula works only while using the population formula? Is there a 'simplified formula' to compute faster the sample error, like the one I used in the second case?

tac
  • 150

1 Answers1

1

I'm assuming the former expression you have for the standard deviation is $\sqrt{\frac{1}{n-1}\sum(x_i-\bar{x})^2}$. If we decompose what's inside, we get:

\begin{aligned} \sqrt{\frac{1}{n-1}\sum({x_i^2}-2x_i\bar{x}+\bar{x}^2)}&= \sqrt{\frac{1}{n-1}\left(\sum{x_i^2}-n\bar{x}^2\right)} \\&= \sqrt{\sum\frac{{x_i^2}}{n-1}-\frac{n}{n-1}\bar{x}^2} \end{aligned}

While not as simple as the version for the population standard deviation, it isn't too bad. There may be a simpler expression I'm not aware of.

Paul Ash
  • 1,129
  • Did you distribute the square over the sum? – tac Jun 05 '23 at 02:52
  • @tac Yes. I edited my response to include that part. See if you can work out the algebraic manipulation to get the final expression. – Paul Ash Jun 05 '23 at 03:01
  • 1
    @tac now that I'm looking at your sample data, it looks like you have 7 observations. But in your edit, you're saying you should've divided by 7 instead of 6. So were you supposed to use the population sample SD? – Paul Ash Jun 05 '23 at 03:06
  • If I divide by 7 both formulas give the same, but if I divide by 6 the formulas dos not give the same. No, I need to find the mean of the sample – tac Jun 05 '23 at 03:52
  • @tac the only way both formulas will give you the same answer when dividing by 6 is if you use the formula in my response. – Paul Ash Jun 05 '23 at 04:18
  • 2
    $\sqrt{\frac{n}{n-1}}\sqrt{\frac{\sum {x_i^2}}n-\bar{x}^2}$ is an alternative presentation which makes Bessel's correction more explicit – Henry Jun 05 '23 at 13:30