Order Statistics¶

The $$k$$-th order statistic of a sample is equal to its $$k$$-th smallest value. The $$k$$-th order statistic of a set of $$n$$ values $$x = \left\{ x_i \right\}, 1 \le i \le n$$ is denoted $$x_{(k)}$$. The median of the set $$x$$ is equal to $$x_{\left( \frac{n}{2} \right)}$$ if $$n$$ is odd, or the average of $$x_{\left( \frac{n}{2} \right)}$$ and $$x_{\left( \frac{n}{2} + 1 \right)}$$ if $$n$$ is even. The $$k$$-th smallest element of a length $$n$$ vector can be found in average $$O(n)$$ time using the quickselect algorithm.

gsl_stats_select(data, f)

This function finds the k-th smallest element of the input array data.