FREQUENCIES: Fixed crash showing histograms of limited range.
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 26 Apr 2014 05:33:08 +0000 (07:33 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 26 Apr 2014 05:33:08 +0000 (07:33 +0200)
commit8e98d2ec1b1620280d66820e323d82b00975374e
tree5cd7362ac5c65e3decad901526671e3c58a1c44f
parent171bd1341565bf922cd3361e564d3d02b18c9547
FREQUENCIES: Fixed crash showing histograms of limited range.

We had been using Freedman-Diaconis rule to select the bin width.
According to the literature this is better than Sturges rule.
However it cannot work when the interquartile range is zero, which
will happen for datasets with small range.

This change uses the Freedman-Diaconis rule and falls back to
Sturges when the IQR is zero.
src/language/stats/frequencies.c
tests/language/stats/frequencies.at