On this page
Define the original equal-weight sample
The losses 1, 2, …, 20 are hypothetical, each with probability 1/20=5%. They have already been ordered from smallest to largest. No interpolation, historical repricing or real market source is implied.
Select the lower cumulative quantile
At c=95%, rank ceil(20×0.95)=19 gives VaR 19. The selected worst 5% consists only of loss 20, so ES is 20. At c=90%, rank 18 gives VaR 18 and the worst 10% contains losses 19 and 20, averaging 19.5.
Handle a non-integer tail count
At 92.5% confidence, the selected tail is 7.5%: all 5% at loss 20 and 2.5% from loss 19. ES=(0.05×20+0.025×19)/0.075=19.666667 approximately. Rounding the tail to one or two whole observations would use the wrong mass.
Keep other percentile estimators separate
A statistical package may interpolate between sorted values. Its result can differ from this lower empirical quantile without indicating an arithmetic failure. State the estimator and observation weights before comparing reported percentiles.