- Tally charts and questionnaires · coming soon
- Mean, median, mode
- Bar charts and pie charts
Fifty numbers and no picture
A school nurse measured the heights of 50 students in one year group, to the nearest centimetre. The data are invented for this lecture. Here they are, in the order she wrote them down.
162, 165, 159, 162, 158, 173, 158, 157, 164, 164, 168, 166, 160, 157, 151, 171, 161, 158, 161, 169, 172, 162, 174, 156, 167, 160, 163, 152, 167, 160, 165, 159, 166, 163, 163, 155, 153, 159, 161, 170, 166, 162, 156, 164, 154, 154, 168, 163, 157, 161
Without writing anything down, answer two questions. Where do most of the heights lie? Are there more students shorter than 155 cm, or taller than 169 cm?
Show the answer
You probably could not tell. The numbers are mostly in the 150s and 160s, but the list hides everything else. In fact there are exactly 5 students in each group. You would only know that after careful counting.
Here is the difficulty. No information is missing from the list, but it is not organised, and your eye cannot hold 50 numbers at once. This lecture builds two tools that organise data: the frequency table and the grouped frequency table. Then it answers a harder question. Once the data are grouped, how do you find the mean without the individual values?
Counting with a tally: the frequency table
Start with a smaller set. Fifteen students said how many brothers and sisters they have:
0, 1, 2, 3, 4, 0, 1, 1, 2, 0, 3, 1, 1, 2, 0
A frequency table lists each different value once, with the number of times it appears. That number is the value's frequency. To count without losing your place, go through the list once, and make a tally mark beside each value as you meet it. Every fifth mark is drawn across the four before it, so the marks come in easy bundles of five.
| Brothers and sisters | Tally | Frequency |
|---|---|---|
| 0 | |||| | 4 |
| 1 | 5 | |
| 2 | ||| | 3 |
| 3 | || | 2 |
| 4 | | | 1 |
| Total | 15 |
Always add up the frequency column. The total must equal the number of values in the list, here 15. If it does not, a value was missed or counted twice.
The table already answers some questions at a glance. The mode is the value with the highest frequency: 1, because five students have one brother or sister. Notice that the mode is the value 1, not the frequency 5.
The mean from a frequency table
To find the mean, you need the total of all 15 values. The table gives it quickly. The row "1 | 5" says that the value 1 appears five times. Those five values add up to . The row "2 | 3" says that 2 appears three times, which adds to the total. So each row adds value × frequency to the total.
Call the value and its frequency . Add a column for , the total that each row contributes.
| Value | Frequency | |
|---|---|---|
| 0 | 4 | 0 |
| 1 | 5 | 5 |
| 2 | 3 | 6 |
| 3 | 2 | 6 |
| 4 | 1 | 4 |
| Total | 15 | 21 |
The total of the column is the number of values. The total of the column is the sum of all the values. So the mean is
As in the lecture on averages, means "add up". So is "add up the column" and is "add up the frequencies". This is the ordinary mean, total ÷ number of values. The table only makes the adding faster.
A student adds the values in the first column, , and divides by 5. She gets a mean of 2. What has she forgotten?
Show the answer
She has treated each value as if it appeared once. But 0 appears four times and 4 appears only once. Her method gives the rare value 4 the same weight as the common values 0 and 1, so her answer is too big. The frequencies are the whole point of the table. Every value must be counted as many times as it appears, which is what does.
The median can also be read from the table, without writing the list out. With 15 values, the median is the 8th value in order. Keep a running total down the frequency column: the 0s are the 1st to 4th values, and the 1s are the 5th to 9th. So the 8th value is 1, and the median is 1.
The shoe shop in the lecture on averages sold sizes 5, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8 and 9. As a table, that is 5 | 1, 6 | 3, 7 | 5, 8 | 2, 9 | 1, with and . The mean is , as before. A shop that sells 3000 pairs a month keeps a table like this, not a list.
When there are too many different values: grouping
Now go back to the 50 heights. They take 24 different values, from 151 cm to 174 cm. A frequency table with 24 rows would be almost as hard to read as the list. Most frequencies would be 1, 2 or 3, and no pattern would show.
The answer is to put the values into groups called classes. Here the classes are 150–154, 155–159, 160–164, 165–169 and 170–174. Each class is 5 cm wide. Count how many heights fall in each class, using a tally as before.
| Height (cm) | Frequency |
|---|---|
| 150–154 | 5 |
| 155–159 | 12 |
| 160–164 | 18 |
| 165–169 | 10 |
| 170–174 | 5 |
| Total | 50 |
Now the shape appears. Most students are in the middle class, 160–164 cm. The numbers fall away on both sides, and they fall away evenly: 5 at each end. That is the pattern the list was hiding. The class with the highest frequency, 160–164, is called the modal class.
Good classes follow three rules. They do not overlap, so every value belongs to exactly one class. They leave no gaps, so every value has a class. And there are usually between about 5 and 10 of them, so the table is short but still shows a shape.
One detail needs care. The heights were rounded to the nearest centimetre. A student who is really 154.7 cm tall was recorded as 155 cm, and is counted in 155–159. So the class written 150–154 really holds every height from 149.5 cm up to 154.5 cm. These two numbers, where one class ends and the next begins, are the class boundaries. The numbers written in the table, 150 and 154, are just the labels of the class. This is why there is no real gap between 154 and 155.
Estimating the mean when the values are gone
Suppose you are given only the grouped table, not the list. What is the mean height?
You cannot find it exactly. The table says that 5 students are in the class 150–154, but not whether they are all 150 cm, all 154 cm, or spread out. So you must make an assumption. The fairest assumption is that the values in each class are, on average, in the middle of the class. So you treat every value as if it were at the midpoint of its class.
Using the boundaries gives the same answer: . Now each class acts like one row of an ordinary frequency table, with the midpoint as its value .
| Height (cm) | Midpoint | ||
|---|---|---|---|
| 150–154 | 5 | 152 | 760 |
| 155–159 | 12 | 157 | 1884 |
| 160–164 | 18 | 162 | 2916 |
| 165–169 | 10 | 167 | 1670 |
| 170–174 | 5 | 172 | 860 |
| Total | 50 | 8090 |
Treat every value in a class as if it were at the class midpoint. Then
, where is the midpoint of each class and is its frequency.
It is an estimate, because the grouping has thrown the exact values away.
Look closely at one class to see what the assumption does.
The five real heights add up to 764. The estimate counts them as . So in this class the estimate is 4 cm too low in total. In other classes the error goes the other way. Across a whole table, most of these small errors cancel. That is why the midpoint, and not the start or end of the class, is the fair choice.
You have the original list, so you can find the exact mean. Will it be higher than 161.8 cm, lower, or exactly the same?
Show the answer
The 50 heights add up to 8096, so the exact mean is cm. The estimate, 161.8 cm, is 0.12 cm too low: about one millimetre, from a table that kept only five frequencies. Without the list you could not know the direction. The estimate can be a little high or a little low.
How wide should the classes be?
The 5 cm classes were a choice. Classes 2 cm or 10 cm wide would give a different table, a different picture and a different estimate. Try it below with the same 50 heights.
Change the class width. The classes always start at 150 cm. Watch three things: the shape of the chart, the length of the table, and how far the estimate is from the exact mean (the dashed line).
| Class (cm) | Midpoint |
|---|
The table shows four choices of class width for the same 50 heights. The classes start at 150 cm. The exact mean is 161.92 cm.
| Width | Classes | Estimated mean | Difference |
|---|---|---|---|
| 1 cm | 25 | 161.92 | 0 |
| 2 cm | 13 | 161.94 | +0.02 |
| 5 cm | 5 | 161.8 | −0.12 |
| 10 cm | 3 | 162.1 | +0.18 |
With 1 cm classes, each class holds one height, so the estimate is exact, but 25 classes show no pattern. With 10 cm classes (17, 28 and 5 students), the table is short, but the shape is almost lost.
Every estimate stayed within about a third of a centimetre of the exact mean. So the class width hardly matters for the mean, but it matters a great deal for the picture. Narrow classes bury the pattern in a long, ragged table. Wide classes are easy to read but lose the shape.
That is it. That is the whole idea. A grouped table throws away the exact values on purpose, so that the shape can be seen. Every method for grouped data is a way of working with what remains: the classes and their frequencies.
What grouping throws away
Because the exact values are gone, some answers can only be estimated or located.
- The mode becomes the modal class. You know which class is most crowded, not which single value is most common.
- The median can be placed in a class. With 50 heights, the median is halfway between the 25th and 26th values. The running totals are 5, 17, 35, 45 and 50, so the 25th and 26th values are both in 160–164. That class contains the median. A later lecture, on cumulative frequency, shows how to estimate the median inside its class.
- The range is unknown. The smallest value could be anywhere in the first class, and the largest anywhere in the last.
Worked examples
Thirty students sat a test marked out of 49. The marks are grouped: 0–9: 2 students, 10–19: 5, 20–29: 9, 30–39: 10, 40–49: 4. The data are invented. Estimate the mean mark, and find the modal class and the class that contains the median.
Marks are whole numbers. The class 0–9 holds the ten marks 0, 1, 2, … 9, so its midpoint is . In the same way, the other midpoints are 14.5, 24.5, 34.5 and 44.5. A midpoint can be a value no student could score. That is fine: it is a balance point, not a mark.
: , , , , .
and , so the estimated mean is marks.
The modal class is 30–39, with 10 students. For the median, the 15th and 16th marks are needed. The running totals are 2, 7, 16, so both lie in 20–29. That class contains the median.
Check: 27.5 lies inside the range of possible marks, and near the crowded middle classes. ✓
Thirty people recorded how long their journey to work took, minutes. Here : 7 people, : 13, : 6, : 4. The data are invented. Estimate the mean time.
Time is measured on a continuous scale, so the classes are written with inequalities. The boundaries are exactly the numbers written: the first class runs from 0 to 10. So the midpoints are 5, 15, 25 and 35.
.
Estimated mean minutes.
Check: most people are in the class , and the mean lies in that class. ✓
A football team recorded the goals it scored in each match of a season: 0 goals in 4 matches, 1 goal in matches, 2 goals in 6 matches, 3 goals in 5 matches. The mean is 1.6 goals per match. The data are invented. Find .
Write and in terms of . . .
Multiply both sides by : . So , and .
Check: matches and goals, and . ✓
Here is one more piece of working to check. It contains the most common mistake with grouped data.
Forty students recorded their homework time, minutes, last night: : 18 students, : 12, : 6, : 4. One line of this working is wrong. Tap it.
Forty students recorded their homework time, minutes: : 18 students, : 12, : 6, : 4. Here is a student's working, with a comment on each line.
- The midpoints are 10, 30, 50 and 70 minutes. Correct. For example, (0 + 20) ÷ 2 = 10.
- The number of students is 18 + 12 + 6 + 4 = 40. Correct. This is Σf.
- The estimated mean is (10 + 30 + 50 + 70) ÷ 4 = 40 minutes. Wrong. This treats each class as if it held one student. Each midpoint must be multiplied by its frequency: Σfx = 180 + 360 + 300 + 280 = 1120, and 1120 ÷ 40 = 28 minutes.
- Check: 40 minutes lies between 0 and 80 minutes, so it is sensible. The statement is true, but the check is too weak to catch the error. A better check: almost half the students did 20 minutes or less, so the mean should be well below the middle of the range, 40.
The wrong answer, 40, ignores the frequencies. The correct estimate, 28 minutes, is pulled down towards the crowded first class. It is the same mistake as adding 0 + 1 + 2 + 3 + 4 in the brothers-and-sisters table.
Three traps
Some students multiply each frequency by the first number of the class (150, 155, …) or by the last (154, 159, …). For the heights, these give 159.8 cm and 163.8 cm, each 2 cm away from 161.8 cm. Using the start of every class pushes every value down, so the errors all point the same way and cannot cancel. Always find the midpoints first, in their own column.
In the brothers-and-sisters table, the highest frequency is 5. The mode is not 5. The mode is the value that has that frequency, which is 1. In the same way, the modal class of the heights is 160–164, not 18.
A table with classes 10–20, 20–30 and 30–40 is badly made. A value of exactly 20 could go in two classes, so it might be counted twice or in the wrong place. For whole numbers, write 10–19, 20–29, 30–39. For measurements, use inequalities such as , , which say exactly where 20 belongs.
Work each one on paper first. Open a hint only when you are stuck.
-
The number of people in each of 20 cars passing a school gate was: 1, 2, 1, 3, 1, 4, 2, 1, 1, 2, 5, 1, 2, 3, 1, 1, 2, 4, 1, 2. Make a frequency table with a tally. Then find the mode, the median and the mean.
Hint 1
The values are 1 to 5. Go through the list once, making one tally mark for each car. Check that the frequencies add up to 20.
Hint 2
The frequencies are 9, 6, 2, 2 and 1. For the mean, add an column. For the median, use running totals to find the 10th and 11th values.
Full answer
Frequencies: 1 person: 9 cars, 2: 6, 3: 2, 4: 2, 5: 1. Total 20. ✓
Mode: 1 person (frequency 9).
Median: the 10th and 11th values. The running totals are 9, 15, …, so the 1s are the 1st to 9th values and the 2s are the 10th to 15th. Both middle values are 2, so the median is 2.
Mean: , and people per car.
Check: 40 people in 20 cars is 2 per car. ✓
-
The masses of 40 parcels, kg, are grouped: : 6, : 13, : 12, : 7, : 2. Estimate the mean mass. Which class contains the median?
Hint 1
The midpoints are 1, 3, 5, 7 and 9.
Hint 2
Find and divide by 40. For the median you need the 20th and 21st parcels in order of mass.
Full answer
.
Estimated mean kg.
Running totals: 6, 19, 31, 38, 40. The 20th and 21st parcels are both in , so that class contains the median.
Check: the modal class is and the median class is the next one. A mean of 4.3 kg, just above 4, fits between them. ✓
-
Twenty-five students counted the text messages they sent in one day: 0–9: 3, 10–19: 8, 20–29: 10, 30–39: 4. What are the smallest and the largest possible values of the true mean? Estimate the mean with midpoints. What do you notice?
Hint 1
The smallest possible mean happens if every student sent the smallest number allowed in their class.
Hint 2
Use 0, 10, 20, 30 for the smallest mean, and 9, 19, 29, 39 for the largest.
Full answer
Smallest: messages.
Largest: messages.
With midpoints 4.5, 14.5, 24.5, 34.5: , and messages.
The estimate, 20.5, is exactly halfway between 16 and 25. This is because every midpoint is halfway between the smallest and largest value of its class. So the true mean is certainly between 16 and 25, and the midpoint estimate sits in the middle of that range.
-
A taxi company grouped the lengths of 50 journeys, km: : 22, : 15, : 9, more than 20 km: 4. The last class has no upper end. Estimate the mean twice: once assuming that the longest journeys average 25 km, and once assuming 40 km. How much does the choice matter? Does it change the class that contains the median?
Hint 1
The midpoints of the first three classes are 2.5, 7.5 and 15. The classes do not all have the same width, but the method is the same.
Hint 2
The first three classes give . Add 4 × 25, then 4 × 40.
Full answer
With 25 km: , and km.
With 40 km: , and km.
The choice moves the estimate by 1.2 km, about 15%, even though only 4 journeys out of 50 are in the open class. The mean uses the size of every value, so it depends on what you assume about the longest journeys.
The median is between the 25th and 26th journeys. The running totals are 22, 37, …, so both are in , whatever you assume. The median does not care how long the longest journeys are. To estimate the mean well, the company should find out more about those 4 journeys.
Grouped tables are how large data sets are usually published. In Singapore's Census of Population 2020, the Department of Statistics reported the gross monthly income from work of about 2.2 million employed residents in 14 classes. Most classes are 1000 dollars wide: below 1000, 1000–1999, 2000–2999, and so on. Near the top, one class is 12 000–14 999, and the last class is "15 000 and over", with no upper end at all. About 173 000 people, roughly 8% of the total, are in that open class.
A reader who wants the mean from this table meets exactly the problem of the taxi journeys. If you assume the open class averages 20 000 dollars, the midpoint estimate is about 6200 dollars. If you assume 30 000, it is about 6980. The table alone cannot decide. An office that holds the individual records can calculate the exact mean. The grouped table is for everyone else: it shows the shape of the data and keeps the details private.
A grouped table is also the starting point for two pictures you will meet later: the histogram and the cumulative frequency curve.
- A frequency table lists each value with its frequency, the number of times it appears, and the frequencies must add up to the number of values.
- From a frequency table, the mean is , because each row adds value × frequency to the total.
- When data take many different values, grouping them into classes that do not overlap shows the shape of the data.
- From grouped data, the mean can only be estimated, by treating every value as if it were at the midpoint of its class.
- Grouping gives a modal class instead of a mode, a class that contains the median instead of the median, and no exact range.
- The choice of class width hardly changes the estimated mean, but it decides how clearly the shape of the data can be seen.