[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: patch proposal for hist
From: |
Julien Bect |
Subject: |
Re: patch proposal for hist |
Date: |
Thu, 22 Oct 2015 15:23:50 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 |
Le 22/10/2015 10:37, Lars Winterfeld a écrit :
I want to propose a patch that changes the default number of bins of the hist()
function.
Currently, the default choice is 10. This respects neither the number of data
points nor estimated properties of the distribution. Here, I propose the follow
Freedman-Diaconis' choice, see
https://en.wikipedia.org/wiki/Histogram#Number_of_bins_and_width . How to
calculate the "perfect number of bins" is matter of taste and depends on the
unknown distribution. Still, Freedman-Diaconis is a fairly good choice for
reasons explained in the above Wikipedia article. In any case, it is better than
"10".
Hello Lars,
Unfortunately, the default "10" must be preserved for compatibility with
the hist function in Matlab.
http://fr.mathworks.com/help/matlab/ref/hist.html
Anyway, note that it is now recommended in Matlab's documentation to use
the new function "histogram" (introduced in R2014b) instead of "hist".
This new function has a "BinMethod" option, which can be set to "fd" for
Freedman-Diaconis.
http://fr.mathworks.com/help/matlab/ref/histogram.html?searchHighlight=FreedmanDiaconis
Others will correct me if I'm wrong, but I don't think there is a
corresponding "histogram" function in Octave yet.
This would be a welcome contribution for sure ;-)
@++
Julien