A frequency table: each value counts f times
A team scores 1 goal in 3 games, 2 goals in 5 games and 3 goals in 2 games. Written out, the ten values are 1, 1, 1, 2, 2, 2, 2, 2, 3, 3. With x for a value and f for its frequency, the mean is goals.
The standard deviation of the ten values needs the square of every value, and the value 1 occurs 3 times, so its square counts 3 times: . In the same way, and . So , the sum of the squares of all ten values.
The frequencies act as weights, and the shorter formula becomes . Here the variance is , and goals.
The totals give the mean, 19 ÷ 10 = 1.9, and the variance, . The standard deviation is goals.
Grouped data keeps only the counts
Ten plants are measured, and their heights are recorded only by class. Writing h for a height in centimeters, 2 plants are in the class , 6 are in and 2 are in . The middle class holds most of the plants.
The heights themselves are gone, so there are no values to square. As with the mean of grouped data, each class needs one value to stand in for all of its values.
The ten heights by class: 2, then 6, then 2 plants.
Midpoints, weighted by the counts
Use the midpoint of each class, halfway between its two ends: 5, 15 and 25 cm. Treat the 2 plants in the first class as 5 cm tall, the 6 in the second as 15 cm, and the 2 in the third as 25 cm, and weight each midpoint by its frequency.
The estimated mean is cm. From here the method is the same as for a frequency table, with the midpoints as the values.
The midpoints 5, 15 and 25 sit halfway along their classes. The estimated mean, 15, is the middle midpoint, since the first and last classes hold 2 plants each.
Each class adds its squared distance, f times
Take the classes one at a time. The 2 plants at midpoint 5 are 15 − 5 = 10 from the mean. Each adds to the total of the squared differences, so together they add .
The 6 plants at midpoint 15 are at the mean, so they add . The 2 plants at midpoint 25 are 10 above the mean and add . Altogether, .
Share that total over the 10 plants: 400 ÷ 10 = 40 is the variance. Its square root is , so the standard deviation of the heights is about 6.3 cm.
The shorter formula gives the same answer: , and .
A full table
Twenty students record the hours h they spend on homework in one week: 2 are in the class , 6 in , 8 in and 4 in . Estimate the mean and the standard deviation.
Set out a table with a row for each class and four columns: the midpoint x, the frequency f, the product fx and the product fx². The midpoints are 1, 3, 5 and 7. The fx column is 2, 18, 40 and 28, and the fx² column is , , and . The totals are , and .
The estimated mean is hours. The variance is , and the standard deviation is hours.
The definition gives the same answer with more work. The midpoints are −3.4, −1.4, +0.6 and +2.6 from the mean, their squares are 11.56, 1.96, 0.36 and 6.76, and weighted by the frequencies these give 23.12, 11.76, 2.88 and 27.04, a total of 64.8. Then 64.8 ÷ 20 = 3.24, as before.
The totals give the estimated mean, 88 ÷ 20 = 4.4 hours, and the variance, . The standard deviation is hours.
An estimate, like the grouped mean
A standard deviation from grouped data is an estimate. Every value in a class was taken to be at its midpoint, but the real values are spread through the class. Say that the standard deviation of the homework hours is about 1.8 hours, and that it is an estimate.
Two slips are common. The first is to leave out the frequencies and average the squared distances of the midpoints alone, which counts a class of 2 students as much as a class of 8. The second is to use the upper end of each class, or the class width, in place of the midpoint.
Worked example: The Life of a Batch of Batteries, Grouped: an Estimated Mean and Standard Deviation
Question A laboratory tested 30 batteries and grouped the life, h hours, of each: 8 < h ≤ 12 for 2 batteries, 12 < h ≤ 16 for 7, 16 < h ≤ 20 for 12, 20 < h ≤ 24 for 7 and 24 < h ≤ 28 for 2. (a) Estimate the mean life and the standard deviation, dividing by the number of batteries. (b) Estimate how many of the 30 batteries last within one standard deviation of the mean, taking the lives to be spread evenly inside each class.
1.Write down the middle of each class: 10, 14, 18, 22 and 26 hours.
Each class is replaced by the life at its middle: 10, 14, 18, 22 and 26 hours. 2.Multiply each middle by its frequency: 10 × 2 = 20, 14 × 7 = 98, 18 × 12 = 216, 22 × 7 = 154 and 26 × 2 = 52. The totals are 30 batteries and 20 + 98 + 216 + 154 + 52 = 540 hours, so the estimated mean is 540 ÷ 30 = 18 hours.
The totals are 30 batteries and 540 hours, so the estimated mean is 540 ÷ 30 = 18 hours. 3.Now the distance of each middle from the mean, and its square times the frequency: 10 − 18 = −8, and 2 × 64 = 128; 14 − 18 = −4, and 7 × 16 = 112; 18 − 18 = 0, and 12 × 0 = 0; 22 − 18 = 4, and 7 × 16 = 112; 26 − 18 = 8, and 2 × 64 = 128.
The second grid holds the distance of each middle from the mean, ready to be squared and weighted by f. 4.(a) Those products total 128 + 112 + 0 + 112 + 128 = 480, so the variance is 480 ÷ 30 = 16 and the standard deviation is √16 = 4 hours. The estimated mean is 18 hours.
(a) The weighted squares total 480, so the variance is 480 ÷ 30 = 16 and the standard deviation is √16 = 4 hours. 5.One standard deviation each side of the mean runs from 18 − 4 = 14 hours to 18 + 4 = 22 hours. The class 12 < h ≤ 16 is 4 hours wide and half of it lies in that range, which is half of 7, or 3.5 batteries. The class 16 < h ≤ 20 lies inside it completely, which is 12 batteries. Half of the class 20 < h ≤ 24 lies in it, another 3.5 batteries.
One standard deviation each side of the mean runs from 14 to 22 hours: half of the second class, all of the third, and half of the fourth. 6.(b) That gives 3.5 + 12 + 3.5 = 19 batteries, so about 19 of the 30 last within one standard deviation of the mean. Check: that is a little under two thirds of the batch, which is what a single peaked batch usually gives.
(b) That is 3.5 + 12 + 3.5 = 19 of the 30 batteries.
Answer: (a) the estimated mean is 18 hours and the standard deviation is 4 hours; (b) about 19 of the 30 batteries
Common mistakes
- Averaging the five squared distances without their frequencies: 64 + 16 + 0 + 16 + 645 = 32. That counts the class holding 12 batteries no more heavily than the class holding 2. Each squared distance must be multiplied by its own frequency, and the total divided by 30.
- Counting the whole of the class 12 < h ≤ 16 as lying within one standard deviation of the mean. Only the part from 14 to 16 hours does, which is half the width of the class, so on an even spread only half of its 7 batteries are counted.