Roger Hui and I have both studied histograms and you can find my discussion
at the following link where the following verbs are defined.

http://code.jsoftware.com/wiki/User:Brian_Schott/Histogram

To make a long story shorter, my result differs from yours and Roger's when
the sample value of 4 changes to a 5, for example. The session below
attempts to show that with the verb histogram2 which uses the verb Idotr in
place of the primitive verb I. The very last answer differs from its
comparisons and I believe follows common statistical definitions of
histogram.

   histogram =: <: @ (#/.~) @ (i.   @#@[ , I.)
   histogram1=: <: @ (#/.~) @ (i.@>:@#@[ , I.)
   histogram2=: <: @ (#/.~) @ (i.@>:@#@[ , Idotr)
   Idotr =: |.@[ (#@[-I.) ]
   1 3 3 3 4 7 7 8 8 9 histogram ~ 0 2.5 5 7.5 _
0 1 4 2 3
   1 3 3 3 4 7 7 8 8 9 histogram1 ~ 0 2.5 5 7.5 _
0 1 4 2 3 0
   1 3 3 3 4 7 7 8 8 9 histogram2 ~ 0 2.5 5 7.5 _
0 1 4 2 3 0
   1 3 3 3 5 7 7 8 8 9 histogram ~ 0 2.5 5 7.5 _
0 1 4 2 3
   1 3 3 3 5 7 7 8 8 9 histogram1 ~ 0 2.5 5 7.5 _
0 1 4 2 3 0
   1 3 3 3 5 7 7 8 8 9 histogram2 ~ 0 2.5 5 7.5 _
0 1 3 3 3 0



-- 
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to