Yo, posting it for the whole internet, took the whole day to find / to design the actual working solution for weighted percentile 'nearest rank' algorithm, almost no reliable info online and a lot of library-style/textbook-style solutions that don't provide on real world production level.
3) say we wanna find 50th percentile, get a threshold value: n = 50 thres = weights_sum / 100 * n 7.5 = 15 / 100 * 50
4) iterate through weights_cum until you find a value that >= the threshold: for i = 0 to size - 1 2 >= 7.5 ? nah 7 >= 7.5 ? nah 10 >= 7.5 ? aye
5) take the iteration index that resulted "aye", and find the data value with the same index, that's gonna be the resulting percentile. i = 2 data = 33
This one is not an approximation, not an estimator, it's the actual weighted percentile nearest rank as it is.
I tested the thing extensively and it works perfectly. For the skeptics, check lines 40, 41, 69 in the code, you can comment/uncomment dem to switch for unit (1) weights, resulting in the usual non-weighted percentile nearest rank that ideally matches the TV's built-in function.
Shoutout for @wallneradam for the sorting function mane ... Live Long and Prosper
@gorx1, Woooow, that went completely over my head. Figured it was some tech jargon/short-hand. That puts a few of the missing pieces of the puzzle back into play, but also leads me to one last question (which poses no other purpose than to settle my genuinely curious nature). OBVIOUSLY you were granted the beautiful gift of being able to understand, speak, and apply math as anyone would a first language yet my contradiction radar is goin crazy over here. Reading multiple descriptions to your publications vs decoding the actual code would have me conclude that they were constructed by different people entirely. So my question is, which came first, the thug life...or the love math life? Bc those are 2 seemingly contradictory lives that generally dont intermingle and very interested to know. (only if your comfortable with it). btw..how you speak about math is awe inspiring (gives me the same feeling I get when I used to get another @alexgrover script to read about and to bear to witness a deep level of understanding and love of math that I could ever HOPE to learn (even 1% of it would be MULTIPLE levels higher than where I currently am with it). When some mofos just get it the language GIFTED to you with a cute little bow and all), Just picking with the level of innate math nerd thats built into you BC I WOULD LOVE THAT. Hope no offense is taken. - ChasinAlts
gorx1
⋅
@chasinalts, everything in the Universe is alike, and you been exposed to these uniform principles for years. So mane, chances are you've already learnt everything you'll possibly need many years ago, now you just need to open your mind, realize it & start using dem the same principles everywhere you'll ever desire. Everything else are details.