Quantile Functions and the Inverse CDF
The CDF answers "how likely is a value below x?"; its inverse, the quantile function, answers the question a risk manager actually asks — "what value corresponds to the 1st percentile?" — and it is also the standard trick for turning a random number generator into any distribution you want.
Prerequisites: Random Variables & Distributions, Value at Risk (VaR)
Value at risk is a sentence like "there is a 1 percent chance of losing more than $2 million tomorrow." The number $2 million wasn't found by asking "how likely is a $2 million loss?" — that's the cumulative distribution function (CDF), and it runs the wrong direction. It was found by asking "what loss level cuts off the worst 1 percent?" — which is the CDF's inverse, and it is a distinct mathematical object worth naming.
The analogy: a sorted line of outcomes
Imagine every possible outcome sorted from worst to best and lined up along a ruler from 0 to 1, where position 0 is the worst thing that can happen and position 1 the best. The CDF tells you, for any outcome, how far along that ruler it sits. The quantile function does the reverse: point at a spot on the ruler — say, "the worst 1 percent mark" — and it tells you which outcome lives there. VaR is a request to point at 0.01 and read off the outcome.
Writing it down
The CDF is nondecreasing and runs from 0 to 1. Its inverse, the quantile function, is
In words: is the smallest value such that at least a fraction of the probability sits at or below it. Feed it and you get the median. Feed it and you get the 1st percentile — a 99 percent VaR level, read directly off the loss distribution's left tail.
Slide the mean and standard deviation above and watch the shape change; the quantile function is the same picture read sideways — instead of "how tall is the curve at ," it answers "at what has the area under the curve up to that point reached ."
The same object has a second job entirely unrelated to risk reporting: inverse transform sampling. If is a uniform random number between 0 and 1 — the one thing every computer can generate cheaply and reliably — then has exactly the distribution you wanted. This is how a random number generator that only knows how to produce uniform numbers gets turned into normal returns, exponential wait times, or any shape a Monte Carlo simulation needs.
Worked example 1: VaR as a quantile, step by step
A portfolio's daily P&L is modeled as (variance 100, so a standard deviation of $10 million). The 99 percent VaR is the loss at the 1st percentile: , where is the standard normal quantile at (a standard, tabulated number). Plugging in: . The 99 percent VaR is $23.26 million — read directly as , no separate calculation of "how likely is a $23.26 million loss" required, because the quantile function was built to answer this exact question.
Worked example 2: sampling an exponential from a uniform number
You need to simulate wait times between order fills, exponentially distributed with rate per second (mean 0.5 seconds). Its CDF is . Solve for the inverse: set , so , giving
In words: to sample a wait time, draw a uniform number between 0 and 1 and pass it through this formula. Suppose your random number generator hands you : seconds. Draw a different uniform number, : seconds. Repeat this thousands of times and the resulting wait times are, provably, exponentially distributed with rate 2 — built entirely from a uniform number generator and one formula.
What this means in practice
- Every headline VaR or CVaR number is a quantile function evaluation. "99 percent VaR" literally means "evaluate at ."
- Monte Carlo engines lean on inverse transform sampling whenever the quantile function has a closed form (uniform, exponential, and — via a numerical approximation — normal), because it needs only one uniform draw per sample.
- Copula-based simulation (correlated risk factors with different marginal shapes) works by simulating correlated uniforms first, then passing each through its own quantile function — the technique only works because exists for each marginal.
The quantile function is the CDF read backwards: instead of "how likely is a value below ," it answers "which value cuts off the bottom fraction of outcomes." VaR is exactly this question, and inverse transform sampling exploits the same function to manufacture any distribution from uniform random numbers.
Do not confuse "the -th quantile" with "the value with percent chance of occurring exactly" — for a continuous distribution any single exact value has probability zero. The quantile is a cutoff, not a probability-weighted outcome, which is why VaR is routinely misread as "the worst loss you'll see" when it actually means "the loss level exceeded only percent of the time" — everything past that cutoff, however severe, is still possible and unmeasured by VaR itself.
Related concepts
Practice in interviews
Further reading
- Casella & Berger, Statistical Inference (ch. 2)
- Glasserman, Monte Carlo Methods in Financial Engineering (ch. 2)