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.

30 minIntermediate8 graded exercisesFree

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.

MAD=median⁡i ∣xi−median⁡(x)∣,MADscaled=1.4826×MAD\text{MAD} = \operatorname{median}_i\,\big|x_i - \operatorname{median}(x)\big|, \qquad \text{MAD}_{\text{scaled}} = 1.4826 \times \text{MAD}
Median absolute deviation
∣xi−median⁡(x)∣|x_i - \operatorname{median}(x)|
each value's distance from the median
MAD\text{MAD}
the median of those distances: a typical distance from the centre that ignores the extremes
1.48261.4826
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.

  1. Mean and SD: xˉ=70/10=7.0\bar{x} = 70/10 = 7.0 days, s=8.26s = 8.26 days — both driven by the 30-day stay.

  2. Median: (4+5)/2=4.5(4 + 5)/2 = 4.5 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 (1.5+1.5)/2=1.5(1.5 + 1.5)/2 = 1.5 days (scaled: 1.4826×1.5=2.221.4826 \times 1.5 = 2.22).

  3. 10% trimmed mean: g=⌊10×0.1⌋=1g = \lfloor 10 \times 0.1 \rfloor = 1 value off each end → drop 2 and 30: (3+3+4+4+5+5+6+8)/8=4.75(3 + 3 + 4 + 4 + 5 + 5 + 6 + 8)/8 = 4.75 days.

  4. 10% winsorized mean: replace 2 by 3 and 30 by 8: (3+3+3+4+4+5+5+6+8+8)/10=4.9(3 + 3 + 3 + 4 + 4 + 5 + 5 + 6 + 8 + 8)/10 = 4.9 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.

Loading the interactive…
The ten hospital stays. Compare how the mean/SD and the median/MAD react to the long stay.

Try this

  • Drag the 30-day stay to 40. Which statistics change, and which stay exactly the same?

  • Now drag it down to 9. How close do the SD and the scaled MAD (1.4826×1.4826 \times MAD) become once the extreme value is gone?

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).

CV=sxˉ×100%\text{CV} = \frac{s}{\bar{x}} \times 100\%
Coefficient of variation: spread relative to the mean
ss
the sample standard deviation
xˉ\bar{x}
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

Not started

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

Not started

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.

SAR

Exercise 3 · Practice, difficulty 2 of 3

A 10% winsorized mean

Not started

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

Not started

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

Not started

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?

Not started

Decide whether the coefficient of variation is a meaningful summary for each variable.

Monthly salaries of employees (SAR)
Daily temperature in °C
Daily percentage returns of a fund (mean close to 0)
Time to complete an assembly task (minutes)
Exam scores standardised to have mean 0
Weights of parcels in a depot (kg)

Exercise 7 · Application, difficulty 2 of 3

Robust salary summaries

Not started

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

Not started

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?

Choose one

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