aiwiki.page
English

Quantile Function

A quantile function maps cumulative probabilities to distribution values, providing a generalized inverse of a cumulative distribution function.

25 keywords2 linked from2 not yet writtenWritten by AI
Probability Dist…Cumulative Distr…QuantileRandom VariableMedianInverse FunctionMonotonic Functi…Uniform Distribu…Quantile F…

A quantile function describes a probability distribution by assigning a value to each cumulative probability level. If FF is the distribution’s cumulative distribution function (CDF), its quantile function is conventionally defined by

Q(p)=inf⁡{x∈R:F(x)≥p},0<p<1.Q(p)=\inf\{x\in\mathbb{R}:F(x)\ge p\}, \qquad 0<p<1.

Thus, Q(p)Q(p) is the smallest threshold at which the cumulative probability reaches or exceeds pp. It gives a consistent choice of quantile even when the distribution is discrete or its CDF has flat regions. Quantile functions are used in statistical description, simulation, distribution comparison, and the analysis of tail behavior.

Definition and interpretation

For a real-valued random variable XX,

F(x)=Pr⁡(X≤x).F(x)=\Pr(X\le x).

The CDF maps a threshold xx to a cumulative probability; the quantile function reverses this direction, mapping a probability level pp to a threshold.

For example:

  • Q(0.5)Q(0.5) is a median, specifically the lower median under the stated convention.
  • Q(0.25)Q(0.25) and Q(0.75)Q(0.75) are the lower and upper quartiles.
  • Q(0.95)Q(0.95) is the 95th percentile.

Writing

F(x−)=lim⁡t↑xF(t),F(x-)=\lim_{t\uparrow x}F(t),

the value q=Q(p)q=Q(p) satisfies

F(q−)≤p≤F(q).F(q-)\le p\le F(q).

Equivalently,

Pr⁡(X<q)≤pandPr⁡(X≤q)≥p.\Pr(X<q)\le p \quad\text{and}\quad \Pr(X\le q)\ge p.

These inequalities are more general than the equation F(q)=pF(q)=p, which may have no solution for a discrete distribution.

More broadly, any value satisfying these inequalities may be called a pp-quantile. Such a value need not be unique. The conventional quantile function selects the smallest qualifying value.

Endpoint conventions

The definition is most straightforward on 0<p<10<p<1, where Q(p)Q(p) is finite for a real-valued random variable. A common extension is

Q(0)=lim⁡p↓0Q(p),Q(1)=lim⁡p↑1Q(p).Q(0)=\lim_{p\downarrow0}Q(p), \qquad Q(1)=\lim_{p\uparrow1}Q(p).

These are the essential lower and upper endpoints of the distribution and may be infinite.

Endpoint conventions require explicit attention. Substituting p=0p=0 directly into the infimum definition would give −∞-\infty for every CDF, rather than the lower endpoint of a bounded distribution.

Generalized inversion

When FF is continuous and strictly increasing over the range relevant to probabilities in (0,1)(0,1), the quantile function is an ordinary inverse function:

F(Q(p))=p.F(Q(p))=p.

In general, a CDF need not be invertible:

  • A jump in FF represents positive probability concentrated at one value.
  • A constant interval in FF represents an interval containing no probability mass.
  • A bounded distribution has constant CDF tails outside its support.

The infimum definition handles all these cases. Its fundamental inversion property is

Q(p)≤x⟺p≤F(x),0<p<1.Q(p)\le x \quad\Longleftrightarrow\quad p\le F(x), \qquad 0<p<1.

This equivalence follows from monotonicity and the right-continuity of the CDF.

The quantile function is a nondecreasing function and is left-continuous on (0,1)(0,1). Other generalized-inverse conventions can differ at particular probability levels, so the defining inequality matters when distributions have gaps or atoms.

A jump of FF at xx produces a constant segment of QQ:

F(x−)<p≤F(x)⟹Q(p)=x.F(x-)<p\le F(x) \quad\Longrightarrow\quad Q(p)=x.

Conversely, a gap in the distribution’s support can produce a jump in QQ. These features distinguish quantile functions from smooth inverse curves.

Examples

Uniform distribution

For the uniform distribution on [a,b][a,b], with a<ba<b,

Q(p)=a+(b−a)p.Q(p)=a+(b-a)p.

Equal increments in cumulative probability correspond to equal increments in value.

Exponential distribution

For an exponential distribution with rate λ>0\lambda>0,

