Loading AI tools
Statistical rule of thumb From Wikipedia, the free encyclopedia
Sturges's rule[1] is a method to choose the number of bins for a histogram. Given observations, Sturges's rule suggests using
bins in the histogram. This rule is widely employed in data analysis software including Python[2] and R, where it is the default bin selection method.[3]
Sturges's rule comes from the binomial distribution which is used as a discrete approximation to the normal distribution.[4] If the function to be approximated is binomially distributed then
where is the number of trials and is the probability of success and . Choosing gives
In this form we can consider as the normalisation factor and Sturges's rule is saying that the sample should result in a histogram with bin counts given by the binomial coefficients. Since the total sample size is fixed to we must have
using the well-known formula for sums of the binomial coefficients. Solving this by taking logs of both sides gives and finally using (due to counting the 0 outcomes) gives Sturges's rule. In general Sturges's rule does not give an integer answer so the result is rounded up.
Doane[5] proposed modifying Sturges's formula to add extra bins when the data is skewed. Using the method of moments estimator
along with its variance
Doane proposed adding extra bins giving Doane's formula
For symmetric distributions this is equivalent to Sturges's rule. For asymmetric distributions a number of additional bins will be used.
Sturges's rule is not based on any sort of optimisation procedure, like the Freedman–Diaconis rule or Scott's rule. It is simply posited based on the approximation of a normal curve by a binomial distribution. Hyndman has pointed out[6] that any multiple of the binomial coefficients would also converge to a normal distribution, so any number of bins could be obtained following the derivation above. Scott[4] shows that Sturges's rule in general produces oversmoothed histograms i.e. too many bins, and advises against its use in favour of other rules such as Freedman-Diaconis or Scott's rule.
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.