quantileSorted
quantileSorted(
x,p):number
Defined in: src/quantile_sorted.js:17
This is the internal implementation of quantiles: when you know that the order is sorted, you don’t need to re-sort it, and the computations are faster.
This implements the linear interpolation method (type=7 in R/numpy), which is the default in numpy.percentile and R’s quantile.
Parameters
Section titled “Parameters”number[]
sample of one or more data points
number
desired quantile: a number between 0 to 1, inclusive
Returns
Section titled “Returns”number
quantile value
Throws
Section titled “Throws”if p ix outside of the range from 0 to 1
Throws
Section titled “Throws”if x is empty
Example
Section titled “Example”quantileSorted([3, 6, 7, 8, 8, 9, 10, 13, 15, 16, 20], 0.5); // => 9