[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError

Steven D'Aprano report at bugs.python.org
Tue Dec 13 21:00:57 EST 2016


Steven D'Aprano added the comment:

On Tue, Dec 13, 2016 at 10:17:21AM +0000, Srikanth Anantharam wrote:
> 
> Srikanth Anantharam added the comment:
> 
> @steven:
> 
> data = [1, 2, 3, 4, 4, 4, 5, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9]
> is clearly unimodal with mode 8
> 
> data would have been bimodal if 4 repeated exactly the same (7) number of
> times as 8, like this:
> data = [1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 5, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9]

Bimodal distributions do not require both modes to be exactly the same 
height. And certainly when you have a sample from a bimodal 
distribution, you should not expect exactly the same frequency for the 
two modes. Just from random sampling error you will expect one or the 
other to have a larger frequency.

You shouldn't take my example too literally. With such a small sample of 
discrete values, it becomes a (hard) matter of personal judgement. The 
point I was attempting to make was that identifying sample modes outside 
of the simplest unimodal case is tricky and requires much thought.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28956>
_______________________________________


More information about the Python-bugs-list mailing list