[WIP] Add Quantile Calculation#11
Conversation
|
Awesome, thanks for doing this |
|
I'm having a little trouble parsing the R docs you linked me to, when they say and is |
|
I'm not sure whether what I sent you was the most up-to-date version. This It seems that it's all written out in mathematical notation instead of in
|
|
Ok, so I got the first three, which were simple enough. But, I could use some more help with the other methods, as neither the R docs nor the linked scholarly paper define what I also tried to look at the R source for |
|
The original paper those methods come from: https://www.amherst.edu/media/view/129116/original/Sample+Quantiles.pdf |
|
Yeah, I looked at that too, but they don't define it either. It sort of just shows up in paragraph five with no explanation. |
|
To be honest, I'm finding it confusing too... |
|
I would recommend testing some simple |
|
x[k] is the order statistic. That means if you have some data, then x[5] is the 5th smallest number. Assume you have some data, 5, 3, 10, 0, 4, x[1] = 0, x[2] = 3, x[3] = 4, then that means that for type 7 (the default) p[1] = 0 / 4, p[2] = 1 / 4, etc. That means that to get the quantile, you would say that the 25% quantile matches up with k=2, which is 3. To get something like 20% quantile, you do 20% * 0 + (1-20%) * 3 = 2.4, and to get the 40% quantile you do 40% * 3 + (1-40%) * 4 = 3.6 |
|
Sorry, I no longer have the time to do this. This is a good start for someone else to pick up, so I hope it eventually gets in. |
This is a work in progress PR to add quantile calculations to dstats that is born out of dlang/phobos#3592. This is very simplistic ATM and will go through many revisions.
Still need to be implemented: