The Most Popular Answer
A shoe store needs to know which size to stock most. Mean size = 9.3 — no one buys size 9.3. Mode = 10 (most ordered). Mode is the only central tendency that works for categories.
Core Insight: Mode is the value appearing most often. It's the only measure that applies to categorical/nominal data and the only one that can have multiple values.
Types of Mode
No mode: each value appears once
Unimodal: one clear most-frequent value
Bimodal: two values tie for most frequent
Multimodal: three+ values tie
Worked Example
[2, 3, 3, 4, 5, 5, 5, 6] → Mode = 5 (3 times) Unimodal
[1, 2, 2, 3, 4, 4, 5] → Mode = 2, 4 Bimodal
[red, blue, red, green, red] → Mode = red Categorical!
Python Implementation
import statistics
from collections import Counter
data = [2, 3, 3, 4, 5, 5, 5, 6]
print(statistics.mode(data)) # 5
print(statistics.multimode(data)) # [5]
# Handle bimodal safely
bimodal = [1, 2, 2, 3, 4, 4, 5]
print(statistics.multimode(bimodal)) # [2, 4]
# Categorical
colors = ["red", "blue", "red", "green", "red", "blue"]
print(statistics.mode(colors)) # red
# Manual with Counter
c = Counter(data)
freq = c.most_common(1)[0][1]
modes = [k for k,v in c.items() if v == freq]
print(f"Modes: {modes}, freq: {freq}")
R Implementation
stat_mode <- function(x) {
tbl <- table(x)
names(tbl)[tbl == max(tbl)]
}
data <- c(2, 3, 3, 4, 5, 5, 5, 6)
cat("Mode:", stat_mode(data), "\n") # 5
colors <- c("red","blue","red","green","red")
cat("Mode:", stat_mode(colors), "\n") # red
Mode vs Mean vs Median
| Feature | Mean | Median | Mode |
|---|---|---|---|
| Works on categories | ❌ | ❌ | ✅ |
| Multiple values possible | ❌ | ❌ | ✅ |
| Always exists | ✅ | ✅ | ❌ |
| Outlier resistant | ❌ | ✅ | ✅ |
Key Takeaways
- Most frequent value — mode counts occurrences, not magnitude
- Categorical data — mode is the only valid central tendency measure for nominal data
- Multimodal — multiple modes often indicate distinct subpopulations
- Use
multimode()in Python to safely handle bimodal cases - R lacks built-in — use
table()and find the max frequency - Bimodal signal — two modes suggest two different groups mixed together