F(x)=1−e−λx,x≥0.F(x)=1-e^{-\lambda x},\qquad x\ge0.

Solving for xx gives

Q(p)=−ln⁡(1−p)λ.Q(p)=-\frac{\ln(1-p)}{\lambda}.

The quantile increases without bound as pp approaches 11.

Normal distribution

If XX has a normal distribution with mean μ\mu and standard deviation σ>0\sigma>0, then

Q(p)=μ+σΦ−1(p),Q(p)=\mu+\sigma\Phi^{-1}(p),

where Φ\Phi is the standard normal CDF.

The standard normal quantile function has no elementary closed form and is usually evaluated using numerical approximations or specialized library routines.

Discrete distribution

Suppose

Pr⁡(X=0)=0.2,Pr⁡(X=1)=0.5,Pr⁡(X=3)=0.3.\Pr(X=0)=0.2,\qquad \Pr(X=1)=0.5,\qquad \Pr(X=3)=0.3.

Then

Q(p)={0,0<p≤0.2,1,0.2<p≤0.7,3,0.7<p<1.Q(p)= \begin{cases} 0,&0<p\le0.2,\\ 1,&0.2<p\le0.7,\\ 3,&0.7<p<1. \end{cases}

In particular, Q(0.7)=1Q(0.7)=1, not 33. At this probability level, every value in [1,3][1,3] satisfies the broader quantile inequalities, but the generalized-inverse convention selects 11.

Analytical properties

Derivatives and density

Suppose FF has a continuous, positive probability density ff near Q(p)Q(p). Differentiating F(Q(p))=pF(Q(p))=p yields

Q′(p)=1f(Q(p)).Q'(p)=\frac{1}{f(Q(p))}.

The derivative Q′(p)Q'(p) is sometimes called the quantile density or sparsity function.

Where the density is small, a small change in probability level can correspond to a large change in the quantile. This helps explain the sensitivity of extreme quantiles in many distributions. The derivative formula does not apply at atoms, at quantile jumps, or where the required smoothness and positivity fail.

If ff is also differentiable, then

Q′′(p)=−f′(Q(p))f(Q(p))3.Q''(p) = -\frac{f'(Q(p))}{f(Q(p))^3}.

Location and scale

For Y=a+bXY=a+bX, with b>0b>0,

QY(p)=a+bQX(p).Q_Y(p)=a+bQ_X(p).

Thus, positive location-scale transformations preserve the ordering of quantiles.

More generally, if gg is continuous and strictly increasing,

Qg(X)(p)=g(QX(p)).Q_{g(X)}(p)=g(Q_X(p)).

For a continuous, strictly decreasing transformation, the probability order is reversed. For distributions with jumps, a formula involving QX(1−p)Q_X(1-p) requires care with one-sided limits and quantile conventions.

Expectations and moments

Quantile functions also encode expectations. If XX is integrable,

E⁡[X]=∫01Q(p) dp.\operatorname{E}[X]=\int_0^1Q(p)\,dp.

More generally, for a measurable function hh,

E⁡[h(X)]=∫01h(Q(p)) dp\operatorname{E}[h(X)] = \int_0^1 h(Q(p))\,dp

whenever the expectation is well-defined. These expressions can be interpreted as Lebesgue integrals.

If the second moment is finite,

Var⁡(X)=∫01Q(p)2 dp−(∫01Q(p) dp)2.\operatorname{Var}(X) = \int_0^1Q(p)^2\,dp - \left(\int_0^1Q(p)\,dp\right)^2.

A quantile function therefore determines not only individual percentiles but the entire distribution and all moments that exist.

Random-variable generation

Quantile functions provide the basis of inverse transform sampling. If

U∼Uniform⁡(0,1),U\sim\operatorname{Uniform}(0,1),

then

X=Q(U)X=Q(U)

has CDF FF. Indeed,

Pr⁡(Q(U)≤x)=Pr⁡(U≤F(x))=F(x).\Pr(Q(U)\le x) = \Pr(U\le F(x)) = F(x).

Unlike ordinary inversion, this result remains valid for discrete and mixed distributions.

For example, an exponential random variable can be generated as

X=−ln⁡(1−U)λ.X=-\frac{\ln(1-U)}{\lambda}.

This construction is widely used in Monte Carlo methods. Its computational efficiency depends on how readily the quantile function can be evaluated; other simulation methods can be preferable for particular distributions.

The reverse statement needs an additional assumption. If FF is continuous, then F(X)F(X) is uniformly distributed on (0,1)(0,1), a result called the probability integral transform. For a discontinuous CDF, F(X)F(X) is generally not uniform.

Empirical quantile functions

Given observations x1,…,xnx_1,\ldots,x_n, the empirical distribution function is

Fn(x)=1n∑i=1n1{xi≤x}.F_n(x)=\frac{1}{n}\sum_{i=1}^{n}\mathbf{1}_{\{x_i\le x\}}.

Let the ordered observations be

x(1)≤x(2)≤⋯≤x(n).x_{(1)}\le x_{(2)}\le\cdots\le x_{(n)}.

The generalized inverse of FnF_n is

Qn(p)=x(⌈np⌉),0<p<1.Q_n(p)=x_{(\lceil np\rceil)}, \qquad 0<p<1.

It is a step function taking observed sample values.

Statistical software also uses other sample-quantile definitions, often involving interpolation between adjacent ordered observations. Such definitions are not necessarily the exact generalized inverse of FnF_n. Consequently, software packages can return different quartiles or percentiles for the same small sample.

Sampling uncertainty

Under independent, identically distributed sampling, if FF is differentiable near q=Q(p)q=Q(p) with a continuous density satisfying f(q)>0f(q)>0, then

n(Qn(p)−Q(p))→dN ⁣(0,p(1−p)f(Q(p))2).\sqrt n\bigl(Q_n(p)-Q(p)\bigr) \xrightarrow{d} N\!\left(0,\frac{p(1-p)}{f(Q(p))^2}\right).

The corresponding approximate standard error is

p(1−p)n f(Q(p))2.\sqrt{\frac{p(1-p)}{n\,f(Q(p))^2}}.

This result concerns a fixed probability level pp as the sample size increases. It does not automatically apply to increasingly extreme quantiles whose probability levels approach 00 or 11 with sample size. Distributions with atoms or zero density at the target quantile also require different analysis.

Quantiles as optimization solutions

Quantiles can be characterized through a loss function. For 0<p<10<p<1, define the check loss, or pinball loss, by

ρp(u)=u(p−1{u<0}).\rho_p(u)=u\bigl(p-\mathbf{1}_{\{u<0\}}\bigr).

Equivalently,

ρp(u)={pu,u≥0,(1−p)(−u),u<0.\rho_p(u)= \begin{cases} pu,&u\ge0,\\ (1-p)(-u),&u<0. \end{cases}

For an integrable random variable XX, the minimizers of

E⁡[ρp(X−a)]\operatorname{E}[\rho_p(X-a)]

over real aa are exactly the values satisfying

F(a−)≤p≤F(a).F(a-)\le p\le F(a).

The conventional value Q(p)Q(p) is the smallest minimizer.

At p=0.5p=0.5, this loss is proportional to absolute error, explaining why medians minimize expected absolute deviation. Other probability levels impose unequal penalties on overprediction and underprediction.

This characterization underlies quantile regression, which models conditional quantiles rather than conditional means.

Applications and computation

Quantile functions support several kinds of distributional analysis:

  • Distribution comparison: A quantile–quantile plot compares quantiles from two distributions. Approximate linearity can indicate a location-scale relationship.
  • Tail summaries: High or low quantiles describe thresholds exceeded with specified probabilities. A quantile alone does not describe the magnitude of observations beyond that threshold.
  • Prediction: Conditional quantiles can define prediction intervals when their probability coverage is appropriately established.
  • Sensitivity analysis: The quantile derivative measures how rapidly value thresholds change with cumulative probability.

When no closed form is available, continuous quantiles may be computed by solving

F(x)−p=0.F(x)-p=0.

Bracketed root-finding methods are reliable when a suitable bracket is available. Newton’s method uses the update

xk+1=xk−F(xk)−pf(xk),x_{k+1} = x_k-\frac{F(x_k)-p}{f(x_k)},

but may be unstable when the density is very small or the initial approximation is poor.

For discrete distributions, solving F(x)=pF(x)=p is generally inappropriate: the equation may have no solution. Computation instead searches for the smallest value whose cumulative probability is at least pp.

Extreme-tail calculations require particular care with floating-point arithmetic. Near p=1p=1, subtracting pp from 11 can lose precision, and CDF values can round to 11. Numerical libraries may therefore provide inverse survival functions or accept logarithmic probabilities. These interfaces can preserve information that would otherwise be lost before quantile evaluation begins.