Raul,

Notice that at your link the uppermost interval is
specified differently in paragraphs (1.) and (2.).
In the former, [80,100]; latter, [80,100) . So,
which does it mean?

Also, notice the results below.

   20*i. 6
0 20 40 60 80 100
   (20*i. 6) histogram 5  39  75  79  85  90  91  93  93  98
0 1 1 0 2 6
   (20*i. 6) histogram1 5  39  75  79  85  90  91  93  93  98
0 1 1 0 2 6 0
   (20*i. 6) histogram2 5  39  75  79  85  90  91  93  93  98
0 1 1 0 2 6 0
   (20*i. 5) histogram 5  39  75  79  85  90  91  93  93  98
0 1 1 0 2 5
   (20*i. 5) histogram1 5  39  75  79  85  90  91  93  93  98
0 1 1 0 2 6
   (20*i. 5) histogram2 5  39  75  79  85  90  91  93  93  98
0 1 1 0 2 6

On the other hand, your suggestion does produce a
slightly better result, in the sense that both bracket definitions
produce the same histograms before labeling.

   histogramR=: (}.~0-0={:)@:<:@(#/.~)@(i.@>:@#@[ , I.)
   (20*i. 6) histogramR 5  39  75  79  85  90  91  93  93  98
0 1 1 0 2 6
   (20*i. 5) histogramR 5  39  75  79  85  90  91  93  93  98
0 1 1 0 2 6


On Sat, Apr 10, 2021 at 10:10 AM Raul Miller <[email protected]> wrote:

> Here's how I might fix histogram based on Gile's suggestions:
>
> histogram=: (}.~0-0={:)@:<:@(#/.~)@(i.@>:@#@[ , I.)
>
> This is a brute force approach: add an extra tally bucket and discard
> it if it's empty.
>
> But I think that this is not the correct approach. It seems to me that
> there ought to be a test case which illustrates why it is wrong.
>
> Anyways, probably the right place to start is with a clear
> specification of how histogram is supposed to work. And, I am inclined
> to adopt this one:
>
> https://condor.depaul.edu/sjost/it223/documents/histograms.htm
>
> Thoughts?
>
> Thanks,
>
> --
> Raul
>
> --
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to