12.3 Mean and Median with Frequencies

Suppose we ask every student in a class how many pets their household keeps, and tabulate the replies:

Pets 2 3 4 5 6 7 8 9
Frequency 4 12 8 6 3 1 1 1

A tempting slip is to average the distinct counts: \frac{2+3+\dots+9}{8} = 5.5. But that throws away how often each count shows up! The value 3 appears 12 times and must be weighed 12 times. Folding in the frequencies:

\text{mean} = \frac{(2\times 4) + (3\times 12) + (4\times 8) + (5\times 6) + (6\times 3) + (7\times 1) + (8\times 1) + (9\times 1)}{4+12+8+6+3+1+1+1}.

The numerator is 8 + 36 + 32 + 30 + 18 + 7 + 8 + 9 = 148 and the total frequency is 36, so

\text{mean} = \frac{148}{36} \approx 4.11.

The average household keeps about 4.11 pets.

The median from a frequency table

There are 36 values, so the median is the average of the 18th and 19th values in sorted order. Rather than listing all 36 numbers, we run a cumulative count of the frequencies, starting from the smallest value:

Value 2 3 4 5 6 7 8 9
Frequency 4 12 8 6 3 1 1 1
Cumulative 4 16 24 30 33 34 35 36

By the value 3 we have reached position 16; by the value 4 we have reached position 24. So positions 17 through 24 are all the value 4. Both the 18th and 19th positions land inside this band, so

\text{median} = 4.

Cumulative Frequency To pull the median out of a frequency table, add the frequencies upward from the smallest value. The first cumulative total that reaches or passes the middle position names the value the median takes, no need to spell out every single data point.

A Third Centre: the Mode Besides mean and median, there is the mode, the value that occurs most often. In the pets table above, the count 3 appears 12 times, more than any other, so the mode is \mathbf{3}. The mode is the only one of the three “centres” that can be used even when the data isn’t numbers, for example, the most-ordered dish at a canteen, or the most common shoe size in a shop.