Quantile Function – Understanding the Inverse CDF Function

cumulative distribution functiondistributionsquantiles

I am reading about the quantile function, but it is not clear to me. Could you provide a more intuitive explanation than the one provided below?

Since the cdf $F$ is a monotonically increasing function, it has an
inverse; let us denote this by $F^{−1}$. If $F$ is the cdf of $X$,
then $F^{−1}(\alpha)$ is the value of $x_\alpha$ such that $P(X \le
x_\alpha) = \alpha$; this is called the $\alpha$ quantile of $F$. The
value $F^{−1}(0.5)$ is the median of the distribution, with half of
the probability mass on the left, and half on the right. The values
$F^{−1}(0.25)$ and $F^{−1}(0.75)$ are the lower and upper quartiles.

Best Answer

All this may sound complicated at first, but it is essentially about something very simple.

By cumulative distribution function we denote the function that returns probabilities of $X$ being smaller than or equal to some value $x$,

$$ \Pr(X \le x) = F(x).$$

This function takes as input $x$ and returns values from the $[0, 1]$ interval (probabilities)—let's denote them as $p$. The inverse of the cumulative distribution function (or quantile function) tells you what $x$ would make $F(x)$ return some value $p$,

$$ F^{-1}(p) = x.$$

This is illustrated in the diagram below which uses the normal cumulative distribution function (and its inverse) as an example.

enter image description here

Example

As an simple example, you can take a standard Gumbel distribution. Its cumulative distribution function is

$$ F(x) = e^{-e^{-x}} $$

and it can be easily inverted: recall natural logarithm function is an inverse of exponential function, so it is instantly obvious that quantile function for Gumbel distribution is

$$ F^{-1}(p) = -\ln(-\ln(p)) $$

As you can see, the quantile function, according to its alternative name, "inverts" the behaviour of cumulative distribution function.

Generalized inverse distribution function

Not every function has an inverse. That is why the quotation you refer to says "monotonically increasing function". Recall that from the definition of the function, it has to assign for each input value exactly one output. Cumulative distribution functions for continuous random variables satisfy this property since they are monotonically increasing. For discrete random variables cumulative distribution functions are not continuous and increasing, so we use generalized inverse distribution functions which need to be non-decreasing. More formally, the generalized inverse distribution function is defined as

$$ F^{-1}(p) = \inf \big\{x \in \mathbb{R}: F(x) \ge p \big\}. $$

The definition, translated to plain English, says that for given probability value $p$, we are looking for some $x$, that results in $F(x)$ returning value greater or equal then $p$, but since there could be multiple values of $x$ that meet this condition (e.g. $F(x) \ge 0$ is true for any $x$), so we take the smallest $x$ of those.

Functions with no inverses

In general, there are no inverses for functions that can return same value for different inputs, for example density functions (e.g., the standard normal density function is symmetric, so it returns the same values for $-2$ and $2$ etc.). The normal distribution is an interesting example for one more reason—it is one of the examples of cumulative distribution functions that do not have a closed-form inverse. Not every cumulative distribution function has to have a closed-form inverse! Hopefully in such cases the inverses can be found using numerical methods.

Use-case

The quantile function can be used for random generation as described in How does the inverse transform method work?

Related Question