7
$\begingroup$

Suppose that when making a histogram, one encounters a datum at a bin boundary. Is there a convention on how to round it? For example, suppose my data are integer percentages, running from 0% to 100%. I want to make a histogram with boundaries at 10%, 20%, etc. Of course I could label the histogram in a way to avoid the issue, e.g. by labeling the categories 0-9, 10-19, etc. But suppose I don't want to label them like that. I could save space on the x axis by simply labeling the bin boundaries of 10, 20, 30, etc. But then if I encounter a datum at 20, is there a convention as to whether it goes into the 10-20 bin or the 20-30 bin?

$\endgroup$

3 Answers 3

8
$\begingroup$

I don't believe there is any convention (see summary of statistical packages below.)

For considering the distribution of a set of data (e.g. examining rough normality of residuals in a linear regression with a histogram), this decision is somewhat arbitrary (but will potentially change the shape of the figure, depending on how many observations fall on the breakpoints and the size of the dataset).

Different computer packages handle values on the breakpoints in different ways by default. If you're wanting to present your histogram in e.g. a paper/thesis, then it would of course be helpful to describe which type of interval you are using.

To look at interval terminology (see Wikipedia for more consideration of this, or this StackOverflow question for an R specific example):

The first example you give would be described as left closed, right open intervals, where the first bin is $0 \leq x < 10$; second bin is $10 \leq x < 20$; etc. So 10 would go in the second bin.

The second example are right closed, left open intervals, where the first bin is $0 < x \leq 10$; second bin is $10 < x \leq 20$; etc. And here 10 would go in the first bin.

By default, R plots histograms with right closed, left open intervals (see the right=TRUE option for this function); SAS defaults to left-closed, right open (see rtinclude option on that page). I think Stata does left-closed, right open intervals too.

I have a preference for left closed, right open intervals as I find these histograms more intuitive to read/explain. But for data exploration I'd usually just go with the defaults in my package (nowadays, R).

QUICK EDIT AFTER POSTING: I'll just add, apropos of your labelling point, that standard practice is to just label the boundaries/breaks in the x-axis (0, 10, 20, etc.), rather than both interval ends (0-9, 10-19 etc.) with the latter having the disadvantage that it is more cluttered, and ambiguous what happens to a 9.5, or a 9.9999 (and so forth.)

$\endgroup$
1
  • $\begingroup$ Generally, spreadsheets use right-closed intervals, while scientific software uses left-closed intervals (except for the last, which is usually closed). In this sense, R's default behavior is an exception, but R provides an option to change it. $\endgroup$
    – Alan
    Feb 2, 2016 at 18:18
5
$\begingroup$

Pretty late to the party here, but I think that there is a convention. The convention seems to be that lower (left) bounds are included in a class. [1-3]

Specifically answering your example question - the value of 20 should go into the 20-30 bin.

However, as observed by James already - the convention isn't always observed (notably the Excel data analysis histogram tool which works opposite by including upper bounds instead of lower bounds). I've also found references that describe both (left or right inclusion) as conventions [4] and at least one reference that says to specify which you are using [5] implying that either is acceptable (as long as the audience knows which you have used).

Note: I was specifically looking for conventions exactly because I'm trying to determine how important it is to modify Excel histograms to match the convention when I found this question. I did find a lot of other links by googling histogram conventions.

References:

  1. Analyzing Data and Making Decisions, Statistics for Business. Judith Skuce, Pearson, 2013.
  2. http://www.oswego.edu/~srp/stats/hist_con.htm
  3. http://www.math.ntua.gr/~fouskakis/SS/graphical%20summaries.pdf
  4. http://www.stat.berkeley.edu/~stark/SticiGui/Text/gloss.htm#e
  5. http://sites.stat.psu.edu/~ajw13/stat500/notes/lesson01/lesson01_03.html
$\endgroup$
4
$\begingroup$

While there's no particularly broad convention, to me it would make some sense to follow the convention used for right-continuous CDFs, and so in general make histograms include their left boundary but not their right, so the $i$-th interval is $[l_i,l_{i+1})$. This at least seems to be done slightly more commonly, but I have no solid evidence to support that impression.

$\endgroup$
2
  • 3
    $\begingroup$ Except that when you have data in e.g. $[0:1]$, you end up having an extra bin, containing $[1;1]$ only, as $1$ will not be included in the previous bins range. $\endgroup$ Mar 7, 2013 at 10:36
  • $\begingroup$ @Anony-Mousse If the data are in $[0,1]$ where there are non-trivial numbers actually at the endpoints, then the data isn't continuous (it's either discrete or mixed) and so plainly a rule for a histogram designed for continuous data is not likely to be a good choice. I'm not advocating against common sense -- it's a suggested convention in the case of nominally continuous data, not a rule to be followed in all circumstances to the detriment of understanding. +1 $\endgroup$
    – Glen_b
    Mar 7, 2013 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.