Calculating Mean and Standard Deviation From Frequency Chart

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     |

• Can you explain -- are these binned categories or are labels in the first column actual values (i.e. you have two exact '10' values for Pause) Commented Apr 11, 2015 at 1:57
• I don't have access to the original data. The two values in the first row probably weren't exactly 10, but were rounded. There are thousands of values, so the fact that they were rounded to the nearest 10 really shouldn't make a huge difference. Commented Apr 11, 2015 at 2:08
• It will make a big difference to the mean if 10 represents "1-10" or "10-19" though (i.e. if it's the upper or lower bound of a category rather than the middle) Commented Apr 11, 2015 at 2:30
• The pauses go through the tens of thousands. That's why it won't be an issue. Commented Apr 11, 2015 at 3:26
• Well, it could change the mean by 10. If that's not a problem for you (and by the sound of it, it may not be), then there's no problem. In which case you probably needn't bother with Sheppard's corrections or anything either. Commented Apr 11, 2015 at 3:57

1 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