Pepelen
Data Analytics from Scratch: SQL, Spreadsheets and Metrics

Lesson

Mean, median and mode — and when the mean lies

Learner can compute mean, median and mode on a small dataset and choose the median when outliers make the mean misleading.

1 / 6

Three measures of centre: what they are and when to use them

Three measures of centre: what they are and when to use them

When you need to describe a 'typical' value in a dataset, three statistics are commonly used. The mean (average) is the sum of all values divided by the count of values. The median is the middle value once the list is sorted in ascending order: if the count is odd, take the central element; if even, average the two central elements. The mode is the value that appears most often. Let's work through the key example. Six employees have the following salaries (in thousands): 30, 32, 35, 38, 40, 300. The mean is (30+32+35+38+40+300)/6 = 475/6 ≈ 79.17 thousand. To find the median, the list is already sorted and has an even count (6 values), so we average the 3rd and 4th elements: (35+38)/2 = 36.5 thousand. There is no mode here because every value appears exactly once. Notice the problem: the mean of 79.17 suggests a typical employee earns roughly 80 thousand, yet five out of six earn between 30 and 40 thousand. The single outlier — the salary of 300 — drags the mean far above what most employees actually receive. The median of 36.5 honestly represents the middle of the group and is not affected by the extreme value. Rule of thumb: when the distribution is roughly symmetric and free of outliers, the mean works well. When there are outliers or the distribution is skewed (incomes, house prices, server response times), prefer the median. The mode is most useful for categorical data — for example, finding the most popular product category or the most frequent city in an orders table.
Lesson notes
Three measures of centre: what they are and when to use them
When you need to describe a 'typical' value in a dataset, three statistics are commonly used. The mean (average) is the sum of all values divided by the count of values. The median is the middle value once the list is sorted in ascending order: if the count is odd, take the central element; if even, average the two central elements. The mode is the value that appears most often. Let's work through the key example. Six employees have the following salaries (in thousands): 30, 32, 35, 38, 40, 300. The mean is (30+32+35+38+40+300)/6 = 475/6 ≈ 79.17 thousand. To find the median, the list is already sorted and has an even count (6 values), so we average the 3rd and 4th elements: (35+38)/2 = 36.5 thousand. There is no mode here because every value appears exactly once. Notice the problem: the mean of 79.17 suggests a typical employee earns roughly 80 thousand, yet five out of six earn between 30 and 40 thousand. The single outlier — the salary of 300 — drags the mean far above what most employees actually receive. The median of 36.5 honestly represents the middle of the group and is not affected by the extreme value. Rule of thumb: when the distribution is roughly symmetric and free of outliers, the mean works well. When there are outliers or the distribution is skewed (incomes, house prices, server response times), prefer the median. The mode is most useful for categorical data — for example, finding the most popular product category or the most frequent city in an orders table.
Mean, median and mode — and when the mean lies — Data Analytics from Scratch: SQL, Spreadsheets and Metrics