LibraryCalculators

Value at risk and expected shortfall calculator

Think of a river that floods. A town might say the water rises above two metres only one year in twenty. That tells us how often a bad year comes, and nothing about how high the water goes in that one bad year. Risk numbers have the same two halves.

One number per period, in percent, separated by commas, spaces or new lines. At most 2000 values. The prefilled values are example numbers, not market data.

Between 50 and 100, for example 95 or 99.

Education, not advice. Inputs are your own numbers; no market data is used.

Result

MeasureHistoricalParametric (normal)
Value at Risk (loss threshold)2.10%1.77%
Expected shortfall (mean loss beyond it)2.35%2.23%
MeasureValue
Mean return per period0.01%
Standard deviation per period1.09%
Number of returns30

What this computes

Value at risk, or VaR, is the first half: a loss level that returns breach only a small fraction of the time, at a chosen confidence level. Expected shortfall, or ES, is the second half: the average loss across those breaches. This page computes both from a list of returns typed in, in two ways: straight from the data (historical), and from a normal distribution fitted to the data (parametric).

Artzner et al. (1999) set out the properties a sensible risk measure should have, and showed VaR can fail one of them: the VaR of a combined position can exceed the sum of the parts. Expected shortfall satisfies all of them (Acerbi and Tasche 2002), which is a large part of why it has replaced VaR in much of the regulatory toolkit.

How to read the result

VaR at confidence c says: on a fraction c of periods in this data (or in the fitted normal), the loss was no worse than this. It is a threshold, and it tells us nothing about how far past the threshold the bad periods went.

ES at confidence c is the average loss on the periods beyond the threshold. It is always at least as large as VaR at the same confidence. If the page shows ES below VaR, the inputs are wrong.

Compare the historical and normal figures. When the historical numbers are noticeably larger, the data has fatter tails than a normal distribution, and the parametric figure understates the risk. Raising c should raise both measures.

The formula

Historical VaR_c = −(the (1 − c) empirical quantile of the returns)
Historical ES_c = −(average of the returns at or below that quantile)
Normal VaR_c = z_c σ − μ
Normal ES_c = σ φ(z_c) / (1 − c) − μ
z_c = Φ⁻¹(c)

c is the confidence level, for example 0.95 or 0.99. 1 − c is the tail probability. The form takes c in percent, so 95 or 99.

Returns are per period, as typed. μ is their mean and σ their sample standard deviation.

The empirical quantile here is the k-th smallest return, with k = ⌈n × (1 − c)⌉, and it is not interpolated. Expected shortfall is the mean of the returns at or below it. Other tools interpolate between neighbouring returns, so on a short list they give slightly different values.

Φ⁻¹ is the inverse standard normal cumulative distribution function, the normal quantile. φ is the standard normal density.

Both measures are reported as positive numbers meaning a loss, in the same units as the returns. A negative value means even the tail is a gain on average.

Limits

Questions

What is the difference between VaR and expected shortfall?

VaR is a loss threshold that is breached only a small fraction of the time. Expected shortfall is the average loss on the occasions it is breached. VaR says how often a bad outcome comes; ES says how bad it is on average when it does.

Why is expected shortfall considered better than VaR?

It looks at the size of tail losses, where VaR ignores them, and it is coherent in the sense of Artzner et al. (1999). In particular it is subadditive: combining two positions never raises ES above the sum of their separate values, a property VaR can violate.

What is the difference between historical and parametric VaR?

Historical VaR reads the loss level directly off the sorted past returns. Parametric VaR fits a distribution, here the normal, and reads the loss off that. The historical version keeps the data's real tail shape; the parametric one is smoother but assumes a shape.

Does a 99% VaR mean the loss will not exceed it?

No. It means that in the data or model the loss exceeded it in about 1% of periods. Nothing about the size of those losses is in the VaR figure, and the future can differ from the sample.

Related

Also in the library