Descriptive Statistics: What a Summary Keeps and What It Discards

7 minute read

Published:

TL;DR: The mean uses every observation and is therefore hostage to any one of them; the median ignores magnitudes and survives outliers. Sample variance divides by \(n-1\) because the deviations are measured around \(\bar{x}\), which was itself fitted to the data and so sits closer to the points than the true mean does — the shortfall is exactly one \(\sigma^2\). Skewness, kurtosis and quantiles restore some of what the first two moments throw away, but Anscombe's quartet shows that no fixed set of summaries is safe: plot the data.

Centre, and how fragile it is

Take five request latencies, in milliseconds: 12, 15, 15, 18, 90.

StatisticValueWhat it uses
Mean \(\bar{x}\)30.0 msevery value, weighted equally
Median15 msonly the rank order
Mode15 msonly repeated values

The mean is 30 ms and no request took anywhere near 30 ms — one slow request dragged it above the fourth-fastest observation. Push that 90 to 900 and the median is still 15, while the mean climbs to 192.

The formal version is the breakdown point — the fraction of the sample an adversary must corrupt to send the statistic anywhere they like. For the mean it is \(1/n\), which tends to zero; for the median it is \(1/2\). Hence latency dashboards report medians and p99s, and a mean is the right choice only once you have convinced yourself the tail is not pathological.

Spread, and the \(n-1\)

Variance is the mean squared deviation from the centre. The population version divides by \(n\); the sample version divides by \(n-1\):

\[ s^2 = \frac{1}{n-1}\sum_{i=1}^{n}(x_i - \bar{x})^2, \qquad \bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i \]

For the latencies, \(\sum (x_i - 30)^2 = 324 + 225 + 225 + 144 + 3600 = 4518\). Dividing by \(n-1 = 4\) gives \(s^2 = 1129.5\) and \(s = 33.6\) ms; dividing by \(n = 5\) gives 903.6 and 30.1 ms. The gap is a factor of \(4/5\), and it is not a convention — it is a correction for a bias you can derive in three lines.

Start from an identity that holds for any constant \(\mu\):

\[ \sum_i (x_i - \mu)^2 \;=\; \sum_i (x_i - \bar{x})^2 \;+\; n(\bar{x} - \mu)^2 \]

The cross term vanishes because \(\sum_i (x_i - \bar{x}) = 0\) by construction. Now let \(\mu\) be the true mean and take expectations. Each \(x_i\) has variance \(\sigma^2\), so the left side has expectation \(n\sigma^2\). The sample mean has variance \(\sigma^2/n\), so the last term has expectation \(n \cdot \sigma^2/n = \sigma^2\). Rearranging:

\[ \mathbb{E}\!\left[\sum_i (x_i - \bar{x})^2\right] = n\sigma^2 - \sigma^2 = (n-1)\sigma^2 \]

Divide by \(n-1\) and the estimator is unbiased. The intuition behind the algebra: \(\bar{x}\) is the value that minimises the sum of squared deviations, so measuring spread around it always understates spread around the true mean. You spent one degree of freedom locating the centre, and the deficit it causes is exactly \(\sigma^2\) — one observation’s worth.

Interview trap — "why \(n-1\)?": the answer is not "because you lose a degree of freedom", stated as a slogan; that is the conclusion, not the reason. The reason is the identity above: deviations around the fitted \(\bar{x}\) are systematically too small, by an amount whose expectation is \(\sigma^2\). A follow-up that catches people: is the sample standard deviation \(s\) unbiased for \(\sigma\)? No. Square root is concave, so by Jensen's inequality \(\mathbb{E}[s] < \sigma\) even though \(\mathbb{E}[s^2] = \sigma^2\). Unbiasedness does not survive nonlinear transformation.

Shape: skewness and kurtosis

The third and fourth standardised moments describe asymmetry and tail weight. With \(m_k = \frac{1}{n}\sum_i (x_i - \bar{x})^k\):

\[ g_1 = \frac{m_3}{m_2^{3/2}} \quad \text{(skewness)}, \qquad b_2 = \frac{m_4}{m_2^{2}} \quad \text{(kurtosis)} \]

