Standard Deviation – How to Calculate Mean and Standard Deviation from a Frequency Chart

frequencyhistogrammeanstandard deviation

I have only a frequency table like that below. How can I get the mean and standard deviation?

| Pause | Count |
|-------|-------|
| 10    | 2     |
| 20    | 4     |
| 30    | 6     |
| 40    | 5     |

Best Answer

Because of the huge range of categories, you can probably get away with simply assuming each category label is a bin center and then treating the data as if it actually were 10, 10, 20, 20, 20, 20, 30, 30, ... and finding mean and standard deviation. I don't think Sheppard's corrections will be necessary on such a scale.

You don't actually need to produce the vector of individual data, since you can work out the contribution as if you did have each case. Imagine this was our whole table:

| Pause | Count |
|-------|-------|
| 10    | 2     |
| 20    | 4     |
| 30    | 6     |
| 40    | 5     |
`~~~~~~~~~~~~~~~'

If we produced the entire set of individual values

 10 10 20 20 20 20 30 30 30 30 30 30 40 40 40 40 40

we could just directly compute mean and standard deviation on them (28.24 and 10.15)

However, what we'd do instead is calculate something to give the same effect.

So if $P_i$ is the value of the i-th Pause-label and $c_i$ is the corresponding count, the mean will be $\bar{P}=\frac{\sum_i P_i c_i}{\sum_i c_i}$ = (10 x 2 + 20 x 4 + 30 x 6 + 40 x 5)/(2+4+6+5) = 28.24. This is the same as adding all the individual values and dividing by the total number of values.

We can do the same thing with the variance.

$\frac{\sum_i (P_i-\bar{P})^2 c_i}{\sum_i c_i}$

This would yield the n-divisor form of the variance, so if we want Bessel's correction we need instead:

$\frac{\sum_i (P_i-\bar{P})^2 c_i}{(\sum_i c_i) -1}$

We can simplify this by expanding the numerator out and doing some algebra, but that can be numerically unstable; better to stick to this form.

In this case, that formula gives 96.8858, and the standard deviation is the square root of that, about 10.15

If you do want Sheppard's correction, see this question or Wikipedia