I have a question that is very important to me related to the book Basic Statistics for Business and Economics for organizing data into a frequency distribution:

Step 1: Decide on the number of classes. The goal is to use just enough groupings or classes to reveal the shape of the distribution. Some judgment is needed here. A useful recipe to determine the number of classes ($k$) is the "2 to the $k$ rule". This guide suggests you select the smallest number ($k$) for the number of classes such that $2^k$ is greater than the number of observations ($n$): [$n \le 2^k$​]

I want to know, how can I prove this formula?

  • 1
    $\begingroup$ Welcome to the site. You can't prove this formula. It's a guideline. It can be wrong or right, and whether you need more or less classes than it suggests is (at least in part) a matter of opinion. $\endgroup$ – Peter Flom Sep 27 '13 at 11:57
  • $\begingroup$ so from where comes this formula? $\endgroup$ – masumeh Sep 27 '13 at 12:04
  • $\begingroup$ I am not sure where that specific formula comes from, but probably someone who had run a lot of histograms thought that it generally gave good results. $\endgroup$ – Peter Flom Sep 27 '13 at 12:18
  • $\begingroup$ see here: robjhyndman.com/papers/sturges.pdf $\endgroup$ – Glen_b Sep 30 '13 at 12:52


There is no hard rule when it comes to determining the number of classes for frequencies. As far as I can find, this kind of formulas was introduced as earlier as 1926 by Sturges (PDF), who actually suggested a slightly different formula, but you can see the justification being used and perhaps get a sense of the approaches in arguing for a certain formula. Scott in 1979 provided another algorithm (URL), which uses some amount of justification.

Both of these pieces are reference article of the nclass() statement in R, and I would assume they are somewhat representative. I have never seen $n \le 2^k$, but it does look like a derivative of Struges' work.

Also, most books have a page showing the corresponding author's e-mail. If you couldn't find the citation in the bibliography, you may consider sending him/her an e-mail.

Lastly, in Scott's article, I found one thing that he emphasized very insightful:

The optimal choice for $h_n$ [aka number of classes] requires knowledge of the true underlying density $f$. This knowledge is rare.

At the end of the day, it's still your understanding of the data that rules the binning process. Any formula you may encounter on this matter is probably only able to give you a starting point.

  • $\begingroup$ I know, this formula is just a starting point. But my teacher asked us to prove it, or to say from where this formula comes! $\endgroup$ – masumeh Sep 27 '13 at 12:28
  • $\begingroup$ @masumeh In that case, I guess contacting the author is the best bet. If I were to advise a student, spend no more than 30 minutes to do an intensive Internet/literature search on this; when looking at the whole syllabus, this is really trivial. Do you best, and tell him/her what other answers you found. Also, there are some more potential links on this thread. After you've learned the answer, you're welcome to answer your own question; it's allowed here. $\endgroup$ – Penguin_Knight Sep 27 '13 at 12:46

It must have something to do with the fact that n is approximately the cardinality of the power set of a set of k elements, it must somehow minimize variance within classes and maximize variance between classes under some relatively weak regularity assumptions, but I am not able to formalize it.


Sturges formula is not from a clear-cut theorem to be proved. It is something like an opinion to fix the number of classes once you are unable to deduce it from data/study.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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