Statistics Quest

Median and mode

The median is the middle value of the sorted data (robust to outliers); the mode is the most frequent value (the only centre for nominal data).

median={x((n+1)/2)n odd12(x(n/2)+x(n/2+1))n even\text{median} = \begin{cases} x_{((n+1)/2)} & n \text{ odd} \\[4pt] \tfrac{1}{2}\left(x_{(n/2)} + x_{(n/2+1)}\right) & n \text{ even} \end{cases}
Median of the sorted values.
x(k)x_{(k)}
The kk-th smallest value (sorted order).
nn
Number of values.

When to use

  • Median: skewed quantitative data or data with outliers (incomes, house prices, delays); ordinal data.
  • Mode: categorical data ("most common payment method"), or to describe peaks of a distribution (unimodal, bimodal).

How to interpret

Half the values are at or below the median and half at or above it. Mean > median suggests right skew; mean < median suggests left skew (a rule of thumb, not a guarantee). The engine reports all tied modes, and no mode when every value occurs once.

Common mistakes

  • Taking the middle of the unsorted list.
  • For even nn, picking one of the two middle values instead of averaging them.
  • Reporting a mode for continuous measurements where every value is distinct — use a histogram peak instead.

Example

Values 3, 8, 5, 12, 5, 9. Sorted: 3, 5, 5, 8, 9, 12. With n=6n = 6 the median is (5+8)/2=6.5(5 + 8)/2 = 6.5; the mode is 5 (it appears twice).