Quantile

Uses your system voice; voice and rate in settings.

Snapshot

≈ 11 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

, with quantiles, , , and , are shown. The area below the red curve is the same in the intervals , , , and . In statistics and probability, quantiles are cut points dividing the range of a probability distribution into continuous intervals with equal probabilities or dividing the observations in a sample in the same way. Common quantiles have special names, such as quartiles (four groups), deciles (ten groups), and percentiles (100 groups).

The groups created are termed halves, thirds, quarters, etc., though more often the terms for the quantile are used for the groups created, rather than for the cut points. -quantiles are values that partition a finite set of values into subsets of (nearly) equal sizes. There are subsets of the -quantiles, one for each integer satisfying . In some cases the value of a quantile may not be uniquely determined, as can be the case for the median (2-quantile) of a uniform probability distribution on a set of even size.

Quantiles can also be applied to continuous distributions, providing a way to generalize rank statistics to continuous variables (see percentile rank). When the cumulative distribution function of a random variable is known, the -quantiles are the application of the quantile function (the inverse function of the cumulative distribution function) to the values .

, with quantiles, , , and , are shown. The area below the red curve is the same in the intervals , , , and . In statistics and probability, quantiles are cut points dividing the range of a probability distribution into continuous intervals with equal probabilities or dividing the observations in a sample in the same way. Common quantiles have special names, such as quartiles (four groups), deciles (ten groups), and percentiles (100 groups).

The groups created are termed halves, thirds, quarters, etc., though more often the terms for the quantile are used for the groups created, rather than for the cut points. -quantiles are values that partition a finite set of values into subsets of (nearly) equal sizes. There are subsets of the -quantiles, one for each integer satisfying . In some cases the value of a quantile may not be uniquely determined, as can be the case for the median (2-quantile) of a uniform probability distribution on a set of even size.

Quantiles can also be applied to continuous distributions, providing a way to generalize rank statistics to continuous variables (see percentile rank).

When the cumulative distribution function of a random variable is known, the -quantiles are the application of the quantile function (the inverse function of the cumulative distribution function) to the values . \mu - \sigma\cdot\sqrt{\frac{1-p}{p}} \le Q(p) \le \mu + \sigma\cdot\sqrt{\frac{p}{1-p}}\,, where is the value of the -quantile for (or equivalently is the -th -quantile for ), where is the distribution's arithmetic mean, and where is the distribution's standard deviation.

In particular, the median is never more than one standard deviation from the mean. The above formula can be used to bound the value in terms of quantiles. When , the value that is standard deviations above the mean has a lower bound \mu + z \sigma \ge Q\left(\frac{z^2}{1+z^2}\right)\,,\mathrm{~for~} z \ge 0. For example, the value that is standard deviation above the mean is always greater than or equal to , the median, and the value that is standard deviations above the mean is always greater than or equal to , the fourth quintile.

When , there is instead an upper bound \mu + z \sigma \le Q\left(\frac{1}{1+z^2}\right)\,,\mathrm{~for~} z \le 0. For example, the value for will never exceed , the first decile.

Estimating quantiles from a sample

One problem which frequently arises is estimating a quantile of a (very large or infinite) population based on a finite sample of size . Modern statistical packages rely on a number of techniques to estimate the quantiles. Hyndman and Fan compiled a taxonomy of nine algorithms used by various software packages. All methods compute , the estimate for the -quantile (the -th -quantile, where ) from a sample of size by computing a real valued index . When is an integer, the -th smallest of the values, , is the quantile estimate.

Otherwise a rounding or interpolation scheme is used to compute the quantile estimate from , , and . (For notation, see floor and ceiling functions). The first three are piecewise constant, changing abruptly at each data point, while the last six use linear interpolation between data points, and differ only in how the index used to choose the point along the piecewise linear interpolation curve, is chosen. Mathematica, Matlab, R and GNU Octave programming languages support all nine sample quantile methods.

SAS includes five sample quantile methods, SciPy and Maple both include eight, EViews and Julia include the six piecewise linear functions, Stata includes two, Python includes two, and Microsoft Excel includes two. Mathematica, SciPy and Julia support arbitrary parameters for methods which allow for other, non-standard, methods. The Google Guava Java library provides the type 7 scheme in the Quantiles class. The estimate types and interpolation schemes used include: Notes: R‑1 through R‑3 are piecewise constant, with discontinuities.

R‑4 and following are piecewise linear, without discontinuities, but differ in how is computed. R‑3 and R‑4 are not symmetric in that they do not give when . Excel's PERCENTILE.EXC and Python's default "exclusive" method are equivalent to R‑6. Excel's PERCENTILE and PERCENTILE.INC and Python's optional "inclusive" method are equivalent to R‑7. This is R's and Julia's default method. Packages differ in how they estimate quantiles beyond the lowest and highest values in the sample, i.e. and .

