Category: Statistics Level: 301
median = middle value; mean = balance point = (∑ x)/n
The median is the middle value once the data is sorted. The mean is the point where a dot plot balances, so a far-out value pulls the mean toward it and leaves the median alone.
Seven values, sorted from small to large, sit above the number line. Each dot is one value, and repeats stack up.
data: 2, 3, 3, 4, 5, 6, 12
Count in from both ends. Three values sit below the middle one and three sit above it, so the median is 4.
median = 4
Add the values and divide by 7. A fulcrum at 5 holds the beam level, as if every dot weighed the same.
mean = 35/7 = 5
Measure how far each dot sits from the mean. The total distance on the left equals the total on the right, which is why the beam balances.
3 + 2 + 2 + 1 = 8 = 1 + 7
The lone 12 sits far out, so it pulls the mean right of the median. Move it to 100 and the mean jumps; the median does not even blink.
mean = 5 > median = 4
cd svg-generator python3 -m svgmath render mean-median-balance --out /tmp/mean-median-balance
Source: svgmath/diagrams/statistics.py