Can the name of the MODE function be changed? (Statistics) - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not remotely HP Calculators (/forum-9.html) +--- Thread: Can the name of the MODE function be changed? (Statistics) (/thread-9393.html) |
Can the name of the MODE function be changed? (Statistics) - StephenG1CMZ - 10-29-2017 09:02 PM I was trying to look up some way of finding the .mode of a list: Statistically, the most common item(s) in the list. I found 16 pages of threads about Home mode, CAS mode, Exam mode, and many Interesting threads that I might re-read, but not a single thread about MODE. Perhaps the HP Prime cannot calculate MODE - or perhaps the absence of any threads about it means everyone else uses it without problems, despite not being in ToolboxMath/Lists. It would help if the function could be called something's else in the documentation ("statistical-mode" perhaps), to simplify searching. Similarly, pdf usually refers to document files, not density functions. And while I am complaining, most computer languages use INT to refer to integers, not integration. (If you are wondering why I don't search the pdf - on Android the phone dims after a couple of pages, and when I restart it, the phone has forgotten that it was searching, which gets VERY tedious). RE: Can the name of the MODE function be changed? (Statistics) - rprosperi - 10-29-2017 11:41 PM If this question is about the Prime, suggest you request a mod move it to the Prime sub-Forum, you'll get more (and better informed) opinions there. RE: Can the name of the MODE function be changed? (Statistics) - StephenG1CMZ - 10-30-2017 07:36 AM Making MODE easier to search for in documentation by calling it statistical--mode applies everywhere. As for not finding it on the Prime, I have now written my own. RE: Can the name of the MODE function be changed? (Statistics) - Didier Lachieze - 10-30-2017 10:30 PM Here is how I would do a statistical mode function, I don't know how different from yours it is : Code: EXPORT ModeList(L) EDITED for a few simplifications. RE: Can the name of the MODE function be changed? (Statistics) - StephenG1CMZ - 10-31-2017 11:39 PM Wow. It's amazing what a couple of lines can accomplish when you are familiar with HP Prime built-in functions. However, I think there is a bug: {1,2} yields {1,2,0} rather than the expected {1,2}. Your version doesn't handle {"red","green","red} - but then it is likely much faster as well as more concise. My own version is mainly written in the style of a C or Pascal program trawling through the lists, with very limited use of built-in functions such as union (thanks for your #21 solution). As such it is likely slower, but perhaps more portable. It is included in my new list processing API http://www.hpmuseum.org/forum/thread-9411.html But I could extract the relevant procedures here if you like. RE: Can the name of the MODE function be changed? (Statistics) - Didier Lachieze - 11-01-2017 07:09 AM (10-31-2017 11:39 PM)StephenG1CMZ Wrote: However, I think there is a bug: Ah, I've been too aggressive in the simplifications. Here is an updated version that should work better including for non numeric lists, but it's less concise... Code: EXPORT ModeList(L) RE: Can the name of the MODE function be changed? (Statistics) - StephenG1CMZ - 11-01-2017 11:11 AM As I expected, your implementation is much faster than mine. About half to two-thirds of my runtime given a list with no duplicates (RANDOM reals), and much faster with duplicates (RANDINT integers). |