Quantile function Julia vs Matlab

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.


  • Set alpha=beta=0.5 as Matlab uses type 5 quantile definition.

    Note though other software (like R or Python) use the same defaults as Julia (alpha=1 and beta=1).