Skewness is signed: positive means the long tail is on the right, which is the usual shape for latencies, incomes and file sizes. Our five latencies give \(g_1 = 1.49\), firmly right-skewed, consistent with the mean sitting above the median. A Gaussian has \(g_1 = 0\) and \(b_2 = 3\), so “excess kurtosis” \(b_2 - 3\) is reported instead, and it measures tail weight — the propensity to produce outliers — not “peakedness”.

Both are badly behaved in small samples. The latency sample gives \(b_2 = 3.23\), which sounds unremarkable until you notice that for \(n = 5\) the sample kurtosis cannot exceed \(n - 2 + 1/(n-1) = 3.25\). It is pinned at its ceiling and carries almost no information. Treat third and fourth moments as unreliable below a few hundred observations.

Quantiles

The \(q\)-quantile is the value below which a fraction \(q\) of the data falls. Quantiles suit skewed distributions because they assume no distributional form and inherit the median’s robustness: the p99 latency answers “how bad is it for the unluckiest one percent”, which no combination of mean and standard deviation can. There is no single definition, though — packages implement several interpolation rules that disagree on small samples, so quote the convention when the numbers matter.

Anscombe’s quartet

Anscombe (1973) constructed four eleven-point datasets that agree on essentially every summary anyone computes: mean of \(x\) is 9, sample variance of \(x\) is 11, mean of \(y\) is 7.50, sample variance of \(y\) is 4.13, correlation is 0.816, and the least-squares fit is \(y = 3.00 + 0.50x\) in all four cases.

Anscombe's quartet: four datasets with identical summary statisticsFour scatter panels, each with eleven teal points and the same orange fitted line y equals 3 plus 0.5x. Set I is a diffuse linear cloud. Set II is a smooth downward-curving parabola that the straight line fits badly. Set III is an exact straight line of ten points with one far outlier above it, which is what tilts the fit. Set IV has ten points stacked vertically at x equals 8 and a single point at x equals 19, so that one point alone determines the slope. All four share mean x of 9, variance of x of 11, mean y of 7.50, variance of y of 4.13 and correlation 0.816. Set I Set II Set III Set IV identical means, variances, correlation (0.816) and fitted line y = 3.00 + 0.50x — four different stories
Notice Set IV: ten points share one x value, so the slope is decided entirely by the eleventh point. Delete it and the fit is undefined. No moment-based summary can reveal that, but two seconds of looking can.
Key Insight — summaries are projections: the mean and variance are the first two moments, and specifying moments is specifying a projection of the empirical distribution onto a low-dimensional space. Anscombe's construction simply picks four points in the fibre of that projection. This is the same reason a single accuracy number cannot distinguish a model that fails uniformly from one that fails on a subgroup — a scalar summary has a large pre-image, and the interesting variation lives inside it.

What to carry forward

These feed everything that follows: \(\bar{x}\) and \(s\) are the estimators analysed in estimators, bias and variance, \(s/\sqrt{n}\) is the standard error behind confidence intervals, and the failure of moment summaries on skewed data is why you reach for the bootstrap.

Recap

  • Breakdown point: mean \(1/n\), median \(1/2\). Report medians and high quantiles for anything with a tail.
  • \(n-1\) comes from \(\mathbb{E}\big[\sum_i (x_i-\bar{x})^2\big] = (n-1)\sigma^2\), because deviations are taken around the fitted \(\bar{x}\), not the true \(\mu\).
  • \(s^2\) is unbiased for \(\sigma^2\); \(s\) is not unbiased for \(\sigma\) — Jensen's inequality.
  • Excess kurtosis measures tail weight, not peakedness, and both it and skewness are unstable in small samples.
  • Anscombe's quartet: identical means, variances, correlation and regression line, four different datasets. Plot first.

References

  1. Anscombe, F. J. Graphs in Statistical Analysis. The American Statistician, 27(1), 17–21, 1973.
  2. Wasserman, L. All of Statistics: A Concise Course in Statistical Inference. Springer, 2004.
  3. Efron, B., & Hastie, T. Computer Age Statistical Inference. Cambridge University Press, 2016.