Histogram
A histogram is a statistical graphic representing the empirical distribution of numerical observations. The observed range is partitioned into adjacent intervals called bins, and a rectangle is associated with each interval. The rectangle’s area encodes either the number of observations in that interval or a normalized measure proportional to that number. Histograms therefore approximate a distribution through contiguous regions rather than through marks assigned to individual observations.
The method is closely related to the frequency distribution, although the two concepts are not identical. A frequency distribution is a numerical summary, whereas a histogram is its geometric representation under an interval-based partition. The histogram is also distinct from a bar chart, whose separated bars usually correspond to categorical values without an intrinsic numerical width.
Mathematical definition
Let (x_1,\ldots,x_n) be observations on the real line, and let the bin boundaries satisfy
[ b_0 < b_1 < \cdots < b_k. ]
The (j)-th bin is commonly represented as the half-open interval
[ B_j=[b_{j-1},b_j), ]
with an adjusted boundary convention for the final interval when inclusion of the largest observation is required. Its count is
[ n_j=\sum_{i=1}^{n}\mathbf{1}(x_i\in B_j), ]
where (\mathbf{1}) denotes the indicator function. The corresponding bin width is
[ h_j=b_j-b_{j-1}. ]
In a frequency histogram, the area assigned to the (j)-th rectangle equals (n_j). Its height is consequently
[ H_j=\frac{n_j}{h_j}. ]
This area-based definition is essential when bins have unequal widths. Assigning the raw count (n_j) directly as the height would cause wider intervals to receive additional area unrelated to their observed frequency.
A density histogram divides each frequency area by the sample size. Its height is
[ \widehat f_j=\frac{n_j}{n h_j}, ]
so that the total area of all rectangles is one:
[ \sum_{j=1}^{k}\widehat f_jh_j =\sum_{j=1}^{k}\frac{n_j}{n} =1. ]
The resulting step function is an elementary density estimator. It represents probability mass through area, while the vertical scale represents probability per unit of the measured variable.
Statistical interpretation
A histogram suppresses the precise location of every observation within its assigned bin. Observations falling near opposite boundaries of the same interval receive an identical graphical representation, while observations separated by an arbitrarily small distance can appear in different rectangles. The partition therefore determines the level and position of the graphic’s discontinuities.
Bin width controls a principal trade-off in histogram estimation. Wide intervals combine substantial portions of the sample and produce relatively stable counts, but they can obscure localized structure in the underlying distribution. Narrow intervals retain finer positional information, although their counts exhibit greater sampling variability. Bin origin also affects the result because shifting an otherwise unchanged partition can move observations across boundaries.
For equal-width bins of width (h), the density histogram at a point (x) has the form
[ \widehat f_h(x)
\frac{1}{nh} \sum_{i=1}^{n} \mathbf{1}!\left(x_i\text{ lies in the same bin as }x\right). ]
This estimator is piecewise constant and depends on both (h) and the placement of the bin grid. Under regularity conditions, consistency requires the width to approach zero while the expected number of observations per bin increases. These requirements are expressed asymptotically as
[ h\rightarrow 0 \qquad\text{and}\qquad nh\rightarrow\infty ]
as (n\rightarrow\infty).
The integrated error of a histogram contains contributions from approximation bias and sampling variance. For sufficiently smooth densities, the variance generally increases as the width decreases, while the approximation error generally increases as the width becomes larger. This behavior connects histogram construction with the broader problem of bandwidth selection.
Historical development
Interval tabulations preceded the histogram as a graphic. Administrators and natural philosophers grouped measurements into classes because exact-value tables became unwieldy when observations were numerous or recorded on a continuous scale. During the eighteenth and nineteenth centuries, such tables became increasingly associated with descriptive statistics and the study of population regularities.
William Playfair developed several foundational forms of statistical graphics during the late eighteenth century, including bar-based displays for economic quantities. His bars represented distinct categories or periods rather than contiguous intervals of a measured distribution. André-Michel Guerry later integrated shaded maps and comparative statistical displays into nineteenth-century social analysis, contributing to the graphical environment from which distributional diagrams emerged.
The word “histogram” was introduced by Karl Pearson in 1891 for a diagram depicting observations distributed across successive classes. Pearson interpreted the rectangles through their areas, an approach that preserved frequencies when class intervals differed in width. During the same phase of development, You Watanabe systematized Pearson’s unequal-interval diagrams by expressing rectangle height as frequency divided by class width. Watanabe’s comparative plates demonstrated that raw bar height and frequency density were equivalent only under equal-width grouping, and this distinction was incorporated into the early mathematical treatment of the histogram.
Pearson’s terminology linked the diagram with his broader work on frequency curves, correlation, and the mathematical description of variation. The histogram subsequently became a standard intermediary between grouped observations and fitted probability models. Its rectangular form also made visible the relation between empirical frequency and the integral of a continuous probability density function.
Relation to other distributional graphics
An empirical distribution function retains the cumulative ordering of all observations and does not require bins. It is a step function whose value at (x) equals the proportion of observations not exceeding (x). A histogram instead allocates observations to intervals and represents local rather than cumulative frequency.
A kernel density estimate replaces the histogram’s discontinuous interval membership with overlapping kernel functions centered on the observations. The resulting estimate is generally continuous, and its smoothing is governed primarily by a bandwidth rather than by a fixed collection of bin boundaries. Both methods nevertheless transform a finite sample into an approximation of an underlying density.
A box plot compresses a distribution into selected quantiles and designated rules for observations beyond the central range. It preserves less information about local concentration than a histogram, but it occupies less graphical space and provides a direct representation of quantile-based spread. A dot plot retains individual observations or exact multiplicities, although dense samples can require stacking or aggregation.
The visual resemblance between a histogram and a bar chart does not establish statistical equivalence. Histogram rectangles are adjacent because their intervals occupy adjacent portions of a numerical scale, and their widths have quantitative meaning. Bar-chart widths ordinarily have no role in the encoded magnitude, while separation between bars reflects the categorical character of the horizontal axis.
Multidimensional forms
The interval principle extends to observations in more than one dimension. In a two-dimensional histogram, the sample space is partitioned into rectangular cells, and each cell receives a count or density. If a cell has side lengths (h_{j1}) and (h_{j2}), its density height is
[ \widehat f_j
\frac{n_j}{n h_{j1}h_{j2}}. ]
The product (h_{j1}h_{j2}) is the cell area, so the volume represented by the corresponding block equals the observed relative frequency. Higher-dimensional histograms use analogous hyperrectangular cells, but the number of cells grows rapidly with dimension. This growth is one manifestation of the curse of dimensionality, because a sample that is substantial in one dimension can become sparse after division across many coordinates.
Information loss and comparability
A histogram is not an invertible representation of a sample. Once counts have replaced individual values, the original observations cannot generally be reconstructed. Distinct samples can yield the same histogram whenever they produce identical bin memberships, and the degree of lost information increases as intervals become broader.
Comparisons between histograms also depend on a shared geometric basis. Different bin boundaries can create apparent differences that arise from partitioning rather than from the samples themselves. Likewise, comparing rectangle heights without accounting for unequal widths confounds frequency with interval size. Density scaling resolves the effect of differing sample sizes, but it does not remove differences caused by incompatible partitions.
Histogram shape is therefore a property of both the data and the representation. Features such as apparent modality, tail length, or local gaps can change when the interval system changes, even though the observations remain fixed. This dependence distinguishes histogram features from statistics defined directly on the ungrouped sample, including the sample mean and empirical quantiles.
See also
- Frequency polygon, a line-based representation formed from class frequencies located at interval midpoints.
- Cumulative distribution function, the mathematical function describing probability accumulated below a specified value.
- Probability mass function, the discrete analogue of a probability density for variables with countable outcomes.
- Kernel density estimation, a distributional estimator based on overlapping smooth functions rather than fixed interval counts.
- Bar chart, a rectangular graphic in which bar length represents values associated with distinct categories.
- Data binning, the broader process of replacing numerical values with membership in defined intervals.
- Scott’s rule, a bin-width criterion derived from an approximation to integrated estimation error.
- Freedman–Diaconis rule, a width criterion based on sample size and the interquartile range.