Quantiles Methods not working
Rovel opened this issue · 6 comments
Hi,
I'm trying to apply different quantile methods to match a report made in another lib used by Re-Dash but it seem as I change the quantiles the graph value does not change.
Example Code:
https://codepen.io/Rovel/pen/RwwdzbG
Reference Issue:
getredash/redash#4428
- you have to change the quantiles method in the "xAxes" since you have a horizontal box plot
- even if you change it to e.g.
fivenum
in my test the results don't change even with the different method.
@sgratzl yes I tried this too, xAxes and try actually all available quantiles methods and nothing changes, not sure if is a thing in the horizontal Box, but with numpy and other command line libs the value change, so I must infer that is something in the horizontal box and quantiles methods in this lib, can you confirm that the quantiles methods are working in the horizontal box plot?
Thanks
can you give a dataset in which you can see different results and also the code (e.g python,...) how to compute the various formats? The different methods that are currently implemented show an effect especially on dataset with an even number of elements since they essentially have different methods to combine two values for q1, q3, median, ...
Hi,
See if this is is enought info, 11 numbers, evaluationg only q3 but from here we can test the others too...
Here follows a dataset and a example running with python 3.8.1 with the numpy lib:
- Dataset is the same I used in the Codepen Reference:
x = [3.375, 3.75, 3.875, 3, 3, 3.5, 3.125, 3, 2.625, 3.375, 3]
- Output:
- Numpy Reference:
https://docs.scipy.org/doc/numpy/reference/generated/numpy.percentile.html - Output in text:
>>> import numpy as np
>>> x = [3.375, 3.75, 3.875, 3, 3, 3.5, 3.125, 3, 2.625, 3.375, 3]
>>> np.percentile(x, 75, interpolation='linear')
3.4375
>>> np.percentile(x, 75, interpolation='higher')
3.5
>>> np.percentile(x, 75, interpolation='lower')
3.375
>>> np.percentile(x, 75, interpolation='nearest')
3.5
>>> np.percentile(x, 75, interpolation='midpoint')
3.4375
I see, there seem to be numerous versions how to compute the value in case you have to interpolate it.
So far this library implements two methods taken from R
- type-7 method https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/quantile
- the 'hinges' as used in https://www.rdocumentation.org/packages/grDevices/versions/3.6.2/topics/boxplot.stats.
The latter was added to be the same as when using the R boxplot
function.
However, I can take a look to also implement the other methods. A PR is also welcome
sure I will try to help with a PR or something, but since JS is not my strong suit it will probably need a good review 😃