Sub topic 4
The mode: the most frequent value
This chapter assumes you can read a list or a simple frequency table and do basic arithmetic. It also assumes you know the mean and median from the earlier chapters. The mode is the easiest of the five statistics to compute, but the GRE builds many of its traps around it.
What the mode is
The mode of a data set is the value that appears most often. It is the only one of the common measures that you find by counting instead of by adding or ordering.
Take the list 2, 4, 4, 4, 5, 5, 7, 9. The value 4 appears three times, 5 appears twice, and every other value appears once. The mode is 4.
A frequency table makes the counting explicit:
| Value | Frequency |
|---|---|
| 2 | 1 |
| 4 | 3 |
| 5 | 2 |
| 7 | 1 |
| 9 | 1 |
The mode is the value with the greatest frequency. The mode is 4. It is not 3, which is only how many times 4 appears. Mixing up the value and its frequency is the most common mistake on this topic.
How many modes can a data set have?
A data set can have one mode, several modes, or none. The usual conventions are:
- Unique mode: one value has the highest frequency. Example: 1, 2, 2, 3 has mode 2.
- Two or more modes: several values tie for the highest frequency, and all of them are modes. Example: 1, 1, 2, 2, 3 has modes 1 and 2. A set with two modes is called bimodal.
- No mode: every value appears exactly once, so no value is more frequent than another. Example: 1, 2, 3, 4 has no mode.
- All values identical: the list 6, 6, 6 has mode 6.
Computing the mode, including the edge cases
The Python below follows the conventions above. It also shows why you cannot always trust a library function to follow them.
from collections import Counter
import statistics
def modes(values):
"""Return the sorted list of modes; an empty list means no mode."""
if not values:
return []
counts = Counter(values)
top = max(counts.values())
if top == 1 and len(counts) > 1:
return []
return sorted(v for v, c in counts.items() if c == top)
print(modes([2, 4, 4, 4, 5, 5, 7, 9])) # [4]
print(modes([1, 1, 2, 2, 3])) # [1, 2]
print(modes([1, 2, 3, 4])) # []
print(modes([6, 6, 6])) # [6]
print(statistics.multimode([1, 2, 3])) # [1, 2, 3]The last line shows a difference in convention. Python's statistics.multimode treats a list of all-distinct values as having every value as a mode. The GRE convention is that such a set has no mode. On the exam, use the GRE convention. Also, statistics.mode returns only the first mode it meets when there is a tie (Python 3.8 and later), so it hides ties.
Sorting and reading the list
A list may arrive unsorted, such as 7, 2, 9, 4, 5, 4, 4, 5. The mode does not depend on order, but sorting groups equal values together and makes the count easy. Sorting this list gives 2, 4, 4, 4, 5, 5, 7, 9.
For long lists, tally each value as you scan once, instead of rescanning for every value. When the data arrive as a table of values and frequencies, you do not count at all. Find the largest number in the frequency column, then report the value in the same row.
The mode and the other statistics
The mode behaves differently from the mean and the median in three ways.
Outliers do not affect it. An extreme value changes the mean a lot and the mode very little. If the 9 in our list becomes 90, the mean jumps and the mode stays at 4.
import statistics
data = [2, 4, 4, 4, 5, 5, 7, 9]
with_outlier = [2, 4, 4, 4, 5, 5, 7, 90]
print(statistics.mean(data), statistics.mode(data)) # 5 4
print(statistics.mean(with_outlier), statistics.mode(with_outlier)) # 15.125 4It always equals a value in the data set. The mean can be a number that is not in the list, such as 5.5 for a list of integers. The median of an even-sized list can also fall between two values. A mode is always one of the values you were given.
It moves with transformations as an ordinary value. If you add a constant to every value, the mode increases by that constant. If you multiply every value by a constant, the mode is multiplied by it. The mode transforms in the same way as the mean and the median.
import statistics
data = [2, 4, 4, 4, 5, 5, 7, 9]
transformed = [3 * x + 10 for x in data]
print(transformed) # [16, 22, 22, 22, 25, 25, 31, 37]
print(statistics.mode(transformed)) # 22, which is 3 * 4 + 10This works because the transformation does not change which values are equal to each other. The counts stay the same. Only the labels on the values change.
Worked problem: a missing value and a unique mode
The list 4, 7, 7, x, 9 has a mean of 7.
- The sum must be 5 × 7 = 35.
- The known values add to 4 + 7 + 7 + 9 = 27.
- So x = 35 − 27 = 8.
With x = 8, the value 7 appears twice and every other value appears once, so the mode is 7.
Now change the question. For which values of x is 7 the unique mode, ignoring the mean?
- If x = 7, then 7 appears three times, so it is the unique mode.
- If x = 4, then 4 and 7 each appear twice. That is a tie, so 7 is not the unique mode.
- If x = 9, then 7 and 9 each appear twice. That is also a tie.
- Any other x appears once, so 7 is the unique mode.
So 7 is the unique mode for every x except 4 and 9. Questions like this test whether you check for ties. A new value can create a mode, break a mode, or change nothing, depending on whether it matches a value that is already at the top frequency.
Common GRE traps
- Reporting the frequency instead of the value. The answer to "What is the mode?" is a data value.
- Assuming a mode exists. If a Quantity Comparison problem says nothing about repeated values, do not assume one. A list with all distinct values has no mode.
- Assuming the mode is unique. If a tie is possible, a statement like "the mode is greater than 5" may be true for one mode and false for another. Check every mode.
- Confusing "the mode increases" with "the mean increases". Adding a new value equal to the current mode makes that value more dominant but does not change the mode. It can still change the mean.
- Reading across the wrong column of a table. In a table with a value column and a frequency column, the mode comes from the value column.
Summary of when the mode helps
The mode is the right summary when you care about the most common outcome, and it is the only one of the three centers that makes sense for categories such as the most common color. On the GRE the data are numerical. The mode usually appears as a constraint: "the list has a mode of 6" tells you that 6 appears more often than any other value, and you can use that fact to fix some of the unknown entries in the list.
Exercise
The list 3, 8, 3, 5, 8, 9, 1 is given. What are the modes? Then, if a new value of 3 is added to the list, what is the mode of the new list?
Show answer
In the original list, 3 appears twice, 8 appears twice, and 5, 9, and 1 each appear once. The highest frequency is 2, shared by 3 and 8, so the modes are 3 and 8. After adding another 3, the value 3 appears three times and 8 appears twice. The new list has the unique mode 3.
Exercise
A list of six integers is 5, 5, 9, x, x, 12, and its unique mode is 5. What is the largest integer x could be, and which integer values of x must be excluded?
Show answer
The value 5 appears twice. If x = 5, then 5 appears four times, which is still a unique mode, so that is allowed. If x is any other value except 9 and 12, then x appears twice and ties with 5, so 5 is no longer the unique mode. That means no value of x other than 5 works. So x must equal 5, and the largest (and only) possible x is 5. All other integers, including 9 and 12, are excluded because they create a tie at frequency 2.
Exercise
In the list 10, 20, 20, 30, every value is multiplied by 2 and then 5 is added to each. What is the mode of the new list?
Show answer
The original mode is 20. Applying 2x + 5 to the mode gives 2(20) + 5 = 45. The new list is 25, 45, 45, 65, and its mode is 45.