double data = [22, 57, 73, 97, 113]; double median = quantile(0.5, data); // 73 auto q1 = [0.25, 0.5, 0.75].map!(p => p.quantile(data)); // 57, 73, 97 auto q2 = [0.25, 0.5, 0.75].map!(p => p.quantile(data), QuantileInterpolation.R8); //45.3333, 73, 102.333
Returns the quantile in a data vector for a cumulative probability.
Takes a data vector and a probability and returns the quantile cut point for the probability. The vector must be sorted and the probability in the range [0.0, 1.0]. The interpolation methods available are the same as in R and available in a number of statistical packages. See the R documentation or wikipedia for details (https://en.wikipedia.org/wiki/Quantile).