As an adverb we can get the ascending and descending by applying either /: or \:
open 'stats/base/univariate' NB. in JQt will open the script rankCompete=: 1 :'u~ i. ]' On Thu, Mar 16, 2023 at 1:30 PM Ric Sherlock <tikk...@gmail.com> wrote: > There are number of adverbs in the stats/base script for getting different > types of rankings > > NB.*rankOrdinal a ordinal ranking ("0 1 2 3") of array y > > NB.*rankCompete a standard competition ranking ("0 0 2 3") of array y > > NB.*rankDense a dense ranking ("0 0 1 2") of array y > > NB.*rankFractional a fractional ranking ("0 1.5 1.5 3") of array y > > > \: rankCompete vec > > 6 0 3 0 4 2 5 6 > > On Thu, Mar 16, 2023 at 11:24 AM Devon McCormick <devon...@gmail.com> > wrote: > >> These are both way better than what I came up with. Thanks! >> >> On Wed, Mar 15, 2023 at 5:07 PM 'robert therriault' via Programming < >> programm...@jsoftware.com> wrote: >> >> > Nicely done Elijah! >> > >> > It has a pretty solution in tacit as well >> > >> > vec=. 49 275 93 275 92 99 91 49 >> > t=. i.~ \:~ >> > t vec >> > 6 0 3 0 4 2 5 6 >> > >> > Cheers, bob >> > >> > > On Mar 15, 2023, at 13:59, Elijah Stone <elro...@elronnd.net> wrote: >> > > >> > > One thing that comes to mind is (\:~vec) i.vec. >> > > >> > > On Wed, 15 Mar 2023, Devon McCormick wrote: >> > > >> > >> Hi, has anyone looked into how to generate a rank numbering where >> > duplicate >> > >> values get duplicate order numbers? >> > >> >> > >> For example, when we rank this vector descending, >> > >> \:vec=. 49 275 93 275 92 99 91 49 >> > >> 1 3 5 2 4 6 0 7 >> > >> we see that 1 3{vec and 0 7{vec are the same so I would like to end >> up >> > with >> > >> a rank numbering like this 6 0 3 0 4 2 5 6 so the ties for first and >> > last >> > >> place get the same value in the proper order where zero designates >> the >> > >> highest. >> > >> >> > >> I know I've done this before and I have a very clumsy way to achieve >> > this >> > >> but I'm wondering if there's a better one. >> > >> >> > >> Thanks, >> > >> >> > >> Devon >> > >> >> > >> -- >> > >> >> > >> Devon McCormick, CFA >> > >> >> > >> Quantitative Consultant >> > >> >> ---------------------------------------------------------------------- >> > >> For information about J forums see >> http://www.jsoftware.com/forums.htm >> > > ---------------------------------------------------------------------- >> > > For information about J forums see >> http://www.jsoftware.com/forums.htm >> > >> > ---------------------------------------------------------------------- >> > For information about J forums see http://www.jsoftware.com/forums.htm >> > >> >> >> -- >> >> Devon McCormick, CFA >> >> Quantitative Consultant >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm