# histograms

A histogram is a graphical representation of the distribution of data. It is an estimate of the probability distribution of a continuous variable (quantitative variable) and was first introduced by Karl Pearson. To construct a histogram, the first step is to “bin” the range of values—that is, divide the entire range of values into a series of small intervals—and then count how many values fall into each interval. A rectangle is drawn with height proportional to the count and width equal to the bin size, so that rectangles abut each other. A histogram may also be normalized displaying relative frequencies. It then shows the proportion of cases that fall into each of several categories, with the sum of the heights equaling 1. The bins are usually specified as consecutive, non-overlapping intervals of a variable. The bins (intervals) must be adjacent, and usually equal size. The rectangles of a histogram are drawn so that they touch each other to indicate that the original variable is continuous. Histograms give a rough sense of the density of the data, and often for density estimation: estimating the probability density function of the underlying variable. The total area of a histogram used for probability density is always normalized to 1. If the length of the intervals on the x-axis are all 1, then a histogram is identical to a relative frequency plot. A histogram can be thought of as a simplistic kernel density estimation, which uses a kernel to smooth frequencies over the bins. This yields a smoother probability density function, which will in general more accurately reflect distribution of the underlying variable. The density estimate could be plotted as an alternative to the histogram, and is usually drawn as a curve rather than a set of boxes. A variable binwidth histogram was introduced by Denby and Mallows (2009). Examples of this are displayed on Census bureau data below. Another alternative is the average shifted histogram which is fast to compute, and gets a smooth curve estimate of the density without using kernels. The histogram is one of the seven basic tools of quality control. Histograms are often confused with bar charts. A histogram is used for continuous data, where the bins represent ranges of data, and the areas of the rectangles are meaningful, while a bar chart is a plot of categorical variables and the discontinuity should be indicated by having gaps between the rectangles, from which only the length is meaningful. Often this is neglected which may lead to a bar chart being confused for a histogram.