Skip to content
AI-grafen
CBuilderStatistics and probability· about 30 min· fundamentals that rarely change· verified 2026-09-20· EN

Statistics — mean, median and spread

Be able to calculate the mean, the median and the standard deviation of a small dataset, choose the right measure for the situation, and explain why spread matters as much as the middle.

Practise in Mattegrafen ↗ · Sannolikhet och statistik

Prerequisites

Intuition

Five colleagues' monthly commuting costs: 200, 250, 250, 300, 3000 (one of them flies). The mean is 800 kr — but nobody gets anywhere near that. The median (the middle value) is 250 and describes the group better. An extreme value drags the mean but not the median.

Spread says how spread out the values are. Two classes can have the same average grade, but one has everybody in the middle and the other has half at the top and half at the bottom.

Formal

For the values x₁ … xₙ:

  • Mean: x̄ = (x₁ + … + xₙ) / n
  • Variance: s² = Σ(xᵢ − x̄)² / n (population variance)
  • Standard deviation: s = √s²

Example [2, 4, 4, 4, 5, 5, 7, 9]: x̄ = 5, the squared deviations sum to 32, s² = 4, s = 2.

Why in AI? A model's errors are a dataset. The mean error says how good it is on average; the spread says whether it is evenly good or occasionally catastrophic. And normalising the data (subtract the mean, divide by s) is often the very first step before training.

Mastery means

  • Calculates the mean and the median correctly
  • Explains when the median is better than the mean

Sign in to do the exercises and build your mastery up.

Sources

All the sources and licences