Standard Deviation: Grouped

Same method, midpoints standing in.

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 Σ f x ÷ Σ f = (1 × 3 + 2 × 5 + 3 × 2) / 10 = 19 / 10 = 1.9 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: 1² × 3 = 3. In the same way, 2² × 5 = 20 and 3² × 2 = 18. So Σ f x² = 3 + 20 + 18 = 41, the sum of the squares of all ten values.

The frequencies act as weights, and the shorter formula becomes σ = √(Σ f x²/Σ f − x̄²). Here the variance is 41 / 10 − 1.9² = 4.1 − 3.61 = 0.49, and σ = √0.49 = 0.7 goals.

ffxfx²1 goal3332 goals510203 goals2618total101941

The totals give the mean, 19 ÷ 10 = 1.9, and the variance, 41 / 10 − 1.9² = 0.49. The standard deviation is √0.49 = 0.7 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 0 ≤ h < 10, 6 are in 10 ≤ h < 20 and 2 are in 20 ≤ h < 30. 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.

01234560–1010–2020–30

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 Σ f x ÷ Σ f = (5 × 2 + 15 × 6 + 25 × 2) / 10 = (10 + 90 + 50) / 10 = 150 / 10 = 15 cm. From here the method is the same as for a frequency table, with the midpoints as the values.

051015202530midmeanmid

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 10² = 100 to the total of the squared differences, so together they add 2 × 10² = 200.

The 6 plants at midpoint 15 are at the mean, so they add 6 × 0² = 0. The 2 plants at midpoint 25 are 10 above the mean and add 2 × 10² = 200. Altogether, Σ f(x − x̄)² = 200 + 0 + 200 = 400.

Share that total over the 10 plants: 400 ÷ 10 = 40 is the variance. Its square root is √40 ≈ 6.3, so the standard deviation of the heights is about 6.3 cm.

The shorter formula gives the same answer: Σ f x² = 5² × 2 + 15² × 6 + 25² × 2 = 50 + 1350 + 1250 = 2650, and 2650 / 10 − 15² = 265 − 225 = 40.

A full table

Twenty students record the hours h they spend on homework in one week: 2 are in the class 0 ≤ h < 2, 6 in 2 ≤ h < 4, 8 in 4 ≤ h < 6 and 4 in 6 ≤ h < 8. 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 1² × 2 = 2, 3² × 6 = 54, 5² × 8 = 200 and 7² × 4 = 196. The totals are Σ f = 20, Σ f x = 88 and Σ f x² = 452.

The estimated mean is Σ f x ÷ Σ f = 88 / 20 = 4.4 hours. The variance is Σ f x² ÷ Σ f − x̄² = 452 / 20 − 4.4² = 22.6 − 19.36 = 3.24, and the standard deviation is √3.24 = 1.8 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.

xffxfx²0–212222–43618544–658402006–87428196total2088452

The totals give the estimated mean, 88 ÷ 20 = 4.4 hours, and the variance, 452 / 20 − 4.4² = 3.24. The standard deviation is √3.24 = 1.8 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. 1.Write down the middle of each class: 10, 14, 18, 22 and 26 hours.

    hoursmiddle xff x8 to 1210212 to 1614716 to 20181220 to 2422724 to 28262totalthe middle of 16 to 20 is 18 hours
    hoursmiddle xff x8 to 1210212 to 1614716 to 20181220 to 2422724 to 28262totalthe middle of 16 to 20 is 18 hours
    Each class is replaced by the life at its middle: 10, 14, 18, 22 and 26 hours.
  2. 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.

    hoursmiddle xff x8 to 121022012 to 161479816 to 20181221620 to 2422715424 to 2826252total30540540 hours over 30 batteries540 divided by 30 = 18 hours
    hoursmiddle xff x8 to 121022012 to 161479816 to 20181221620 to 2422715424 to 2826252total30540540 hours over 30 batteries540 divided by 30 = 18 hours
    The totals are 30 batteries and 540 hours, so the estimated mean is 540 ÷ 30 = 18 hours.
  3. 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.

    middle xx − 18ff(x − 18)210-8214-471801222472682total30now the distance of each middle from 18
    middle xx − 18ff(x − 18)210-8214-471801222472682total30now the distance of each middle from 18
    The second grid holds the distance of each middle from the mean, ready to be squared and weighted by f.
  4. 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.

    middle xx − 18ff(x − 18)210-8212814-4711218012022471122682128total30480480 divided by 30 = 16the square root of 16 is 4 hours
    middle xx − 18ff(x − 18)210-8212814-4711218012022471122682128total30480480 divided by 30 = 16the square root of 16 is 4 hours
    (a) The weighted squares total 480, so the variance is 480 ÷ 30 = 16 and the standard deviation is √16 = 4 hours.
  5. 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.

    middle xx − 18ff(x − 18)210-8212814-4711218012022471122682128total3048027127281216202428one SD each side: 14 to 22 hourshalf of 7, all 12, half of 7
    middle xx − 18ff(x − 18)210-8212814-4711218012022471122682128total3048027127281216202428one SD each side: 14 to 22 hourshalf of 7, all 12, half of 7
    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. 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.

    middle xx − 18ff(x − 18)210-8212814-4711218012022471122682128total30480271272812162024283.5 + 12 + 3.5 = 19 batteries
    middle xx − 18ff(x − 18)210-8212814-4711218012022471122682128total30480271272812162024283.5 + 12 + 3.5 = 19 batteries
    (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.

More measuring data problems, worked step by step →

Practice Standard Deviation: Grouped in the app