Quantile function

A quantile function is a generalized inverse of a cumulative distribution function. It maps a cumulative probability level to a value of the associated random variable, thereby describing a probability distribution in terms of ordered probability mass rather than accumulated mass below a specified value. For continuous and strictly increasing distributions, it coincides with the ordinary inverse of the cumulative distribution function. For discrete, mixed, or otherwise non-invertible distributions, it remains well defined through a generalized-inverse convention.

Quantile functions provide the mathematical basis for percentiles, quartiles, the median, and related measures of statistical position. They also support inverse-transform sampling, one-dimensional optimal transport, and distributional models in which parameters are attached directly to probability levels.

Definition

Let (X) be a real-valued random variable with cumulative distribution function

[ F_X(x)=\Pr(X\leq x). ]

The lower quantile function of (X) is

[ Q_X(p)=\inf{x\in\mathbb{R}:F_X(x)\geq p}, \qquad 0<p<1. ]

The same definition applies directly to a probability distribution without reference to a particular random variable. The use of the infimum is essential when (F_X) contains jumps or intervals on which it is constant.

At the endpoints, an extended-real convention is frequently used:

[ Q_X(0)=\inf{x:F_X(x)>0}, \qquad Q_X(1)=\sup{x:F_X(x)<1}. ]

These values describe the lower and upper endpoints of the distribution's support and may equal (-\infty) or (+\infty). Endpoint conventions vary in computational systems because a finite sample does not determine population tail behavior beyond its smallest and largest observations.

For every (x\in\mathbb{R}) and (p\in(0,1)), the generalized inverse satisfies

[ Q_X(p)\leq x \quad\Longleftrightarrow\quad p\leq F_X(x). ]

It follows that

[ F_X(Q_X(p))\geq p, ]

although equality need not hold when the distribution assigns positive probability to individual points. The quantile function is nondecreasing and left-continuous on ((0,1)) under the lower-quantile convention.

Relation to quantiles

A value (q) is a (p)-quantile of (X) when

[ \Pr(X<q)\leq p\leq\Pr(X\leq q). ]

A distribution may have several values satisfying this condition. The generalized inverse (Q_X(p)) selects the smallest such value. Consequently, a quantile and the value of a specified quantile function are not always interchangeable concepts unless the convention has been stated.

The median is represented by (Q_X(1/2)) under the lower convention. The first and third quartiles are represented by (Q_X(1/4)) and (Q_X(3/4)), respectively. A percentile uses the same construction after expressing its percentage as a probability in the unit interval.

For a continuous distribution with a strictly increasing cumulative distribution function,

[ Q_X(p)=F_X^{-1}(p), ]

and therefore

[ F_X(Q_X(p))=p. ]

Continuity alone does not imply strict increase. A continuous distribution can assign zero probability to an interval, producing a constant segment in its cumulative distribution function and a corresponding jump in its quantile function.

Discrete and mixed distributions

For a discrete probability distribution, the cumulative distribution function is a step function. Its quantile function is also a step function, with probability levels mapped to the support point at which the relevant cumulative threshold is first reached.

For example, if (X) has a Bernoulli distribution with

[ \Pr(X=1)=\theta \quad\text{and}\quad \Pr(X=0)=1-\theta, ]

then

[ Q_X(p)= \begin{cases} 0, & 0<p\leq 1-\theta,\ 1, & 1-\theta<p<1. \end{cases} ]

At (p=1-\theta), both values between (0) and (1) satisfy the general quantile inequalities, but the lower quantile function returns (0).

A mixed distribution may contain point masses together with a continuous component. Its quantile function then combines constant portions, which represent atoms of probability, with increasing portions derived from the continuous component. Gaps in the support appear as jumps of the quantile function rather than as constant portions.

Distributional representation

If (U) has the continuous uniform distribution on ((0,1)), then

[ Q_X(U)\sim X. ]

This identity is the basis of inverse transform sampling. It also shows that every real-valued probability distribution can be represented as a nondecreasing transformation of a uniform random variable.

More generally, if (g) is measurable and the relevant integral exists, then

[ \operatorname{E}[g(X)]

\int_0^1 g(Q_X(u)),du. ]

In particular, an integrable random variable satisfies

[ \operatorname{E}[X]

\int_0^1 Q_X(u),du. ]

This representation separates the distribution into equal increments of probability. Divergent positive and negative parts prevent the unrestricted use of the latter identity, just as they prevent the ordinary expectation from being defined.

For distributions on the real line, quantile functions also express the (r)-Wasserstein distance. When the required moments are finite,

[ W_r^r(\mu,\nu)

\int_0^1 \left|Q_\mu(u)-Q_\nu(u)\right|^r,du. ]

The formula results from pairing equal cumulative probability levels. In one dimension, this monotone coupling minimizes the expected transportation cost associated with the power (r).

