I just recently came accross that there is different defition of quantile() in Julia and Matlab. I was unable to align the two definitions and always get different result.
Does anybody know why is this a case and how to align their definitions?
I tried the following:
A = [0.5377, 1.8339 , -2.2588 , 0.8622 , 0.3188, -1.3077, -0.4336];
Q = quantile(A,0.3);
which results in Q = -0.7832. When I write the same in Julia Statistics library:
A = [0.5377, 1.8339 , -2.2588 , 0.8622 , 0.3188, -1.3077, -0.4336];
Q1 = quantile(A,0.3);
Q2 = quantile(A,0.3,sorted=true);
which results in Q1=-0.60842 and Q2 = -1.44026. I also tried playing with alpha and beta parameters but it is super tedious and I have no way of knowing if my chosen paramerters hold on the whole range.
sorted=true
but pass an unsorted array, you can’t expect a correct result, so you need to ignore that one. The other difference is just the different interpretation of the concepts. There are many choices to be made. For example, the MATLAB docs extensively describe what the computation is: mathworks.com/help/matlab/ref/quantile.html#btf91zm – Arrackalpha
andbeta
parameters in Julia you can replicate what MATLAB does? docs.julialang.org/en/v1/stdlib/Statistics/#Statistics.quantile Otherwise you’d have to implement it yourself. – Arrack