Re: [Jprogramming] histogram verb

2021-10-19 Thread 'Mike Day' via Programming
Sorting the result suggests this amendment to save one transpose: shist =:|:@(/:~@~.,.#/.~) Cheers, Mike Sent from my iPad > On 19 Oct 2021, at 13:00, Raul Miller wrote: > > ~. and #/.~ maintain the order of their argument. > > So this is one approach: > > hist=: ~. ,: #/.~ > n=:?100#

Re: [Jprogramming] histogram verb

2021-10-19 Thread Raul Miller
~. and #/.~ maintain the order of their argument. So this is one approach: hist=: ~. ,: #/.~ n=:?100#20 hist/:~ n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 6 2 4 4 7 3 9 3 6 7 4 1 4 8 3 9 3 10 5 You can also sort the result, of course: /:~&.|: hist n 0 1 2 3 4 5

Re: [Jprogramming] histogram verb

2021-10-19 Thread Jan-Pieter Jacobs
Hi Skip, I would do it as follows: hist1 =: bins ([,: _1 + #/.~@,) ] bins =: i.@:>:@(>./) this basically prepends the expected bins to the data, and subtracts one (_1 +) from the count. The definition of the bins might need to be adapted, based on your data; now it simply take 0 - highest elemen

[Jprogramming] histogram verb

2021-10-19 Thread Skip Cave
How can I modify the standard implicit histogram verb to produce sequential categories? hist =:~.,:#/.~ ]n=.?100#20 9 12 3 14 3 13 18 8 12 17 17 14 19 9 18 18 16 12 2 4 4 5 13 16 14 11 9 17 8 4 14 19 2 9 3 9 7 6 15 14 1 13 14 13 13 19 13 1 4 16 11 12 19 4 2 1 3 18 10 15 6 5 10 14 9 3 8 19 14 5 1

Re: [Jprogramming] histogram in stats/base

2021-05-20 Thread Gilles Kirouac
Perfect upgrade! histogram does not lead to lost data any more. _5 0 5 histogram _2 _7 0 3 9 1 1 2 1 Thanks, Ric, for all future users. ~ Gilles Le 2021-05-19 à 08:01, Raul Miller a écrit : Yes.. I should have been reading the updated code, rather than the commits. It's been too long sin

Re: [Jprogramming] histogram in stats/base

2021-05-19 Thread Raul Miller
Yes.. I should have been reading the updated code, rather than the commits. It's been too long since I did anything serious with github. Sorry about the noise. Thanks, -- Raul On Wed, May 19, 2021 at 6:12 AM Ric Sherlock wrote: > > Hi Raul, > The pull request is named "Update histogram to co

Re: [Jprogramming] histogram in stats/base

2021-05-19 Thread Ric Sherlock
Hi Raul, The pull request is named "Update histogram to correctly count items in last bin" and links to Issue #4 ( https://github.com/jsoftware/stats_base/issues/4) that was filed in the repository called "histogram doesn't count all the data". That mentions the problems to be addressed and also li

Re: [Jprogramming] histogram in stats/base

2021-05-19 Thread Raul Miller
Details would be nice in the commit message. "corrected" doesn't really explain the issue. But I guess that's just a suggestion for later. Looking at the implementation itself, I don't remember what situation the 'NB. The number of points in the last interval is undercounted by 1' is good for. I

Re: [Jprogramming] histogram in stats/base

2021-05-19 Thread Ric Sherlock
I've made some changes to stats/base in this Pull request https://github.com/jsoftware/stats_base/pull/5 Any suggestions/objections? Changes are basically: * the current version of histogram is replaced with histogram2 (also called histogramL) * histogram1 is added as histogramR * added Idotr

Re: [Jprogramming] histogram in stats/base

2021-04-14 Thread Brian Schott
Gilles, Both histogram1 and histogram2 can be plotted with the bar type, which I believe has colored bars. The problem being addressed mostly with the verb named 'relative' on the wiki page is the situation where the bins are of different width. In that case I could only find a line type drawing

Re: [Jprogramming] histogram in stats/base

2021-04-13 Thread Gilles Kirouac
Thanks to Brian and Ric for their major improvements and in particular for Brian's Histogram wiki page. I was neither asking nor hoping for so much. Both are interesting. I find specially useful the visual representation of the importance of each interval. If there was a way to paint interva

Re: [Jprogramming] histogram in stats/base

2021-04-10 Thread Ric Sherlock
Combining the Brian's ideas with the Rosetta code solution, I came up with this adverb which I quite like: Idotr=: |.@[ (#@[ - I.) ] binnedData=: {{ bidx=. i.@>:@# xNB. indicies of bins x (Idotr (u@}./.)&(bidx&,) ]) y NB. apply u to data in bins after dropping first val

Re: [Jprogramming] histogram in stats/base

2021-04-10 Thread Ric Sherlock
Good question Brian and interesting discussion. I agree that the key to the problem is to agree exactly what the desired behaviour of histogram should be. Mathematical/statistical convention seems to be that Intervals should be closed on the left and open on the right. This makes life a bit harder

Re: [Jprogramming] histogram in stats/base

2021-04-10 Thread Brian Schott
As you thought, Steve Jost kindly confirmed. I had never heard of the upper bin being treated differently. On Sat, Apr 10, 2021 at 1:59 PM Raul Miller wrote: > I give the english sentence precedence over the label for a specific > row in a table. > > For the example treated by that table, it doe

Re: [Jprogramming] histogram in stats/base

2021-04-10 Thread Raul Miller
I give the english sentence precedence over the label for a specific row in a table. For the example treated by that table, it does not change the numbers. That said, I suppose it would be worth talking with Steve Jost about this issue. He likely has references worth reading that lead him to writ

Re: [Jprogramming] histogram in stats/base

2021-04-10 Thread Brian Schott
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 9

Re: [Jprogramming] histogram in stats/base

2021-04-10 Thread Raul Miller
P.S. here's an implementation which satisfies that "Except for the last interval, each interval is closed on the left and open on the right." specification: histogramFixed=: #@[ {. <:@(#/.~)@(i.@#@[ , I.) Thanks, -- Raul On Sat, Apr 10, 2021 at 10:09 AM Raul Miller wrote: > > Here's how I mig

Re: [Jprogramming] histogram in stats/base

2021-04-10 Thread Raul Miller
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 tes

Re: [Jprogramming] histogram in stats/base

2021-04-10 Thread Brian Schott
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 prop

Re: [Jprogramming] histogram in stats/base

2021-04-09 Thread Devon McCormick
I have noticed some oddities here too but mostly have ignored them and adjusted my plots to compensate. I mostly use my own variant "plotHistoMulti" - here: https://code.jsoftware.com/wiki/User:Devon_McCormick/myStats - but have not yet nailed down exactly what is off with the underlying. On Sat,

[Jprogramming] histogram in stats/base

2021-04-09 Thread Gilles Kirouac
About the histogram verb in stats/base NB. The result is a list of counts of the number of data points in each interval. Intervals are specified by the left argument. histogram uses dyadic I. The I. primitive defines (1+#x) intervals. See its clear definition in Nuvoc. In short, it

Re: [Jprogramming] histogram from Essays

2017-06-15 Thread Raul Miller
I think the essay presumes your range was chosen to include all values in your range. Thanks, -- Raul On Thu, Jun 15, 2017 at 8:35 AM, Rudolf Sykora wrote: > On 15 June 2017 at 14:14, Brian Schott wrote: >> Rudolf, >> >> Have you seen the following comments which attempt to alter that Essay?

Re: [Jprogramming] histogram from Essays

2017-06-15 Thread Rudolf Sykora
On 15 June 2017 at 14:14, Brian Schott wrote: > Rudolf, > > Have you seen the following comments which attempt to alter that Essay? I haven't, I did not know about it. I will read it. Thanks! Anyhow, I still believe the original essay should be improved (if I am not completely wrong with my unde

Re: [Jprogramming] histogram from Essays

2017-06-15 Thread Brian Schott
Rudolf, Have you seen the following comments which attempt to alter that Essay? http://code.jsoftware.com/wiki/User:Brian_Schott/Histogram -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] histogram from Essays

2017-06-15 Thread 'Pascal Jasmin' via Programming
From: Rudolf Sykora To: programm...@jsoftware.com Sent: Thursday, June 15, 2017 7:50 AM Subject: [Jprogramming] histogram from Essays Hello, I found a code to produce a histogram at http://code.jsoftware.com/wiki/Essays/Histogram. However, both the description

[Jprogramming] histogram from Essays

2017-06-15 Thread Rudolf Sykora
Hello, I found a code to produce a histogram at http://code.jsoftware.com/wiki/Essays/Histogram. However, both the description and the function seem odd. The code reads histogram=: <: @ (#/.~) @ (i.@#@[ , I.) 1) They say: ---The left argument is a list of interval *start* points.---, which I t

Re: [Jprogramming] Histogram

2016-05-08 Thread Kip Murray
Slightly off topic is the stemplot described in Moore and McCabe, Introduction to the Practice of Statistics. Below you can see the data item 17 in row 1 and the data item 133 in row 13. data 17 133 151 47 12 19 52 80 32 87 24 14 20 90 9 47 72 7 36 64 stemplot data 0|7 9 1|2 4 7 9

Re: [Jprogramming] Histogram

2016-05-08 Thread Brian Schott
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 cha

Re: [Jprogramming] Histogram

2016-05-08 Thread dahn oak
Thank you, didn't know about interval index. Sun, 8 May 2016 19:27:32 +0800 bill lam : > It is called interval index (dyad I.), please see help > documentation for detail. > > 2.5 5 7.5 I. 1 3 3 3 4 7 7 8 8 9 > 0 1 1 1 1 2 2 3 3 3 > #/.~ 2.5 5 7.5 I. 1 3 3 3 4 7 7 8 8 9 > 1 4 2 3 > > >

Re: [Jprogramming] Histogram

2016-05-08 Thread Henry Rich
This suggests the verb 2.5 5 7.5 #/.~@:I. 1 3 3 3 4 7 7 8 8 9 1 4 2 3 but there is a problem: if an interval has no members, it doesn't show as 0, but instead is omitted: 0.5 2.5 5 7.5 #/.~@:I. 1 3 3 3 4 7 7 8 8 9 1 4 2 3 to make sure every interval has a corresponding count, use 0

Re: [Jprogramming] Histogram

2016-05-08 Thread bill lam
It is called interval index (dyad I.), please see help documentation for detail. 2.5 5 7.5 I. 1 3 3 3 4 7 7 8 8 9 0 1 1 1 1 2 2 3 3 3 #/.~ 2.5 5 7.5 I. 1 3 3 3 4 7 7 8 8 9 1 4 2 3 Вс, 08 май 2016, dahn oak написал(а): > Hello, I want to mimic this Mathematica code: > > BinCounts[x,

[Jprogramming] Histogram

2016-05-08 Thread dahn oak
Hello, I want to mimic this Mathematica code: BinCounts[x, {div}] It returns an array where i-th element is a count of elements in x that belongs to interval [div_i, div_i+1). I've succeeded, but want to know if my soulution is adequate enough in terms of J programming style. Here it is: