nag_double_quantiles (g01amc) finds specified quantiles from a vector of unsorted data.
A quantile is a value which divides a frequency distribution such that there is a given proportion of data values below the quantile. For example, the median of a dataset is the quantile because half the values are less than or equal to it; and the quantile is the th percentile.
nag_double_quantiles (g01amc) uses a modified version of Singleton's ‘median-of-three’ Quicksort algorithm (
Singleton (1969)) to determine specified quantiles of a vector of real values. The input vector is partially sorted, as far as is required to compute desired quantiles; for a single quantile, this is much faster than sorting the entire vector. Where necessary, linear interpolation is also carried out to return the values of quantiles which lie between two data points.
Singleton R C (1969) An efficient algorithm for sorting with minimal storage: Algorithm 347 Comm. ACM 12 185–187
Not applicable.
Not applicable.
The average time taken by nag_double_quantiles (g01amc) is approximately proportional to . The worst case time is proportional to but this is extremely unlikely to occur.
This example computes a list of quantiles from an array of doubles and an array of point values.