Descriptive Statistics: What a Summary Keeps and What It Discards
Published:
Centre, and how fragile it is
Take five request latencies, in milliseconds: 12, 15, 15, 18, 90.
| Statistic | Value | What it uses |
|---|---|---|
| Mean \(\bar{x}\) | 30.0 ms | every value, weighted equally |
| Median | 15 ms | only the rank order |
| Mode | 15 ms | only 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\):
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\):
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:
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.
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\):
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.
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
- Anscombe, F. J. Graphs in Statistical Analysis. The American Statistician, 27(1), 17–21, 1973.
- Wasserman, L. All of Statistics: A Concise Course in Statistical Inference. Springer, 2004.
- Efron, B., & Hastie, T. Computer Age Statistical Inference. Cambridge University Press, 2016.
