[Jprogramming] histogram in stats/base
Brian Schott
schott.brian at gmail.com
Sat Apr 10 12:29:39 UTC 2021
Like Devon, "I have noticed some oddities," and have described my
variations at the following link.
https://code.jsoftware.com/wiki/User:Brian_Schott/Histogram
Below using spacing to emphasize similarities and differences in 3
definitions, I have tried to restate the definitions so that a
non proportional font will clarify the distinctions.
histogram =: <: @ (#/.~) @ (i. @#@[ , I.)
histogram1=: <: @ (#/.~) @ (i.@>:@#@[ , I.)
histogram2=: <: @ (#/.~) @ (i.@>:@#@[ , Idotr)
Idotr =: |.@[ (#@[-I.) ]
It seems to me that *histogram1* adjusts for the issue mentioned
by Gilles, and *histogram2* further adjusts for the way statisticians
traditionally compute histograms with half closed intervals defined as
*[,)* instead of *(,]* .
Below the verbs are shown with Gilles' data. *histogram1* and
*histogram2* place the 0 in different intervals, but at least
*histogram1* counts all data.
_5 0 5 histogram _2 _7 0 3 9
1 2 1 0
_5 0 5 histogram1 _2 _7 0 3 9
1 2 1 1
_5 0 5 histogram2 _2 _7 0 3 9
1 1 2 1
Btw, the text in the link mentioned above needed to be revised
to handle subscripts. Can anyone fix it even further in this regard?
--
(B=)
More information about the Programming
mailing list