Tutorials › Introduction to Statistics › Choosing Histogram Bin Widths

Graphs for Quantitative Data · Tutorial 126 of 996

Choosing Histogram Bin Widths

Choose a practical histogram bin width, check that the intervals cover the data, and recognize how the choice can affect the distribution’s visible detail.

Beginner 8 min read

What You'll Learn

  • Define bin width and distinguish it from the number of bins.
  • Choose a width using the variable’s units, range, and the purpose of the display.
  • Calculate how many equal-width bins cover a nonempty data set from a chosen starting boundary.
  • Check endpoint conventions when the maximum lies on a bin boundary.
  • Explain why a width that is too small or too large can obscure useful features.
  • Recognize that different starting boundaries can group the same values differently.

Why Bin Width Is a Choice

A histogram groups quantitative observations into adjacent intervals and displays how many values fall in each interval. Before constructing one, a useful decision is the width of those intervals. The choice matters: intervals that are very narrow can make random variation look like a complicated pattern, while very wide intervals can hide distinctions among groups of observations.

There is rarely one uniquely correct width. A sensible choice depends on the measurement units, the spread of the observations, and the amount of detail needed to answer the question. The goal is not to make the display look smooth or dramatic; it is to make the distribution readable without discarding meaningful structure.

Definition: A bin is an interval of values used to group observations in a histogram. The bin width is the length of that interval, measured in the same units as the quantitative variable. In an equal-width histogram, every bin has the same width. The number of bins is how many intervals are used; it is not the same thing as bin width.

For example, if exam times are measured in minutes, a width of 5 means each interval spans 5 minutes. It does not mean that the histogram has five bins. The width should be interpreted in the variable’s actual units: a width of 5 seconds and a width of 5 minutes represent very different groupings.

A Practical Way to Choose a Width

Start by identifying the variable’s units and the approximate range of the observed values. Then consider a few practical widths that are easy to explain in those units. The width should be large enough to avoid an unnecessarily jagged display, but small enough to retain features relevant to the question.

It is often helpful to choose a convenient starting boundary as well as a width. For exam times in minutes, for instance, boundaries at multiples of 5 or 10 minutes may be easier to interpret than boundaries at awkward decimal values. A convenient boundary is a choice of where the intervals begin; it does not change the width. The starting boundary can affect which observations are grouped together, so it should be stated clearly.

There is no fixed width that is best for every data set. A first choice can be checked by asking whether the resulting number of bins seems manageable and whether the bins correspond to useful distinctions in context. If the display would have an unwieldy number of intervals, consider a larger width. If nearly all observations would be lumped into just a few broad intervals, consider a smaller width.

Worked Example: Choosing a Width for Exam Times

Suppose a hypothetical class records the following exam completion times, in minutes: 38, 41, 43, 47, 49, 52, 55, 57, 61, and 64. Compare widths of 5 minutes and 10 minutes, using 35 minutes as the starting boundary.

With a 5-minute width, the span from 35 to 65 minutes contains \( (65-35)/5=6 \) equal intervals. The observations range across these intervals in relatively fine groups.

With a 10-minute width, the same span contains \( (65-35)/10=3 \) equal intervals. This is a coarser grouping: nearby times are more likely to be combined in the same interval, and fewer interval counts will be shown.

Both widths cover all ten observations, since the greatest time is 64 minutes and the chosen span ends at 65. If the aim is to distinguish clusters of completion times separated by only a few minutes, 5 minutes may be more informative. If a broad overview is enough, 10 minutes may be clearer. The data and the question—not a universal rule—guide the choice.

Checking How Many Bins Are Needed

After choosing a width, check that the equal-width intervals reach at least as far as the largest observation. Let \(L\) be the first left boundary, let \(x_{\max}\) be the maximum observation, and let \(w>0\) be the proposed width. Assume the data set is nonempty and \(L\leq x_{\min}\), where \(x_{\min}\) is the minimum observation. When the last bin includes its right endpoint, the number of bins required is

$$ K=\max\left\{1,\left\lceil\frac{x_{\max}-L}{w}\right\rceil\right\}. $$

Here, \(\lceil a\rceil\) means the smallest integer greater than or equal to \(a\). The maximum with 1 ensures there is at least one bin, including when all observations equal the starting boundary. With this endpoint convention, the bins have width \(w\), and the last bin includes its right boundary so an observation exactly on that boundary is covered.

The reasoning is direct. A sequence of \(K\) bins of width \(w\), starting at \(L\), reaches the boundary \(L+Kw\). To reach or pass \(x_{\max}\), it must satisfy \(L+Kw\geq x_{\max}\), or \(K\geq(x_{\max}-L)/w\). The smallest integer meeting that inequality is the ceiling of the ratio. If the ratio is zero, however, that ceiling is zero, even though a nonempty data set still needs one interval. Taking the maximum with 1 handles that case.