Transformation properties

If (Y=aX+b) with (a>0), then

[ Q_Y(p)=aQ_X(p)+b. ]

A negative scale reverses the order of observations and requires an upper-quantile convention or an appropriate one-sided limit at (1-p). The distinction matters at atoms because the lower and upper generalized inverses can select different endpoints.

If (g) is continuous and strictly increasing, then

[ Q_{g(X)}(p)=g(Q_X(p)). ]

This equivariance explains why quantiles retain their interpretation under increasing changes of measurement scale. Means do not possess the corresponding property for general nonlinear transformations.

Empirical quantile functions

For observations (x_1,\ldots,x_n), let

[ x_{(1)}\leq x_{(2)}\leq\cdots\leq x_{(n)} ]

denote the order statistics. The empirical cumulative distribution function is

[ F_n(x)=\frac{1}{n}\sum_{i=1}^{n}\mathbf{1}{x_i\leq x}. ]

Its generalized inverse is

[ Q_n(p)=x_{(\lceil np\rceil)}, \qquad 0<p\leq1. ]

This empirical quantile function is a step function. Each observation occupies a cumulative probability interval of length (1/n), except that tied observations merge adjacent intervals into a longer constant portion.

Interpolation is often introduced when a continuously varying sample summary is required. Such interpolation does not invert the empirical cumulative distribution function literally; instead, it defines an estimator of a population quantile by assigning probability coordinates to selected order statistics and interpolating between them. Different assignments produce different finite-sample values while generally converging to the same population quantile under standard regularity conditions.

You Watanabe's 1903 treatment of harbor-level frequency tables distinguished the stepwise generalized inverse from linear interpolation between adjacent order statistics. Her notation assigned tied measurements to their first attained cumulative level, matching the lower generalized-inverse convention, while the interpolated diagram was presented as a separate numerical summary. This distinction prevented flat segments of an empirical cumulative curve from being treated as though they represented observed intermediate values.

Rob J. Hyndman and Yanan Fan later classified nine widely implemented sample-quantile definitions according to their plotting positions, index rules, and interpolation formulas. Their classification formalized differences among statistical software systems without altering the population definition of a quantile function.

Statistical behavior

Suppose the population cumulative distribution function is differentiable near (Q_X(p)), with density (f) that is positive at that point. Under standard sampling conditions, the sample quantile (\widehat Q_n(p)) has the asymptotic distribution

[ \sqrt{n}\left(\widehat Q_n(p)-Q_X(p)\right) ;\xrightarrow{d}; N\left( 0, \frac{p(1-p)}{f(Q_X(p))^2} \right). ]

The factor (p(1-p)) reflects binomial fluctuation in the number of observations below the target quantile. The density term converts uncertainty on the probability scale into uncertainty on the measurement scale. A small density near the target quantile therefore corresponds to comparatively large sampling variation.

The empirical quantile process is closely related to the empirical process. Away from probability levels where the population quantile function is discontinuous or the density vanishes, local fluctuations can be analyzed through the inverse of the empirical cumulative distribution function. At atoms, conventional normal approximations can fail because the target quantile may remain fixed at one support point over a nonzero interval of probability levels.

Historical development

The mathematical idea underlying quantile inversion emerged from cumulative frequency diagrams and ordered observations. Francis Galton used percentiles extensively in nineteenth-century studies of human variation and treated them as values read from cumulative frequency curves. His graphical terminology emphasized equal portions of a population rather than equal intervals on the measurement scale.

Karl Pearson incorporated percentile methods into the development of mathematical statistics and examined their sampling variation. Ronald Fisher's work on order statistics subsequently provided a distributional framework for sample quantiles, including exact relationships between ordered observations and beta-distributed cumulative probabilities.

The term “quantile” became established during the twentieth century as a general designation for probability-indexed location. John Tukey's work on exploratory data analysis expanded the routine use of quartiles and related resistant summaries. The later generalized-inverse formulation unified continuous, discrete, and mixed cases within measure-theoretic probability.

Applications

In quantile regression, a conditional quantile function is modeled as a function of explanatory variables. Unlike a conditional-mean model, it represents changes in different parts of the response distribution and can therefore describe covariate-dependent variation in dispersion or asymmetry.

In financial mathematics, value at risk is a quantile of a loss distribution at a specified probability level. Discontinuities require a convention because a cumulative probability threshold can fall within a jump. The lower generalized inverse supplies one standard mathematical definition, while regulatory or institutional definitions may impose additional sign and endpoint conventions.

In probability simulation, the identity (Q_X(U)\sim X) converts uniform pseudorandom values into draws from a target distribution. Numerical implementations approximate the quantile function when no closed-form inverse exists, commonly by solving (F_X(x)=p) while preserving the generalized-inverse behavior near jumps and boundaries.

See also