The request

From Nicole Bennett, HR Business Partner
Your goal
Pick what happens to the mean and the median of the 60 salaries in employees.
What Nicole gets, and why
The lesson
Two summaries, two sensitivities
The mean and the median answer “where is the middle?” in different ways. The mean adds every salary and divides by the headcount, so every salary’s size matters. The median sorts the salaries and takes the middle one (with 60 people, the average of the 30th and 31st), so only the order matters.
employees["salary"].mean() # 99316.67
employees["salary"].median() # 81000.0
The mean is $18,000 above the median because the top of the payroll (a CEO at $285,000, a COO at $235,000, a Head of Engineering at $205,000) pulls it up.
Doing the arithmetic
Any change to one value moves the mean by the change divided by the count:
change = 570_000 - 285_000 # 285,000
change / len(employees) # 4,750
So the mean goes from $99,317 to $104,067. Nobody’s actual pay changed except the CEO’s, yet the “average salary” quoted on the careers page rises by almost $5,000.
The median does not care how far above the middle the top salary is. Before and after the raise the 30th and 31st salaries are the same people with the same pay, so the median stays at $81,000.
Robust statistics
A summary that barely reacts to a few extreme values is called robust. The median, percentiles and the IQR (level 4) are robust. The mean, the standard deviation and the range (maximum minus minimum) are not: one extreme value can move them a lot.
That doesn’t make the mean wrong. It answers a different question. “How much does payroll cost per head?” is a mean question; the CEO’s raise really does cost more per head. “What does a typical employee here earn?” is a median question, and the honest careers page quotes the median.
Common mistakes
- Assuming one extreme value moves every statistic. It moves the mean and the spread, not the median or the quartiles.
- Quoting the mean as “typical” pay. With a few executive salaries in a small company, the mean describes nobody.
- Forgetting the denominator. One $285,000 change in a team of 60 is $4,750 on the mean; in a team of 6 it would be $47,500.
Interview note
“Which is more affected by outliers, the mean or the median?” comes up in nearly every analyst screen. Answer with a concrete example and the arithmetic, like this one, and you show you know why, not only what.
Lantern lit!
Practised: meanmedianoutliersrobust statistics
- Solved
- No hints
- First run
