Menu

#4732 histogram incorrectly normalized when frequency = density

None
closed
nobody
5
4 days ago
6 days ago
No

histogram (and histogram_description) incorrectly normalizes the bar heights when the option frequency = density is supplied and the bins are not all the same width; the wider bins are too tall. E.g.:

xx: makelist (i, i, 1000) $
histogram (xx, nclasses = setify (makelist (k*100, k, 0, 10)), frequency = density);

shows all bins the same height. So far, so good -- bins are all same width so bug isn't triggered.

histogram (xx, nclasses = { 0, 100, 1000 }, frequency = density);

shows the bug -- the bars should be the same height, since the density is exactly uniform, but the wider bin is taller.

Looks like histogram (and histogram_description) needs to normalize by bin width.

Discussion

  • Robert Dodier

    Robert Dodier - 4 days ago
    • status: open --> closed
     
  • Robert Dodier

    Robert Dodier - 4 days ago

    Fixed by commit [ 328c0e8 ].

     

Log in to post a comment.

MongoDB Logo MongoDB