Quant Memo
Core

Sample Quantile Estimators and Plotting Positions

There is no single correct formula for 'the 90th percentile of a sample' — different quantile estimators and plotting-position rules give slightly different answers, and the choice matters most in the small samples and tail regions quants care about.

Prerequisites: Quantile Functions and the Inverse CDF, Standard Deviation

Ask ten different statistics packages for the 95th percentile of the same 40-day P&L series and, in the tails, you can get ten slightly different numbers. That's not a bug — there are at least nine officially recognized ways to estimate a quantile from a finite sample, and they disagree by construction because a quantile is a property of a smooth underlying distribution, while your data is a finite, lumpy set of points. Sample quantile estimators are the rules for bridging that gap, and plotting positions are the closely related rules for deciding what quantile a given sorted observation "represents" on a probability plot.

An analogy: measuring where the 9th runner "really" finished

Imagine 12 runners cross a finish line and you want to know the finishing-time value that "90% of runners are faster than." With 12 runners, no one runner sits exactly at the 90th percentile — the 90% mark falls somewhere between the 10th and 11th finisher. Do you just take the 11th runner's time? Average the 10th and 11th? Weight the average toward whichever is closer to the true 90% mark? Every reasonable choice is a different quantile estimator, and with only 12 runners, the choice can swing your answer meaningfully. With 12,000 runners, the different rules nearly agree, because there's a runner right there at (or very near) the 90% mark.

The mechanics, one piece at a time

Sort your nn observations to get order statistics x(1)x(2)x(n)x_{(1)} \le x_{(2)} \le \dots \le x_{(n)}. A plotting position assigns each sorted observation x(i)x_{(i)} a probability pip_i — the "quantile level it represents" — using a formula like

pi=ian+12a,p_i = \frac{i - a}{n + 1 - 2a},

where aa is a constant between 0 and 1 that differs by convention: a=0.5a = 0.5 gives the classic (i0.5)/n(i - 0.5)/n rule, a=0.375a = 0.375 gives the Blom formula favored for normal-probability plots, and a=0a = 0 gives i/(n+1)i/(n+1), the Weibull formula. In plain English: each sorted data point is assigned a "share" of the 0-to-1 probability line, and the different formulas just disagree, mostly at the edges, about exactly how much share the smallest and largest points should get. To get a quantile estimate for a specific target level qq (say the 95th percentile), you invert this — find where qq falls between two pip_i's and interpolate between the corresponding x(i)x_{(i)} values, usually linearly.

Worked example 1: the 90th percentile of 10 P&L observations

Take 10 sorted daily P&L figures (in $000s): −8, −5, −3, −1, 0, 1, 2, 4, 6, 9. Using the common (i0.5)/n(i - 0.5)/n plotting position with n=10n = 10: the 10th point (x(10)=9x_{(10)} = 9) represents p10=(100.5)/10=0.95p_{10} = (10 - 0.5)/10 = 0.95, and the 9th point (x(9)=6x_{(9)} = 6) represents p9=0.85p_9 = 0.85. To estimate the 90th percentile (q=0.90q = 0.90), interpolate linearly between p9=0.85p_9 = 0.85 (value 6) and p10=0.95p_{10} = 0.95 (value 9): the target is halfway between, so the estimate is 6+0.5×(96)=7.56 + 0.5 \times (9 - 6) = 7.5, i.e. $7,500. A different convention (say i/(n+1)i/(n+1)) would place x(9)x_{(9)} at p9=9/110.818p_9 = 9/11 \approx 0.818 and x(10)x_{(10)} at p10=10/110.909p_{10} = 10/11 \approx 0.909, giving a slightly different interpolated answer near $7,900 — a difference of roughly $400 purely from the choice of formula, on identical data.

Worked example 2: why the choice barely matters at scale

Now repeat the exercise on 1,000 sorted daily P&L observations. The gap between adjacent order statistics near the 90th percentile is tiny — often a few dollars — so whichever plotting-position convention you use, the interpolated 90th-percentile estimate lands within a rounding error of the others. With n=1,000n = 1{,}000, (i0.5)/n(i-0.5)/n and i/(n+1)i/(n+1) differ by at most 0.5/1000=0.05%0.5/1000 = 0.05\% in probability terms, which barely nudges the interpolation. The lesson: estimator choice is a real source of disagreement in small samples and matters most exactly where risk desks operate — thin tails, short lookback windows — and becomes nearly irrelevant with large, dense samples.

probability level p (i-0.5)/n: p=0.95 i/(n+1): p=0.909 ≈\$7,500 ≈\$7,900
Two plotting-position conventions assign the same sorted observation slightly different probability levels, which shifts the interpolated quantile estimate — a gap that shrinks as sample size grows.
n = 10: visible gap ≈\$400 apart n = 1,000: negligible gap ≈\$0 apart
The gap between two plotting-position conventions is large enough to matter at n=10 but shrinks to irrelevance by n=1,000 — estimator choice matters most exactly where risk desks have the least data.

What this means in practice

Quantile estimator choice quietly affects VaR estimates, backtesting thresholds, and any percentile-based risk limit computed from a short historical window — see Value at Risk. Most statistical software defaults to one convention (R's default is type 7, roughly the linear-interpolation rule used above) without telling you, so two teams computing "the same" 99th-percentile VaR from the same data can get different numbers just from differing software defaults. When precision at the tail matters, state which quantile estimator you used, and prefer methods built for tail estimation, like extreme value theory, over naive sample quantiles when the sample is small.

A sample quantile is not a single well-defined number — it depends on a plotting-position convention for assigning probability levels to sorted data and interpolating between them, and different reasonable conventions can disagree meaningfully in small samples, especially near the tails.

Don't assume "the 95th percentile of my data" means the same thing across two analyses unless you've confirmed both used the same quantile estimator. This is especially dangerous when comparing a small backtest sample's VaR breach rate against a regulatory or textbook threshold computed under a different convention — the mismatch can silently make a compliant model look like it's breaching, or vice versa, purely from an estimator choice neither side stated explicitly.

Related concepts

Practice in interviews

Further reading

  • Hyndman & Fan, Sample Quantiles in Statistical Packages, The American Statistician (1996)
ShareTwitterLinkedIn