Wiki
Intro10 min read

Describing data: location, spread, and shape

Mean, median, variance, quantiles and the box plot — what each summary captures and how each responds to an outlier.

Before modelling anything, you look at the data. Where is it centred? How far does it spread? Is it symmetric or skewed? A handful of numbers answers these questions, and the first job of statistics is knowing which number to trust when the data is messy.

Two different ideas of center

The mean is the balance point — the value that would make the data see-saw level. The median is the middle value — half the data below, half above. They agree on symmetric data and diverge on skewed data, and the difference is itself information.

Move the eight measurements below and watch the summaries update. Then add the outlier and see which numbers flinch.

Move the data — standard deviation vs the five-number summary

0306090120
mean
49.8
median
49.5
SD
5.2
IQR
6.3

The box spans Q1 to Q3 with the median inside; the diamond is the mean. Push a point to 118 and the mean and SD jump while the median and IQR stay put — that is the robustness difference between the two families of summaries, and the reason a single outlier can move a variance-based statistic much more than a quantile.

Measures of location

The sample mean is the arithmetic average,

xˉ=1n∑i=1nxi,\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i,

and it is the value that minimizes the sum of squared deviations. The median is the middle value once the data is sorted; for even nn it is the average of the two middle values. The mode is the most frequent value, useful for categorical data where means are meaningless.

The mean is sensitive to every observation because each one contributes. The median depends only on rank. One extreme value can drag the mean arbitrarily far while leaving the median untouched — the robustness distinction that the widget makes visible.

Measures of spread

Sample variance uses squared deviations from the mean:

s2=1n−1∑i=1n(xi−xˉ)2,s^2 = \frac{1}{n-1}\sum_{i=1}^{n}(x_i - \bar{x})^2,

and the sample standard deviation is s=s2s = \sqrt{s^2}. The n−1n-1 (Bessel's correction) is there because the deviations are measured from the sample mean, which is itself estimated from the data; dividing by n−1n-1 makes the estimator unbiased. Population variance, when you truly have the whole population, divides by nn.

Variance is in squared units, which is why standard deviation is usually the number you quote — it is in the same units as the data. The range (max − min) is the crudest spread measure and the most outlier-sensitive.

Quantiles and the box plot

A quantile is the inverse of the cumulative distribution: the qq-th quantile is the value below which a fraction qq of the data lies. The five-number summary is

min⁡, Q1, median, Q3, max⁡,\min,\ Q_1,\ \text{median},\ Q_3,\ \max,

and the interquartile range IQR=Q3−Q1IQR = Q_3 - Q_1 is a robust spread measure that ignores the outer quarter of the data on each side. The box plot draws the box from Q1Q_1 to Q3Q_3, a line at the median, and whiskers out to the extremes (or to a fence at 1.5×IQR1.5 \times IQR, with more distant points drawn as outliers).

Sample or population?

The formulas differ only in the denominator, but using the wrong one changes the answer and, more importantly, signals a conceptual error. If the numbers are a sample drawn from a larger population and you want to estimate that population's variance, divide by n−1n-1. If they literally are the entire population, divide by nn. In machine learning, sample statistics almost always mean n−1n-1 (or a library default you should check).

Illustrative vs real

The widget uses eight clean, roughly symmetric measurements. Real datasets have missing values, repeated values, heavy skew and multiple modes, and no single number summarizes them. The box plot is also a simplification — it hides multimodality entirely, so always look at the actual distribution before trusting a summary.

Check yourself

Eduspheria wiki · Mathematics for AI, Statistics

0 / 5 answered

  1. 1What is the mean of 2, 4, 4, 4, 5, 5, 7, 9?
    Numeric answer
  2. 2For the population 2, 4, 4, 4, 5, 5, 7, 9, what is the population standard deviation?
    Numeric answer
  3. 3Which summary is most resistant to a single extreme outlier?
    Multiple choice
  4. 4What is the name of the spread measure Q3 − Q1?
    Short answer
  5. 5The sample variance divides the sum of squared deviations by n − 1.
    True / false

Where next: correlation — how two variables move together.