Choices include returning an error value, computing linear extrapolation, or assuming a constant value. Of the techniques, Hyndman and Fan recommend R-8, but most statistical software packages have chosen R-6 or R-7 as the default. The standard error of a quantile estimate can in general be estimated via the bootstrap. The Maritz–Jarrett method can also be used.

The asymptotic distribution of the sample median

The sample median is the most examined one amongst quantiles, being an alternative to estimate a location parameter, when the expected value of the distribution does not exist, and hence the sample mean is not a meaningful estimator of a population characteristic. Moreover, the sample median is a more robust estimator than the sample mean.

One peculiarity of the sample median is its asymptotic distribution: when the sample comes from a continuous distribution, then the sample median has the anticipated Normal asymptotic distribution, \text{Sample median m} \sim \mathcal{N}\left(\mu=m, \sigma^2=\frac{1}{4Nf(m)^2}\right) This extends to the other quantiles, \text{Sample quantile p} \sim \mathcal{N}\left(\mu=x_p, \sigma^2=\frac{p( 1 - p )}{Nf(x_p)^2}\right) where is the value of the distribution density at the -th population quantile ( x_p=F^{-1}(p) ).

But when the distribution is discrete, then the distribution of the sample median and the other quantiles fails to be Normal (see examples in https://stats.stackexchange.com/a/86638/28746).

A solution to this problem is to use an alternative definition of sample quantiles through the concept of the "mid-distribution" function, which is defined as F_\text{mid}(x) = P(X\le x) - \frac 12P(X=x) The definition of sample quantiles through the concept of mid-distribution function can be seen as a generalization that can cover as special cases the continuous distributions. For discrete distributions the sample median as defined through this concept has an asymptotically Normal distribution, see Ma, Y., Genton, M. G., & Parzen, E. (2011).

Asymptotic properties of sample quantiles of discrete distributions. Annals of the Institute of Statistical Mathematics, 63(2), 227–243.

Approximate quantiles from a stream

Computing approximate quantiles from data arriving from a stream can be done efficiently using compressed data structures. The most popular methods are t-digest and KLL. These methods read a stream of values in a continuous fashion and can, at any time, be queried about the approximate value of a specified quantile. Both algorithms are based on a similar idea: compressing the stream of values by summarizing identical or similar values with a weight.

If the stream is made of a repetition of 100 times v1 and 100 times v2, there is no reason to keep a sorted list of 200 elements, it is enough to keep two elements and two counts to be able to recover the quantiles. With more values, these algorithms maintain a trade-off between the number of unique values stored and the precision of the resulting quantiles. Some values may be discarded from the stream and contribute to the weight of a nearby value without changing the quantile results too much.

The t-digest maintains a data structure of bounded size using an approach motivated by k-means clustering to group similar values. The KLL algorithm uses a more sophisticated "compactor" method that leads to better control of the error bounds at the cost of requiring an unbounded size if errors must be bounded relative to . Both methods belong to the family of data sketches that are subsets of Streaming Algorithms with useful properties: t-digest or KLL sketches can be combined.

Computing the sketch for a very large vector of values can be split into trivially parallel processes where sketches are computed for partitions of the vector in parallel and merged later. The algorithms described so far directly approximate the empirical quantiles without any particular assumptions on the data, in essence the data are simply numbers or more generally, a set of items that can be ordered. These algorithms are computer science derived methods.

Another class of algorithms exist which assume that the data are realizations of a random process. These are statistics derived methods, sequential nonparametric estimation algorithms in particular. There are a number of such algorithms such as those based on stochastic approximation or Hermite series estimators. These statistics based algorithms typically have constant update time and space complexity, but have different error bound guarantees compared to computer science type methods and make more assumptions.

The statistics based algorithms do present certain advantages however, particularly in the non-stationary streaming setting i.e. time-varying data. The algorithms of both classes, along with some respective advantages and disadvantages have been recently surveyed. 4-quantiles are quartiles (Q); the difference between upper and lower quartiles is also called the interquartile range, midspread or middle fifty (IQR = ). 5-quantiles are quintiles or pentiles (QU). 6-quantiles are sextiles (S). 7-quantiles are septiles (SP). 8-quantiles are octiles (O).

10-quantiles are deciles (D). 12-quantiles are duo-deciles or dodeciles (DD). 16-quantiles are hexadeciles (H). 20-quantiles are ventiles, vigintiles, or demi-deciles (V). 100-quantiles are percentiles or centiles (P). 1000-quantiles have been called permilles and milliles, but these terms are rare and largely obsolete.

See also

Flashsort – sort by first bucketing by quantile Interquartile range Descriptive statistics Expectile – related to expectations in a way analogous to that in which quantiles are related to medians Quartile Q–Q plot Quantile function Quantile normalization Quantile regression Quantization Summary statistics Tolerance interval ("confidence intervals for the pth quantile" )

References

Text derived from https://en.wikipedia.org/w/index.php?oldid=1373589100 under CC BY-SA 4.0; modifications have been made.

Sources cited in this revision

18 named source(s) extracted from the cited revision. A source with no author is shown by its publication; nothing is invented.