Quant Memo
Foundational

Histograms and Binning Choices

Why the number and width of bins chosen for a histogram can make the same data look smooth or ragged, unimodal or multimodal — and simple rules for picking bin width sensibly.

Prerequisites: Kernel Density Estimation

A histogram estimates the shape of a distribution by chopping the data's range into intervals ("bins") and counting how many observations fall in each. The problem is that the number of bins is a free choice, and the same underlying data can look completely different depending on it: too few, wide bins smooth away real structure like a second cluster of returns; too many, narrow bins turn a smooth distribution into a jagged, noisy-looking mess driven by random sampling variation rather than any real feature of the data.

There is no single correct bin count, but there are reasonable defaults. Sturges' rule suggests roughly 1+log2n1 + \log_2 n bins for nn observations, which works well for smallish, roughly normal-looking datasets but tends to under-bin (oversmooth) larger ones. The Freedman–Diaconis rule instead sets bin width using the interquartile range, width=2×IQR×n1/3\text{width} = 2 \times \text{IQR} \times n^{-1/3}, which adapts to the data's actual spread and is more robust to outliers than rules based on the standard deviation. For 1,000 daily returns with an IQR of 1.2%, Freedman–Diaconis gives a width of roughly 2×1.2×10001/30.242 \times 1.2 \times 1000^{-1/3} \approx 0.24 percentage points — narrow enough to show detail without being dominated by sampling noise.

In quant work, binning choices matter most when eyeballing return distributions for fat tails or skew before fitting a model: an oversmoothed histogram can hide the very tail risk you're checking for, while an under-smoothed one can manufacture the illusion of a bimodal distribution that isn't really there.

A histogram's shape is partly a choice, not just a fact about the data — always try more than one bin width before drawing conclusions from its shape.

Related concepts

Practice in interviews

Further reading

  • Scott, Multivariate Density Estimation, ch. 3
ShareTwitterLinkedIn