Sie sind auf Seite 1von 2

Houston Seminar in Statistics Applied to Petroleum Geology

Formulating in Excel the bin-width of a


histogram According to the FreedmanDiaconis rule

Sergio Perez Rodriguez


EG, PDG, MSc
November 2016

The selection of an adequate bin-width to construct the histogram of a dataset is a vital step to get a
sound approximation to key features of the distribution that best match the dataset.
With a number n of data points, the classic square root choice the number of bins k that can be
assigned directly or can be calculated from a suggested bin width h as:

( ) ( )

This simple rule based on the square root can be upgraded using the Sturges formula or the Scotts
normal reference rule. The latter is especially suitable for data of normal distributions. However, when
outliers menace to disrupt the normality of the distribution, the histograms made with bin-widths based
on the Freedman-Diaconis rule are the option of choice. In this case the formula relies on the
interquartile range of the data points (IQR):
=2

( )
1

3
The expression in the cell C2 of the following spreadsheet provides the formula of the FreedmanDiaconis rule:

Das könnte Ihnen auch gefallen