Calculate standard deviation given tabled number of occurrences I am going back through my old homework assignments to study for an upcoming Statistics test and one of the questions gives a table with number of children and number of women who have that number of children:
Children        |   0    |    1    |    2    |    3    |    4    |    5
----------------+--------+---------+---------+---------+---------+--------
Number of Women |  27    |   22    |   30    |   12    |    7    |    2

The question is:
Find the sample standard deviation of the number of children.
As I understand it, the sample standard deviation is
$s=\sqrt{\frac{1}{n-1}(\sum\limits_{i=1}^n{X^2_i-n\bar{X}^2})}$
And in order to do this, I would need to sum up each of the individual values given within the set of $n$ values. However, since there are 100 values (collapsed as the table shows), How might I do this by hand, that is, without the aid of a program on a test?
I was able to (I think) calculate $\bar{X}$ by summing the product of the number of children by the number of women and dividing by $n$:
$\bar{X}=\frac{1}{n}(\sum\limits_{i=1}^n{X_i})$
$\bar{X}=\frac{1}{100}\big[(0*27)+(1*22)+(2*30)+(3*12)+(4*7)+(5*2)\big] = 1.56$
But I'm unsure how to do the same with the sample standard deviation calculation.
I tried searching and looking online for the answer to this, but I'm obviously a novice at this, so I might just be searching for the wrong things.
 A: The correct formula for the unbiased standard deviation is
$$\sigma =  \sqrt\frac{\sum_{i=1}^n(X_i - \overline{X})^2}{n-1} $$
Edit
To compute the standard deviation of the children the right formula to apply is:
$$ \sigma = \sqrt{E[(X-\mu)^2]} = \sqrt{E[X^2] - (E[X])^2}$$
So to compute the mean, the procedure you did could be rewritten as:
$$ \overline{X} = E[X] = \sum{P(X)X} = (0.27\times0) + (0.22\times1) + (0.30\times2) + (0.12\times3) +(0.07\times4) + (0.02\times5) = 1.56$$
I let you complete the exercise.
A: Your formula for the mean is correct.
Presumably you can work out the mean from the variance.
Have you seen the formula for the population variance $\text{Var}(X)=E(X^2)-E(X)^2$? 
The usual sample variance is the same, with Bessel's correction -
$\text{Var}(x)=\frac{n}{n-1} [\overline{x^2}-\overline{x}^2]$.
(Where $\overline{x^2}$ means 'take the mean of the squared observations')
From that you can use exactly the same method you did for the mean to work out the mean of the $x^2$ values and hence obtain the variance and then the standard deviation.
A: What I ended up doing (which kinda goes along the lines of giuseppe's answer) is to look at the calculation for $s$ as:
$s=\sqrt{\frac{1}{n-1}\big((\sum\limits_{i=1}^n{X^2_i})-n\bar{X}^2\big)}$
Note the parentheses surrounding the summation. This can be done because $n\bar{X}^2$ can be seen as a constant term which can be removed from the summation.
This then lends to the calculation easily as before:
$s^s=\frac{1}{99}\Big(\big[(0*27)^2+(1*22)^2+(2*30)^2+(3*12)^2+(4*7)^2+(5*2)^2\big] - 1.56\Big)$
$s^2 = 1.7034$
$s = \sqrt{s^2} = 1.30515$
