5
$\begingroup$

There are different methods for choosing widths of bins for a histogram, like Freedman-Diaconis rule. In Mathematica, without choosing a specific method, with the command Histogram[data], we can produce a histogram for a set of data. My question is: How does Mathematica decide which method is better for a given data?

$\endgroup$
9
  • $\begingroup$ In the Details section of the help file, it says: "Histogram[data] by default plots a histogram with equal bin widths chosen to approximate an assumed underlying smooth distribution of the values $x_i$." It does not specify exactly how the smoothing is done though. You can specify the method if you want more control. $\endgroup$
    – bill s
    May 8 at 18:32
  • $\begingroup$ @bills Thanks for your feedback. I'm curious how Mathematica decides on this. For example, sometimes it chooses Scott's rule, and gives this impression that the sample is Gaussian; however, if one specify the method as Freedman-Diaconis, the histogram turns out to be very different. I'd like to know the logic behind Mathematica preference when one doesn't specify any methods. $\endgroup$
    – user79703
    May 8 at 18:38
  • 1
    $\begingroup$ Would you give an example where the "histogram is not even calculated according to any named methods in the Documentation" ? $\endgroup$
    – JimB
    May 9 at 1:26
  • 1
    $\begingroup$ Nevermind. I see that with a CauchyDistribution[0,1], there is frequently no match. $\endgroup$
    – JimB
    May 9 at 1:51
  • 3
    $\begingroup$ For whatever it's worth, I don't think one can figure this out empirically. The choice made seems dependent not only on the shape of the data but also on sample size. Having someone from Wolfram, Inc. confess is maybe the only possibility. $\endgroup$
    – JimB
    May 10 at 15:32

Your Answer

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