Value at Risk and Expected Shortfall Calculator

Method
Return distribution
Mean and volatility are
Cornish-Fisher adjustment (optional; daily returns, blank for normal)
Past daily data
Simulation

How to use it

  1. Choose a method. Parametric and Monte Carlo work from a mean and a volatility; historical simulation works from past data.
  2. Enter the portfolio value, the confidence level (95, 97.5 and 99 % are the usual ones) and the horizon in trading days.
  3. For parametric or Monte Carlo, enter the volatility, and the mean return if it is not zero, and say whether they are daily or annual. For parametric, add the skew and excess kurtosis of daily returns to adjust for fat tails.
  4. For historical simulation, paste the past daily returns or prices, oldest first, and choose how to carry them over the horizon.
  5. For Monte Carlo, enter the number of paths and, to get a different sample, a different seed. The same seed always gives the same answer.
  6. VaR, ES, the working behind them and a chart of the loss distribution appear and update as you type.

To see it filled in, choose “Show an example”. VaR and ES are estimates from a model of returns, and each method assumes something different about them; the methodology below says what. For study and comparison; not financial advice.

Result

Enter the portfolio value.

Losses are positive. VaR is the loss exceeded with probability 1 − α over the horizon; ES is the average loss in that worst 1 − α of outcomes.

Methodology, equations and examples

Value at Risk (VaR) is the loss a portfolio will not exceed over a given horizon at a given confidence level α. A 10-day 99 % VaR of $1.47 million says that, under the model, the portfolio loses more than $1.47 million over 10 days only 1 % of the time. Expected shortfall (ES), also called conditional VaR, is the average loss in that worst 1 % of outcomes. VaR says where the tail starts; ES says how bad the tail is.

Losses here are positive numbers. The calculator works in returns, so a loss of 3 % on a $10 million portfolio is $300,000.

Parametric (variance-covariance) method

If the portfolio's return over h days is normal with mean μh and standard deviation σh, the loss quantile at α is

VaR = (zα σh − μh) × V

ES = (σh φ(zα) / (1 − α) − μh) × V

  • V – Portfolio value
  • zα – The standard normal quantile at α, the value a standard normal variable falls below with probability α (2.326 at 99 %, 1.960 at 97.5 %, 1.645 at 95 %)
  • φ(z) – The standard normal density, e^(−z²/2) / √(2π)
  • μh = hμ and σh = σ√h – The mean and volatility over h days, from daily figures μ and σ

The square-root-of-time rule σh = σ√h assumes daily returns are independent and identically distributed. An annual volatility is converted to daily by dividing by √252, the usual count of trading days in a year.

Over short horizons the mean is small next to the volatility and is often taken as zero, which is the conservative choice when the mean is positive.

Cornish-Fisher adjustment

Daily returns usually have fatter tails than the normal distribution, and often a negative skew. The Cornish-Fisher expansion adjusts the normal quantile for skewness S and excess kurtosis K (kurtosis minus 3, which is zero for a normal distribution):

z′ = z + (z² − 1)S/6 + (z³ − 3z)K/24 − (2z³ − 5z)S²/36

The calculator applies it to the return quantile in the loss tail, so a negative skew raises VaR. For independent days, skew over h days is S/√h and excess kurtosis is K/h, so the adjustment fades as the horizon grows. ES is found by averaging the adjusted VaR over the tail, at 4,000 points between α and 1. The expansion is an approximation: it is reliable for moderate skew and kurtosis, and for extreme values the adjusted quantiles can stop increasing with α.

Historical simulation

Historical simulation makes no assumption about the shape of the distribution. It takes the portfolio's past daily returns as the possible outcomes for tomorrow, ranks the losses from worst to best, and reads VaR off the list.

With n returns the tail holds k = ⌊n(1 − α)⌋ of them, n(1 − α) rounded down. VaR is the k-th worst loss and ES is the average of the k worst. This is the convention in Hull: with 500 days of data, the 99 % VaR is the 5th-worst loss and ES is the average of the five worst. Other texts take the next observation, or interpolate between the two, so results from different sources can differ by one observation.

The calculator accepts prices or returns. Prices are turned into simple returns, Pt / Pt−1 − 1. Over a horizon of more than one day it either scales the 1-day VaR and ES by √h, which assumes independent days, or ranks overlapping h-day returns compounded from the daily ones. Overlapping returns need no scaling assumption, but neighboring windows share all but one day, so they are not independent and a short history gives few distinct outcomes.

Historical simulation only knows the period it is given. A calm year of data will understate the risk of a crisis.

Monte Carlo simulation

The Monte Carlo method draws many possible h-day returns from a model and reads VaR and ES off the simulated losses, the same way as historical simulation. Here each path draws one h-day log return, normal with mean h(μ − σ²/2) and variance σ²h, so the price follows geometric Brownian motion. The simulated loss is 1 − e^(log return).

This model's VaR has a closed form, V(1 − e^(h(μ − σ²/2) − zα σ√h)), which the results show beside the simulation. A lognormal return is skewed toward gains and cannot fall below −100 %, so its VaR is lower than the parametric normal VaR. The results also give a 95 % confidence interval on the simulated VaR from the order statistics around it, the ranks k ± 1.96 √(N α(1 − α)) for N paths. It narrows as the number of paths grows. A seed fixes the random numbers, so a link to a result always reproduces it.

Monte Carlo earns its place with portfolios that are not linear in their risk factors, such as options, where the simulated paths are repriced in full. This calculator simulates a single linear position to show the method.

VaR or expected shortfall

VaR says nothing about how large the losses beyond it are: two portfolios with the same VaR can have very different tails. VaR is also not subadditive, so the VaR of two positions combined can exceed the sum of their VaRs, which penalizes diversification. ES has neither problem; it is a coherent risk measure in the sense of Artzner, Delbaen, Eber and Heath (1999).

For these reasons the Basel Committee's Fundamental Review of the Trading Book replaced 99 % VaR with 97.5 % expected shortfall for market risk capital under the internal models approach. For a normal distribution the two are close: 97.5 % ES is 2.338σ and 99 % VaR is 2.326σ. For fat-tailed returns, ES rises more.

Example

A position of $10 million in one stock has a daily volatility of 2 %, and its mean daily change is taken as zero. This is the VaR example in Hull, Options, Futures, and Other Derivatives.

The daily standard deviation is 2 % of $10 million, $200,000. At 99 % confidence z = 2.3263, so the 1-day VaR is 2.3263 × $200,000 = $465,300. Over 10 days the standard deviation is $200,000 × √10 = $632,456, and the 10-day VaR is $465,300 × √10 = $1,471,300.

The expected shortfall uses φ(2.3263) = 0.02665. The 1-day ES is $200,000 × 0.02665 / 0.01 = $533,000, and the 10-day ES is $1,685,600. The worst 1 % of 10-day outcomes average a loss about 15 % larger than the VaR.

With the Monte Carlo method and the same inputs, the exact lognormal VaR over 10 days is $1,385,400, lower than the normal $1,471,300. A lognormal return is skewed toward gains and cannot fall below −100 %, so its loss tail is shorter.

Top