Track 2 · Describing Data · Lesson 9 of 11
Robust summaries and relative spread
Calculate resistant summaries — the median absolute deviation, trimmed and winsorized means — and the coefficient of variation, and judge when each is appropriate.
A pay analyst must report a “typical salary” and its variability for a workforce where a few directors earn five times the median. A plain mean and standard deviation would be dominated by those few. Robust summaries describe the bulk of employees without throwing anyone away.
A summary is resistant (or robust) if a few extreme values cannot move it much. The median and the IQR are resistant; the mean and the standard deviation are not — one huge value can drag them anywhere. This lesson adds three more robust tools, and one tool for comparing spread across different scales.
- each value's distance from the median
- the median of those distances: a typical distance from the centre that ignores the extremes
- a scaling constant that makes the MAD comparable with the SD for normal data. R's
mad()applies it by default; this course reports the raw MAD unless it says scaled.
A trimmed mean removes a fixed proportion of the smallest and largest values and averages the rest. A 10% trimmed mean of 20 values drops the 2 smallest and the 2 largest (10% from each end; R: mean(x, trim = 0.1), which rounds the count down). A winsorized mean keeps every observation but pulls the extremes in: the 2 smallest are replaced by the 3rd smallest and the 2 largest by the 3rd largest, then all 20 are averaged. Both sit between the mean and the median in robustness.
Worked example
Ten hospital stays
Lengths of stay (days, sorted): 2, 3, 3, 4, 4, 5, 5, 6, 8, 30. Compare the mean and SD with robust alternatives.
Mean and SD: days, days — both driven by the 30-day stay.
Median: days. MAD: distances from 4.5 are 2.5, 1.5, 1.5, 0.5, 0.5, 0.5, 0.5, 1.5, 3.5, 25.5; sorted, their median is days (scaled: ).
10% trimmed mean: value off each end → drop 2 and 30: days.
10% winsorized mean: replace 2 by 3 and 30 by 8: days.
Mean 7.0 vs median 4.5, trimmed 4.75, winsorized 4.9; SD 8.26 vs MAD 1.5 (scaled 2.22). Without the 30-day stay the SD of the other nine would be only 1.81 days: one patient makes the SD more than four times larger, while the MAD only moves from 1.0 to 1.5 days.
In the (synthetic) salaries dataset (600 monthly base salaries), the mean is 16 397 SAR, the 10% winsorized mean 15 365 SAR, the 10% trimmed mean 14 560 SAR and the median 13 145 SAR: the more a summary resists the right tail, the lower it is. The SD is 9 751 SAR, while the MAD is 3 980 SAR (scaled 5 901 SAR).
- the sample standard deviation
- the mean, which must be positive and on a ratio scale (a true zero, no negative values)
The CV is unit-free, so it compares variability between variables measured in different units or at very different levels: an SD of 2 kg means a lot for 10-kg parcels (CV 20%) and little for 500-kg pallets (CV 0.4%). Salaries in the Technology department have CV 60.0%; in Operations, 56.8%.
Quick check
Which pair can sensibly be compared with the coefficient of variation?
Exercises
The lesson is complete when every exercise is answered correctly. Hints are free; viewing a worked solution before solving means the exercise won't count towards mastery.
0 of 8 exercises correct (not saved — sign in to keep your progress)
Exercise 1 · Guided, difficulty 1 of 3
Median absolute deviation
Nine bank customers waited the following number of minutes for a callback:
34, 104, 23, 21, 19, 21, 30, 30, 27
Calculate the (unscaled) median absolute deviation, MAD. Give it to 1 decimal place.
Exercise 2 · Practice, difficulty 2 of 3
A 10% trimmed mean
Twenty online orders had the following values (SAR):
396, 813, 221, 235, 131, 208, 367, 295, 358, 215, 321, 58, 92, 390, 368, 211, 202, 149, 209, 413
Calculate the 10% trimmed mean. Give it to 2 decimal places.
Exercise 3 · Practice, difficulty 2 of 3
A 10% winsorized mean
A fitness app recorded 20 users' average heart rate during a workout session (bpm):
68, 62, 64, 58, 80, 70, 152, 10, 64, 69, 63, 68, 63, 66, 55, 59, 62, 55, 62, 63
Some readings look like sensor glitches. Calculate the 10% winsorized mean to 2 decimal places.
Exercise 4 · Practice, difficulty 1 of 3
Coefficient of variation
A filling machine is set to 500 ml. Ten bottles from today's production contain (ml):
482.9, 490.7, 483.8, 479.0, 502.2, 483.4, 483.4, 479.6, 472.1, 492.0
Calculate the coefficient of variation as a percentage, to 2 decimal places.
Exercise 5 · Application, difficulty 2 of 3
Relative pay dispersion by department
Using base_salary_sar in the salaries dataset, calculate the coefficient of variation (sample SD ÷ mean, in percent) for the Finance and the Human Resources departments. Give both to 1 decimal place.
Data: salaries · Open in the lab to explore and calculate.
Exercise 6 · Practice, difficulty 2 of 3
Is the CV meaningful?
Decide whether the coefficient of variation is a meaningful summary for each variable.
Exercise 7 · Application, difficulty 2 of 3
Robust salary summaries
For base_salary_sar in the salaries dataset, calculate the 10% trimmed mean and the raw (unscaled) MAD. Give both in SAR to 1 decimal place.
Data: salaries · Open in the lab to explore and calculate.
Exercise 8 · Interpretation, difficulty 2 of 3
Comparing fund volatility
An intern compares three funds' daily returns (in percent) using the coefficient of variation and reports that the balanced fund, with CV ≈ 39 900%, is “by far the most volatile”. The growth fund's CV is about −9 500%. What is the best response?
What you can now do
- Calculate the median absolute deviation (raw and scaled)
- Calculate trimmed and winsorized means and explain how they differ
- Calculate the coefficient of variation and check that it is meaningful
- Choose robust summaries when extreme values dominate