Lesson 11.2: Value at risk and expected shortfall
What value at risk and expected shortfall measure, three ways to compute them, why VaR can mislead, and how to backtest a risk model with real exception counts.
By the end of this lesson you will be able to define value at risk (VaR) and expected shortfall (ES), compute both by the parametric, historical and Monte Carlo methods, explain why VaR can fail to add up across portfolios and why ES does better, scale a one-day figure to a longer horizon, and backtest a VaR model by counting its exceptions. You will show that a 100 million portfolio with 1 per cent daily volatility has a 99 per cent one-day VaR of 2.33 million under a normal model and 2.65 million under a fat-tailed one, that its expected shortfall is 2.67 and 3.69 million, that two loans that each look riskless by VaR can make a risky portfolio, and that three standard VaR models in a simulated 19-year test each failed their backtests by producing 84 to 107 exceptions where 48 were expected. You should have read Lessons 2.2, 4.2 and 11.1. The mathematics is quantiles and averages. This course is education about how markets and research work, not investment advice.
Lesson 11.1 asked how much to bet. This lesson asks the question that risk managers, regulators and clients put every morning: how much could we lose? The honest answer is "it depends how bad a day you have in mind", and the standard way to make that precise is to name a probability. That is what value at risk does. It has been a core tool since the 1990s, it sits in regulatory capital rules, and it has well-known flaws. A quant needs to know how to compute it, what it hides, and how to test whether a given model is any good.
What VaR says
Value at risk at a confidence level α over a horizon is the loss that is not expected to be exceeded with probability α. A "99 per cent one-day VaR of 2.3 million" means: on 99 days out of 100, the loss over a day should be smaller than 2.3 million, and on 1 day in 100 it will be larger. In symbols, it is the α-quantile of the loss distribution:
VaRα = the number such that P(loss > VaRα) = 1 − α
Three points about the definition are important.
VaR is a threshold, not a worst case. It marks where the bad tail begins. It says nothing about how bad things are beyond it.
It depends on the choices of confidence level and horizon. 95 per cent and 99 per cent, one day and ten days, are the common choices. Numbers with different choices cannot be compared.
It is a statement about a model. A VaR is only as good as the distribution it comes from, which is why backtesting (later in this lesson) matters.
Three ways to compute it
1. Parametric (variance-covariance). Assume returns are normal with a known volatility σ. The loss quantile is then z × σ, where z is the normal quantile: 1.645 at 95 per cent and 2.326 at 99 per cent. For a portfolio with several assets, σ comes from the covariance matrix as in Lesson 11.1. It is fast and easy to explain, and it is wrong whenever returns have fat tails (Lesson 2.2).
Worked example. A portfolio worth 100 million has a daily volatility of 1 per cent, about 15.9 per cent a year. Its one-day VaR is
at 95 per cent: 1.645 × 1% × 100 million = 1.64 million
at 99 per cent: 2.326 × 1% × 100 million = 2.33 million
2. Historical simulation. Take the last N days of actual returns (often 250 to 1,000), apply each to today's portfolio, and read the quantile of the resulting profits and losses. With 500 days and a 99 per cent level, the VaR is roughly the fifth-worst day. It makes no distributional assumption, so it includes the fat tails and correlations in the sample. Its weaknesses are that the sample may not contain the next crisis and that it reacts slowly: a calm window gives a low VaR just before a storm, and a storm in the window keeps the VaR high for a long time after it ends.
3. Monte Carlo. Specify a model for the risk factors, such as a multivariate distribution with a fat-tailed marginal, a volatility process or a copula. Simulate tens of thousands of scenarios, revalue the portfolio in each, and take the quantile. It handles options and other non-linear positions that the parametric method cannot, at the cost of computation and of depending on the model's assumptions.
Large banks use combinations: historical simulation is the most common, with full revaluation of the positions in each scenario.
Expected shortfall
Expected shortfall (ES, also called conditional VaR or CVaR) is the average loss in the days when the loss exceeds VaR:
ESα = E[loss | loss > VaRα]
If VaR tells you where the tail starts, ES tells you how heavy it is. For a normal distribution with volatility σ, ESα = σ × φ(z) ÷ (1 − α), where φ is the normal density. At 99 per cent that is 2.665σ and at 95 per cent it is 2.063σ. On the 100 million portfolio the 99 per cent ES is 2.67 million, a little above the VaR of 2.33.
What fat tails do
Replace the normal with a Student t distribution with 4 degrees of freedom, scaled to the same 1 per cent volatility. The t distribution has the same standard deviation but more probability in the extreme tail and less in the shoulders:
Measure (% of the portfolio, one day) · Normal · Student t, 4 degrees of freedom95% VaR · 1.64 · 1.51
99% VaR · 2.33 · 2.65
95% ES · 2.06 · 2.26
99% ES · 2.67 · 3.69
Two lessons. First, the fat-tailed model has a lower 95 per cent VaR than the normal (1.51 against 1.64), because with the same total variance, more of it sits far out in the tail, leaving the middle quieter. A 95 per cent VaR can therefore make a fat-tailed portfolio look safer than a normal one. Second, at 99 per cent the difference is larger in the VaR (14 per cent higher) and larger still in the ES (38 per cent higher), 3.69 against 2.67. ES responds to the tail's shape and VaR does not.
Scaling to longer horizons
Regulators and risk reports often want a 10-day figure. The usual shortcut is the square-root-of-time rule: if daily returns are independent, volatility over h days is σ × √h. The 10-day 99 per cent VaR of our portfolio is 2.33 × √10 = 2.33 × 3.16 = 7.36 million, and a one-year figure would use √252 = 15.9. The rule is a convenient approximation with a clear failure mode: when returns are positively autocorrelated (Lesson 2.4), or volatility clusters, or positions cannot be exited in a day, the longer-horizon risk can be larger. Many risk teams use horizons tied to how long it would take to liquidate each position, and the new market-risk rules for banks do the same.
What VaR gets wrong
1. It ignores the tail beyond the threshold. Two portfolios with the same 99 per cent VaR can have very different worst cases. One might lose at most 3 million on the bad days, and the other could lose its entire capital. VaR cannot tell them apart. A trader who is judged on VaR can take positions whose losses are rare and enormous, since they never show up inside the quantile. This is sometimes called "picking up pennies in front of a steamroller".
2. It is not subadditive. A sensible risk measure should satisfy: the risk of a combined portfolio is no more than the sum of the risks of its parts, because diversification should not increase risk. VaR can violate this. A worked example:
Two independent loans, each of which loses 100 if it defaults and nothing otherwise, with a 4 per cent chance of default.
On its own, each loan loses nothing 96 per cent of the time. So its 95 per cent VaR is 0: the 5 per cent tail begins at a point where the loss is still zero.
The portfolio of both loans has a loss of 0 with probability 0.9216, of 100 with probability 0.0768 and of 200 with probability 0.0016. The chance of a loss of 100 or more is 7.84 per cent, above 5 per cent, so the portfolio's 95 per cent VaR is 100.
The VaR of the whole (100) is larger than the sum of the parts (0 + 0): VaR tells us that combining two riskless-looking assets creates risk, which is nonsense as a statement about diversification.
Expected shortfall has no such problem. Each loan has a 95 per cent ES of (0.04 × 100) ÷ 0.05 = 80. The portfolio's ES is (0.0016 × 200 + 0.0484 × 100) ÷ 0.05 = 103.2, well below the sum of 160, as diversification should give. ES is subadditive, which is one of the properties that define a coherent risk measure (Artzner and co-authors, 1999). The result matters for capital allocation, since ES-based risk can be split among desks without perverse incentives to subdivide.
3. It is a model number, and models fail in a crisis. The volatility and correlations estimated in calm times are the ones that break down when VaR is needed.
4. It is silent on liquidity. A loss measured at mid prices ignores the cost of getting out. Lesson 11.4 returns to this.
Moving the standard: from VaR to ES
After the 2007 to 2009 crisis, the Basel Committee's Fundamental Review of the Trading Book replaced the 99 per cent VaR in the market-risk capital rules with a 97.5 per cent expected shortfall, calibrated over a stress period and with liquidity horizons that depend on the asset class. The 97.5 per cent level is chosen for a reason: for a normal distribution, 97.5 per cent ES is 2.338σ, nearly the same as the 99 per cent VaR of 2.326σ, so the change does not alter capital for normal risks. For fat-tailed risks, the ES is larger, which is the intention. (Implementation dates and details vary by jurisdiction; check the current rules where it matters.)
Backtesting a VaR model
A VaR model makes a testable prediction: with a 99 per cent level, losses should exceed the VaR on about 1 day in 100. A backtest counts the exceptions, the days when the loss was larger than the predicted VaR, and compares the count with what the confidence level implies.
The tests.
Count. In 250 days, a 99 per cent VaR should be exceeded 2.5 times on average. Under the Basel "traffic light" for banks, 0 to 4 exceptions is the green zone, 5 to 9 is yellow and 10 or more is red, which brings penalties in the capital multiplier.
Kupiec's proportion-of-failures test. Compare the observed exception rate p̂ with the expected rate p₀ by a likelihood-ratio statistic, which follows a chi-squared distribution with one degree of freedom if the model is right. A value above 3.84 rejects it at 5 per cent.
Independence. The exceptions should not cluster. If a VaR breach on one day makes another more likely on the next, the model is not adapting to changes in risk, even if the total count looks right (Christoffersen's test).
An experiment. We simulated 5,040 days (20 years) of returns for a portfolio with an annual volatility of 15.9 per cent that wanders between calm and turbulent spells and has fat tails (an excess kurtosis of 6.8, similar to many equity indices). Starting after a 250-day window, we computed the 99 per cent one-day VaR each day with three standard methods and counted exceptions over the following 4,790 days. About 47.9 would be expected.
Method · Exceptions · Rate · Kupiec statistic · Chance an exception follows another · Worst 250-day count · Share of 250-day windows with 10 or more (red zone)Historical, 250 days · 84 · 1.75% · 22.4 · 3.6% · 12 · 2.8%
Normal, 250-day volatility · 107 · 2.23% · 54.5 · 3.7% · 15 · 9.0%
Normal, exponentially weighted volatility (decay 0.94) · 106 · 2.21% · 52.9 · 1.9% · 10 · 2.5%
All three models fail the test (the statistic is far above 3.84) by producing between 1.75 and 2.23 times as many exceptions as promised. Two reasons: the fat tails make the normal quantile too low, and the volatility estimate lags behind changes, so the VaR is too small just after a regime shift. The exceptions also cluster: after an exception, the chance of another the next day is 3.6 per cent for the historical method and 3.7 per cent for the 250-day normal, against the 1 per cent that independence would give. The exponentially weighted model reacts faster, so it breaks clustering (1.9 per cent) but not the count. Repairing the tail with a fat-tailed distribution, or a volatility model that reacts quickly, would help; checking is what finds the problem.
Backtesting ES is harder. Because ES depends on the size of the losses in the tail, which are rare, direct tests need many years of data. Practitioners backtest the VaR at several levels, compare the average loss on exceptions with the ES forecast, and use newer statistical tests of ES, which remain an active research area.
In the same simulated history, the full-sample 99 per cent VaR was 2.89 per cent and the ES 3.77 per cent, compared with 2.33 and 2.67 for a normal distribution with the same volatility. The gap between the actual tail and the normal is bigger for ES.
Using VaR and ES well
State the choices. Always give the confidence level, horizon, data window and method.
Prefer ES for tail-sensitive decisions and capital allocation, and keep VaR as a communication tool and for backtesting.
Use several methods and compare. If historical and parametric VaR disagree by a lot, the tail is not normal.
Backtest continuously, and treat clusters of exceptions as a signal to revise the model.
Combine it with stress tests (Lesson 11.4), which ask "what if?" without trusting a probability.
Do not manage to the number. Limits on VaR alone encourage hiding risk in the tail. Add limits on notional, concentration, liquidity and loss.
The code below reproduces the lesson's numbers: the normal and Student t figures, the loan example, the 97.5 per cent ES, and the backtest of the three methods.
python
import numpy as np
from math import sqrt
from scipy import stats
1. parametric and fat-tailed VaR and ES, as a percentage of portfolio value, for 1% daily volatility
for a in (0.95, 0.99):
z = stats.norm.ppf(a)
es = stats.norm.pdf(z) / (1 - a)
nu = 4
scale = 1 / sqrt(nu / (nu - 2)) # rescale the t distribution to a standard deviation of 1
q = stats.t.ppf(a, nu)
est = stats.t.pdf(q, nu) / (1 - a) (nu + q q) / (nu - 1) scale
print(f"{a:.0%}: normal VaR {z:.3f} ES {es:.3f} | t(4) VaR {q scale:.3f} ES {est:.3f}")
print("10-day 99% VaR on 100 million:", round(2.3263 sqrt(10), 2), "million")
print("97.5% normal ES:", round(stats.norm.pdf(stats.norm.ppf(0.975)) / 0.025, 3), "| 99% normal VaR:", round(stats.norm.ppf(0.99), 3))
2. two independent loans: VaR is not subadditive, ES is
p = 0.04
probs = {0: (1 - p) 2, 100: 2 p (1 - p), 200: p p}
print("loss probabilities", probs, "| P(loss >= 100):", round(probs[100] + probs[200], 4))
essingle = (p 100) / 0.05
esport = (probs[200] 200 + (0.05 - probs[200]) 100) / 0.05
print("ES of one loan", essingle, "| sum", 2 essingle, "| ES of the portfolio", round(esport, 1))
3. backtest three 99% VaR methods on simulated returns with persistent volatility and fat tails
rng = np.random.defaultrng(21)
n = 252 20
logv = np.zeros(n)
for t in range(1, n):
logv[t] = 0.98 logv[t - 1] + 0.07 rng.standardnormal()
sig = 0.01 np.exp(logv)
sig = sig / np.sqrt(np.mean(sig 2)) 0.01
r = sig rng.standardt(6, size=n) / sqrt(6 / 4)
print("annual volatility", round(r.std() sqrt(252), 3), "| excess kurtosis", round(stats.kurtosis(r), 1))
W, a = 250, 0.99
zq = stats.norm.ppf(a)
ewma = np.zeros(n)
ewma[0] = 0.01
for t in range(1, n):
ewma[t] = sqrt(0.94 ewma[t - 1] 2 + 0.06 r[t - 1] 2)
hits = {"historical": [], "normal 250-day": [], "normal EWMA": []}
for t in range(W, n):
window = r[t - W:t]
hits["historical"].append(r[t] < np.quantile(window, 1 - a))
hits["normal 250-day"].append(r[t] < -zq window.std())
hits["normal EWMA"].append(r[t] < -zq ewma[t])
N = n - W
for name, x in hits.items():
x = np.array(x)
k = int(x.sum())
ph = k / N
lr = -2 (np.log((1 - 0.01) (N - k) 0.01 k) - np.log((1 - ph) (N - k) ph k))
follow = (x[1:] & x[:-1]).sum() / x[:-1].sum()
windows = np.convolve(x.astype(int), np.ones(250, int), "valid")
print(f"{name:15s} exceptions {k} of {N} (expected {0.01 N:.1f}) | Kupiec {lr:.1f} | P(exception after exception) {follow:.3f} | worst 250-day count {windows.max()} | share of windows >= 10: {(windows >= 10).mean():.3f}")
q = np.quantile(r, 0.01)
print("sample 99% VaR", round(-q, 4), "ES", round(-r[r <= q].mean(), 4), "| normal VaR", round(2.326 r.std(), 4), "ES", round(2.665 r.std(), 4))
Common mistakes
Treating VaR as the worst case. On 1 day in 100 the loss is larger, and the number does not say by how much.
Comparing VaRs with different confidence levels or horizons.
Using a normal VaR for a fat-tailed portfolio. It understates the tail, and at 95 per cent it can even look better than it should.
Scaling by the square root of time without checking. It assumes independent returns and the ability to exit.
Adding VaRs across desks and expecting diversification. VaR is not subadditive, and sums can mislead in either direction.
Never backtesting. An untested VaR is an opinion.
Looking only at the count of exceptions. Clusters show a model that adapts too slowly.
Relying on a calm-window estimate. The window that contains no crisis produces a low number just before one.
Gaming the metric. Positions that are never inside the 99 per cent quantile are free under a VaR limit.
Key takeaways
VaR is the loss threshold exceeded with a stated small probability over a horizon. ES is the average loss beyond it. Both depend on the confidence level, the horizon and the model.
There are three standard methods: parametric (normal, quick, thin-tailed), historical (no assumption, slow to react) and Monte Carlo (flexible, model-dependent).
For a 100 million portfolio with 1 per cent daily volatility, the 99 per cent one-day VaR is 2.33 million (normal) or 2.65 million (t with 4 degrees of freedom), and the ES is 2.67 or 3.69 million. The 10-day figure scales by 3.16 if returns are independent.
VaR ignores the tail beyond the threshold and is not subadditive: two loans with a VaR of 0 each form a portfolio with a VaR of 100, while ES (80 each, 103.2 combined) behaves properly.
Regulation has moved to a 97.5 per cent ES, which equals a 99 per cent VaR for normal returns and exceeds it for fat tails.
Backtest by counting exceptions: 48 expected, 84 to 107 observed in the simulation, with clusters. All three standard methods failed the Kupiec test.
Use several methods, state the choices, add stress tests and non-statistical limits, and do not manage to the number.
Check yourself
1. A portfolio worth 250 million has a daily volatility of 0.8 per cent. What is the normal one-day 99 per cent VaR?
2.326 × 0.8% × 250 million = 4.65 million.
2. What is its approximate 10-day VaR, and what does the calculation assume?
4.65 × √10 = 14.7 million. It assumes independent daily returns with a constant volatility and positions that can be held, or exited, over the whole period.
3. A bank's 99 per cent VaR is exceeded 11 times in 250 days. What zone is that, and what does it suggest?
Red zone (10 or more). A correct model would be exceeded about 2.5 times, so the model understates the risk.
4. Why can the VaR of a combined portfolio exceed the sum of the VaRs of its parts?
VaR is only a quantile. If each part has a loss probability below the tail probability, each shows a VaR of zero, but the chance that at least one part loses can exceed the tail probability.
5. Why does the ES at 97.5 per cent roughly equal the VaR at 99 per cent for a normal distribution, but not for a fat-tailed one?
For a normal tail the average loss beyond the 97.5 per cent quantile is about 2.34σ, similar to the 99 per cent quantile of 2.33σ. A fat tail has larger losses beyond the quantile, so its ES is higher.
Try this
Set aside an hour. You need Python and the code in this lesson.
1. Run the code and confirm the tables.
2. Change the t-distribution's degrees of freedom to 3 and 10. How do the 99 per cent VaR and ES move?
3. Add a fourth backtest method: a Student t model with the EWMA volatility. Does it fix the exception count?
4. Change the 99 per cent level to 97.5 per cent and rerun. What is the expected number of exceptions, and how many do the models have?
5. Download a few years of daily returns for an index. Compute the historical 99 per cent VaR and ES, and compare them with normal figures from the same volatility.
6. Write the traffic-light status of each method in the experiment if each had been run over only the worst 250 days.
A good result is a VaR and ES from three methods for the same portfolio, an exception count with a test, and a clear sentence on what the model misses. The next lesson turns from measuring risk to building portfolios that balance risk and return.
Read more
Philippe Jorion's Value at Risk is a standard textbook, and Kevin Dowd's Measuring Market Risk covers methods and backtesting. Philippe Artzner, Freddy Delbaen, Jean-Marc Eber and David Heath's 1999 paper "Coherent Measures of Risk" in Mathematical Finance sets out the subadditivity argument. Paul Kupiec's 1995 paper "Techniques for Verifying the Accuracy of Risk Measurement Models" and Peter Christoffersen's 1998 paper "Evaluating Interval Forecasts" give the backtests. Rockafellar and Uryasev's 2000 paper "Optimization of Conditional Value-at-Risk" shows how to optimise portfolios on ES. The Basel Committee's publication on the minimum capital requirements for market risk (the Fundamental Review of the Trading Book) describes the move to expected shortfall.
Tags: Quant Trader Value at risk Expected shortfall Risk management Backtesting