A quantile function describes a probability distribution by assigning a value to each cumulative probability level. If is the distribution’s cumulative distribution function (CDF), its quantile function is conventionally defined by
Thus, is the smallest threshold at which the cumulative probability reaches or exceeds . 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 ,
The CDF maps a threshold to a cumulative probability; the quantile function reverses this direction, mapping a probability level to a threshold.
For example:
- is a median, specifically the lower median under the stated convention.
- and are the lower and upper quartiles.
- is the 95th percentile.
Writing
the value satisfies
Equivalently,
These inequalities are more general than the equation , which may have no solution for a discrete distribution.
More broadly, any value satisfying these inequalities may be called a -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 , where is finite for a real-valued random variable. A common extension is
These are the essential lower and upper endpoints of the distribution and may be infinite.
Endpoint conventions require explicit attention. Substituting directly into the infimum definition would give for every CDF, rather than the lower endpoint of a bounded distribution.
Generalized inversion
When is continuous and strictly increasing over the range relevant to probabilities in , the quantile function is an ordinary inverse function:
In general, a CDF need not be invertible:
- A jump in represents positive probability concentrated at one value.
- A constant interval in 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
This equivalence follows from monotonicity and the right-continuity of the CDF.
The quantile function is a nondecreasing function and is left-continuous on . Other generalized-inverse conventions can differ at particular probability levels, so the defining inequality matters when distributions have gaps or atoms.
A jump of at produces a constant segment of :
Conversely, a gap in the distribution’s support can produce a jump in . These features distinguish quantile functions from smooth inverse curves.
Examples
Uniform distribution
For the uniform distribution on , with ,
Equal increments in cumulative probability correspond to equal increments in value.
Exponential distribution
For an exponential distribution with rate ,
Solving for gives
The quantile increases without bound as approaches .
Normal distribution
If has a normal distribution with mean and standard deviation , then
where 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
Then
In particular, , not . At this probability level, every value in satisfies the broader quantile inequalities, but the generalized-inverse convention selects .
Analytical properties
Derivatives and density
Suppose has a continuous, positive probability density near . Differentiating yields
The derivative 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 is also differentiable, then
Location and scale
For , with ,
Thus, positive location-scale transformations preserve the ordering of quantiles.
More generally, if is continuous and strictly increasing,
For a continuous, strictly decreasing transformation, the probability order is reversed. For distributions with jumps, a formula involving requires care with one-sided limits and quantile conventions.
Expectations and moments
Quantile functions also encode expectations. If is integrable,
More generally, for a measurable function ,
whenever the expectation is well-defined. These expressions can be interpreted as Lebesgue integrals.
If the second moment is finite,
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
then
has CDF . Indeed,
Unlike ordinary inversion, this result remains valid for discrete and mixed distributions.
For example, an exponential random variable can be generated as
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 is continuous, then is uniformly distributed on , a result called the probability integral transform. For a discontinuous CDF, is generally not uniform.
Empirical quantile functions
Given observations , the empirical distribution function is
Let the ordered observations be
The generalized inverse of is
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 . Consequently, software packages can return different quartiles or percentiles for the same small sample.
Sampling uncertainty
Under independent, identically distributed sampling, if is differentiable near with a continuous density satisfying , then
The corresponding approximate standard error is
This result concerns a fixed probability level as the sample size increases. It does not automatically apply to increasingly extreme quantiles whose probability levels approach or 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 , define the check loss, or pinball loss, by
Equivalently,
For an integrable random variable , the minimizers of
over real are exactly the values satisfying
The conventional value is the smallest minimizer.
At , 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
Bracketed root-finding methods are reliable when a suitable bracket is available. Newton’s method uses the update
but may be unstable when the density is very small or the initial approximation is poor.
For discrete distributions, solving is generally inappropriate: the equation may have no solution. Computation instead searches for the smallest value whose cumulative probability is at least .
Extreme-tail calculations require particular care with floating-point arithmetic. Near , subtracting from can lose precision, and CDF values can round to . 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.