Border effect in TMath::Quantiles

While playing around with TMath::Quantiles function, we’ve noticed that some of the available computation methods give strange results.

The Quantiles function should be monotonically crescent, which is not the case for methods 4, 5, 6, 8 and 9. Looks like a bad conversion between first and last ranks and array indices.

In addition, method 3 does not seem to behave similarly in ROOT and in R (cf. R figure)

(performed using ROOT 5.18 and 5.20 on Linux)

ROOTquantiles.C (650 Bytes)

Lorenzo will process your mail once he will be back tomorrow


If it can help, here is a proposal for a new version of TMath::Quantiles. This one gives the same results as R.
quantiles.cxx (3.18 KB)