Histogram

Statistics & Probability

A histogram is a bar graph that displays the distribution of numerical data by grouping values into intervals called bins.

Visualization

Definition

A histogram is a special bar chart that shows how often values fall into different ranges, with the bars touching each other because the ranges are connected with no gaps. It displays the distribution of continuous or grouped numerical data: equal-width intervals (bins) are marked on the horizontal axis, and bar height (or area) represents frequency or relative frequency. Formally, a histogram with bins of equal width $h$ estimates the probability density as $\hat{f}(x) = n_i/(nh)$ for $x$ in bin $i$, where $n_i$ is the bin count and $n$ is total sample size; the optimal bandwidth $h^*$ minimizes the asymptotic mean integrated squared error (AMISE): $h^* = \left(\dfrac{24\sqrt{\pi}}{n \int f''(x)^2\,dx}\right)^{1/5}$.

Example

A histogram of student heights might group them: $50$-$54$ in ($3$ students), $55$-$59$ in ($7$ students), $60$-$64$ in ($10$ students), $65$-$69$ in ($5$ students), with the tallest bar in the $60$-$64$ range. Exam scores for $50$ students binned in intervals of $10$ can reveal a normal distribution or a skew depending on which bin is tallest. For a standard normal distribution, the AMISE-optimal bin width for $n = 100$ is approximately $0.53$; the Freedman-Diaconis rule $h = 2 \cdot \text{IQR} \cdot n^{-1/3}$ is a robust alternative.

Key Insight

Unlike a regular bar graph for categories, a histogram shows numbers grouped into ranges, and its shape reveals whether data clusters in the middle, at one end, or is spread evenly: symmetric (bell-shaped), left-skewed, right-skewed, bimodal, or uniform. Kernel density estimation (KDE) can be seen as a smoothed histogram, replacing each bin by a smooth kernel function centered at each data point, addressing the sensitivity of histograms to bin placement.