Track 2 · Describing Data · Lesson 2 of 11

Mean, median and mode

Calculate the mean, median and mode, and choose the measure that honestly represents the centre of a dataset.

25 minFoundation8 graded exercisesFree

An HR report says the average commute at a company is 37 minutes. Yet six in ten employees travel for less than that, and half travel for 31.5 minutes or less — a few very long journeys pull the average up. Knowing which measure of centre to report, and why, is the difference between a summary that informs and one that misleads.

A measure of centre answers the question what is a typical value? with one number. There are three common answers, and they agree only when the data are roughly symmetric.

  • The mean is the balance point: add the values and divide by how many there are.
  • The median is the middle value once the data are sorted: half the observations are below it, half above.
  • The mode is the most frequent value or category.
xˉ=1n∑i=1nxi=x1+x2+⋯+xnn\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i = \frac{x_1 + x_2 + \cdots + x_n}{n}
The sample mean
xˉ\bar{x}
the sample mean (read “x-bar”)
xix_i
the ii-th observation
nn
the number of observations

For the median, sort the values first. With an odd number of values the median is the one in position (n+1)/2(n+1)/2. With an even number there are two middle values, in positions n/2n/2 and n/2+1n/2 + 1, and the median is their average.

Worked example

Seven commute times

Seven employees recorded their commute in minutes: 22, 35, 18, 27, 95, 31, 24. Find the mean and the median.

  1. Mean. The total is 22+35+18+27+95+31+24=25222 + 35 + 18 + 27 + 95 + 31 + 24 = 252, so xˉ=252/7=36\bar{x} = 252 / 7 = 36 minutes.

  2. Median. Sort the values: 18, 22, 24, 27, 31, 35, 95. With n=7n = 7 the median is the value in position (7+1)/2=4(7+1)/2 = 4, which is 27 minutes.

  3. Compare. Six of the seven commutes are below the mean of 36. The single 95-minute journey pulls the mean up, while the median does not move no matter how long that one journey is.

Mean = 36 minutes, median = 27 minutes. The median better describes the typical employee here.

Histogram of 240 commute times: a peak around 20 to 30 minutes and a long tail to the right reaching about 148 minutes.Commute time (minutes)Count
Commute times of 240 employees. Most are between 15 and 45 minutes; a long right tail of slow journeys stretches past 2 hours.
Show the data as a table
FromToCount
411.216
11.218.425
18.425.643
25.632.840
32.84029
4047.236
47.254.412
54.461.613
61.668.83
68.8766
7683.24
83.290.45
90.497.61
97.6104.80
104.81122
112119.20
119.2126.42
126.4133.62
133.6140.80
140.81481

In the full company dataset the mean commute is about 37.3 minutes and the median is 31.5 minutes. The distribution is right-skewed: a long tail of slow commutes on the right. In a right-skewed distribution the mean usually lies to the right of the median, because every extreme value adds its full size to the total, while the median only cares about order. Here 145 of the 240 employees (60%) commute for less than the mean.

Quick check

A city reports household incomes. A handful of households earn over 10 million SAR a year. Which measure best describes a typical household?

The mode is the only measure of centre for categorical data: you cannot average car, bus and metro, but you can say which is most common. A dataset can have two modes (bimodal) or none worth reporting (when every value occurs once).

Dataset

Employee commute times

240 rows · one row = one employee (their typical one-way commute) · synthetic data

EmployeeTravel modeShiftDistance (km)Commute time (minutes)
E001carday9.624
E002carday13.238
E003busday17.471
E004walkmorning2.524
E005walkday0.910
E006carday7.622

Each row is one employee: travel mode, shift, distance and commute time.

SituationPreferWhy
Roughly symmetric numbers, no extreme valuesMeanUses every value; the basis of most inference
Skewed numbers or extreme valuesMedianResistant: extreme values cannot move it
Categories (nominal data)ModeThe only measure that applies
Ordered categories (e.g. ratings 1–5)Median or modeOrder is meaningful, distances may not be
Which measure to use

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

Mean of a small sample

Not started

A café recorded how many customers arrived in each of eight half-hour periods:

21, 15, 23, 48, 21, 33, 41, 18

What is the mean number of customers per period? Give your answer to 2 decimal places.

Exercise 2 · Practice, difficulty 1 of 3

Median with an even number of values

Not started

Ten delivery times (minutes) were recorded:

24, 23, 23, 22, 21, 29, 26, 17, 30, 37

Find the median delivery time.

Exercise 3 · Application, difficulty 2 of 3

Centre of the company's commutes

Not started

Use the commute dataset (240 employees). Calculate the mean and the median of commute_min. You can open the dataset in the lab to calculate.

Data: commute · Open in the lab to explore and calculate.

Exercise 4 · Interpretation, difficulty 2 of 3

Which number goes in the report?

Not started

The HR team wants one number for “the typical commute” in the internal newsletter. The commute data are right-skewed: most journeys take 15–45 minutes, but a few take over two hours. Which should they report?

Choose one

Exercise 5 · Practice, difficulty 1 of 3

Choose the right measure

Not started

For each variable, choose the most appropriate measure of centre.

Preferred travel mode of employees (car, bus, metro, bike, walk)
House prices in a city
Heights of 500 adult women
Annual bonuses, where most employees receive 0 and a few receive large amounts
Blood type of donors (A, B, AB, O)

Exercise 6 · Challenge, difficulty 2 of 3

One extreme value

Not started

Nine employees' commutes (minutes) are 36, 26, 30, 24, 26, 36, 29, 29, 30. A tenth employee joins whose commute is 140 minutes.

By how many minutes does the mean increase, and by how many does the median increase? Give both to 2 decimal places.

Exercise 7 · Interpretation, difficulty 2 of 3

Explain the gap

Not started

In the commute data the mean (37.3 minutes) is about 6 minutes higher than the median (31.5 minutes). In two or three sentences, explain why the mean is higher and what that tells a reader about the data.

0 words

Exercise 8 · Practice, difficulty 1 of 3

Mode of travel

Not started

In the commute dataset, find the most common travel mode (the mode of the variable mode). What percentage of the 240 employees use it? Give the percentage to 1 decimal place.

Data: commute · Open in the lab to explore and calculate.

What you can now do

  • Calculate the mean and the median by hand and from a dataset
  • Find the mode, including for categorical data
  • Explain why skew and extreme values separate the mean from the median
  • Choose and justify the measure of centre for a report