The Histogram

Click the Run button below when the applet has completed loading.

This applet illustrates the histogram. A histogram is a density estimate and the applet allows the user to select one of several populations from which to generate samples. Once a sample is generated, the user may use the slider bar to select the number of intervals (the smoothing parameter) for estimating the histogram. The true density is overlaid for comparison.

There are three techniques for automatically selecting the number of intervals m for use with the histogram. These correspond to the Freeman-Diaconis, Sturges, and Scott methods. In the following formulae, let

  x        = the sample
  n        = the sample size
  m        = the number of intervals to construct the histogram
  LN(x)    = the natural log of x
  IQR(x)   = the interquartile range of the sample
  RANGE(x) = the range of the sample
  CEIL(r)  = the smallest integer not less than r
  SDEV(x)  = the standard deviation of the sample
The Freeman-Diaconis method:
            h = IQR(x) * n^(-1/3)
            r = RANGE(x) / h
            m = CEIL(r)
The Sturges method:
            r = LN(n)/LN(2) + 1.0 
            m = CEIL(r)
The Scott method:
            h = 3.5 * SDEV(x) * n^(-1/3)
            r = RANGE(x) / h
            m = CEIL(r)