By the end you will be able to
- 1Read the median and a percentile as the value with a given share of outcomes below it.
- 2Explain the quantile as the inverse of “the probability of being below”.
- 3Find a quantile of a normal distribution with q = μ + zσ.
- 4Find a percentile from a sorted list of data, and say which rule you used.
Why you need it
“How bad could it get?” has no single answer. A better question is: “What level will we stay above on 99 days out of 100?” The answer to that kind of question is a quantile.
These Core Path lessons use quantiles:
L2.5.06: Value at risk: the idea
Value at risk is a quantile of a loss distribution, often the 99% or 95% one.
It reads a percentile straight from a sorted list of past results.
Expected shortfall averages the outcomes beyond a quantile.
The idea
Flip the question
Suppose tomorrow's temperature is uncertain: on average 20 °C, give or take about 4 °C. You can ask two kinds of question about it.
- Start from a value: what is the chance it is 24 °C or colder? Answer: a probability, about 84%.
- Start from a probability: below what temperature do 90% of days fall? Answer: a value, about 25.1 °C. That value is a quantile.
Both questions use the same curve. The first goes up from the value and across to the probability; the second goes across from the probability and down to the value. Switch between them.
One curve, two questions
Temperature: mean 20 °C, sd 4 °CAsk about
Chance of 24 °C or colder: 84.1%.
The most famous quantile is the median: the middle, with half the outcomes below and half above. A percentile is a quantile with the probability written as a percentage, so the 90th percentile is the 0.9 quantile.
The rules
What a quantile is. The curve above is called the cumulative distribution function. The quantile is its inverse.
Quantiles of the normal. For a normal distribution (see M-C06: The normal distribution) every quantile comes from one table of z values.
| p | z_p | In words |
|---|---|---|
| 1% | −2.326 | 2.326 sd below the mean |
| 5% | −1.645 | 1.645 sd below the mean |
| 10% | −1.282 | 1.282 sd below the mean |
| 50% | 0 | the median |
| 90% | 1.282 | 1.282 sd above the mean |
| 95% | 1.645 | 1.645 sd above the mean |
| 99% | 2.326 | 2.326 sd above the mean |
Quantiles from data. With a list of numbers there is usually no value with exactly 10% of the list below it, so you need a rule to fill the gaps. This page uses linear interpolation, the rule of the RiskAtoms calculator's percentile and Excel's PERCENTILE.INC.
The rules, for reference
Nearest rank, the alternative: with . The rules agree closely with lots of data and can differ noticeably with little, so always say which one you used.
Try it
Start with the values as they came, then sort them: a quantile only makes sense once they are in order. Move the percentage and watch the marker slide between two bars. Compare the two rules near the ends, where the gaps are widest.
Try itPick a percentile
Descriptive statistics calculator →Data
Order
Linear interpolation (the rule on this page)
Nearest rank (another common rule)
Worked examples
1. The median, and one very large value
Step 1 of 4- 1
The set-up
Seven bank branches report one day's cash withdrawals, in $ thousands: 42, 35, 51, 38, 60, 44, 39. What is the median?
2. A low quantile of a normal
Step 1 of 4- 1
The set-up
A model treats a fund's monthly return as normal with mean 1% and standard deviation 4%. Which return is the 5% quantile: the level that only 1 month in 20 falls below?
3. A percentile from data, two ways
Step 1 of 5- 1
The set-up
A desk's profit or loss over 20 days, in € thousands (illustrative): −6, −4, 7, −1, −5, −8, 25, 12, 9, −3, 16, −1, −4, −14, 10, −14, −3, 7, −4, 11. Find the 10th percentile.
Common mistakes
Each line below is a tempting slip. Spot what is wrong, then check.
Reaction
Check what stuck
Question 1 · objective 1
The 90th percentile of a city's daily rainfall is 12 mm. What does that mean?
Question 2 · objective 4
What is the median of 7, 2, 9, 4, 5, 1?
Question 3 · objective 3
X is normal with mean 0 and standard deviation 2. What is its 99th percentile, to two decimals?
Question 4 · objective 4
Sorted data: 3, 5, 6, 8, 9, 12, 14, 15, 18, 21, 25. Using linear interpolation, h = 1 + (n − 1)p, what is the 25th percentile?
Question 5 · objective 2
For a random variable X, P(X ≤ 12) = 0.8. Which statement is true?
Glossary
- Quantile
- The p-quantile is the value with probability p at or below it. Written q_p. For data: the value with a share p of the data at or below it.
- Percentile
- A quantile with p written as a percentage: the 95th percentile is the 0.95 quantile.
- Median
- The middle value: the 0.5 quantile, with half below and half above.
- Quartiles
- The 0.25 and 0.75 quantiles, which cut off the lowest and highest quarters.
- Cumulative distribution function
- F(x) = P(X ≤ x): the probability that X ends up at or below x. It rises from 0 to 1.
- Inverse
- A function that undoes another. The quantile function undoes F: put in a probability, get back a value.
- Linear interpolation
- Filling the gap between two known values in a straight line: go the same fraction of the way across.
- Nearest rank
- A rule for data quantiles: round n × p up to a whole number k and take the k-th smallest value.