Worked Example: Finding the Required Number of Bins

A hypothetical set of laboratory processing times ranges from 12 to 52 minutes. Use \(L=10\) minutes as the first boundary and try a width of \(w=10\) minutes. How many bins are required to reach the maximum?

The data are nonempty, \(10\leq12\), and \(w=10>0\). Substitute \(x_{\max}=52\), \(L=10\), and \(w=10\):

$$ K=\max\left\{1,\left\lceil\frac{52-10}{10}\right\rceil\right\} =\max\{1,\lceil4.2\rceil\}=5. $$

Five bins span \(5(10)=50\) minutes from the first boundary, reaching 60 minutes. Four bins would reach only \(10+4(10)=50\) minutes, which does not cover the maximum of 52 minutes. Thus five bins are needed with this starting boundary and width. The units cancel in the ratio, so \(K\) is a count of intervals, not a time.

Boundary Choices and Special Cases

The width alone does not completely determine the grouping. For example, width 10 could use boundaries beginning at 0, 5, or 10. Those choices place the dividing lines in different locations, so some observations can end up in different bins even though the width is unchanged. Choose and report a starting boundary that is convenient and covers the data; do not assume that a stated width automatically determines the intervals.

Endpoint conventions matter when an observation falls exactly on a boundary. A common convention is to include the left endpoint of each bin and exclude the right endpoint, except that the final bin also includes its right endpoint. This assigns each observation to exactly one bin and ensures that a maximum on the final boundary is included. State or follow a consistent convention rather than leaving boundary cases ambiguous.

Worked Example: When All Observations Are Equal

Suppose a hypothetical data set consists of four recorded values, all equal to 20 seconds. Choose \(L=20\) seconds and propose a width of \(w=5\) seconds. How many bins are needed to include the observations?

Here \(x_{\max}=20\), so the ratio is zero:

$$ \frac{x_{\max}-L}{w}=\frac{20-20}{5}=0. $$

Using the nonempty-data formula gives \(K=\max\{1,\lceil0\rceil\}=1\). One bin is sufficient: it begins at 20 seconds and extends to 25 seconds, including its starting value. The calculation illustrates why the lower bound of one bin is necessary. A formula using only the ceiling of the ratio would incorrectly return zero in this case.

How Width Influences What Is Visible

A smaller width separates values into more, narrower intervals. This can reveal local concentrations or gaps that a coarser grouping would combine. But very narrow bins may contain only a few observations each, making the display sensitive to small changes in the data or to the placement of the boundaries. That can make incidental variation look important.

A larger width combines more values in each interval and generally reduces the number of displayed counts. This can give a simpler overview, but it may conceal separate concentrations or gaps. For example, if two nearby groups fall into the same wide interval, the bin count alone cannot show that they are distinct.

These are consequences to consider when choosing a width, not guarantees about what a particular data set will look like. A useful practice is to compare a small number of reasonable widths and ask whether the main features being investigated remain visible. Avoid selecting a width only because it produces a preferred appearance.

Key takeaway: Choose a width that makes sense in the variable’s units, gives a readable level of detail, and—together with a stated starting boundary—covers the full range. A width is a design choice, so check that the conclusions suggested by the display are not artifacts of an arbitrary grouping.

Common Mistakes

  • Confusing width with the number of bins. A width of 5 minutes describes the length of each interval; it does not mean there are five intervals.
  • Choosing a width without checking coverage. Even a convenient width may leave the maximum beyond the final boundary. Calculate how many bins are required from the chosen starting point.
  • Ignoring the starting boundary. The same width can place dividing lines differently when the first boundary changes. State the boundary as well as the width.
  • Using a formula that returns zero bins for a constant data set. For nonempty data, at least one interval is needed. Use \(K=\max\{1,\lceil(x_{\max}-L)/w\rceil\}\) when \(L\leq x_{\min}\) and \(w>0\), with the stated endpoint convention.
  • Treating one width as objectively correct. Widths involve a trade-off between detail and simplicity. Explain why a choice is useful for the question rather than presenting it as the only valid option.

Check Your Understanding

Try these questions without looking back.

  1. Exam times are measured in minutes. Explain what a bin width of 8 minutes means and why it does not imply that there are eight bins.
  2. A nonempty data set has maximum value \(x_{\max}=47\), starting boundary \(L=7\), and proposed width \(w=10\). Use the formula to find the number of bins required.
  3. Why can two histograms with the same bin width group some observations differently?
  4. What is one possible disadvantage of choosing a very small bin width? What is one possible disadvantage of choosing a very large width?
  5. All observations equal the chosen starting boundary \(L\). Explain why at least one bin is required and calculate \(K\) using the formula.