Skip to content
Tutorials Center
My learning

Topics

Lesson 32 of 38 · Applications in Finance and Science

Value at Risk by Simulation

Estimate Value at Risk and expected shortfall for a two-asset portfolio by simulating correlated returns, and see how fat tails change the answer.

How bad can a bad day get? Banks, funds and insurers must answer that question every day, and regulators ask them to. Value at Risk (VaR) is one common answer. The 99% one-day VaR of a portfolio is the loss that you expect to be exceeded on only 1% of days. If the 99% one-day VaR is 2.4 million, then on about one day in a hundred the portfolio is expected to lose more than that.

Formally, VaR at confidence level 1 − α is a quantile of the loss distribution: P(loss > VaR) = α. Because it is a quantile of a distribution you can simulate, Monte Carlo is an obvious tool. This lesson uses invented numbers for teaching, not real market data and not investment advice.

Correlated returns

A portfolio holds several assets whose returns move together. Suppose two assets have daily mean returns m₁, m₂, daily volatilities σ₁, σ₂ and correlation ρ. To simulate correlated returns:

  1. Draw independent standard normals Z = (Z₁, Z₂).
  2. Compute the Cholesky factor L of the covariance matrix Σ, so Σ = L·Lᵀ.
  3. Returns are R = m + L·Z.

The result has the right mean vector and covariance matrix. If we hold portfolio weights w (in money), the daily profit is w·R and the loss is its negative.

flowchart LR
  A["Independent normals Z"] --> B["Multiply by Cholesky factor L"]
  B --> C["Correlated returns R = m + L Z"]
  C --> D["Portfolio loss = - w . R"]
  D --> E["VaR = quantile of losses"]

Simulating a portfolio's loss distribution.

Simulating VaR and expected shortfall

VaR says nothing about how bad losses are beyond the threshold. Expected shortfall (ES), also called conditional VaR, is the average loss on the days when the loss exceeds VaR. It is more informative about the tail.

Our portfolio (hypothetical): 600,000 in asset 1 and 400,000 in asset 2; daily mean returns 0.04% and 0.03%; daily volatilities 1.2% and 1.8%; correlation 0.3.

For a normal portfolio there is an exact check. The daily portfolio return has mean μ_p = wᵀm and standard deviation σ_p = √(wᵀΣw), and the 99% VaR is −μ_p + 2.326·σ_p (since the 99th percentile of the standard normal is about 2.326).

Python Monte Carlo VaR for a two-asset portfolio

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The simulated VaR should match the exact normal value to within simulation noise. Expected shortfall is always larger than VaR.

Fat tails: what the normal model misses

Real returns have fat tails: extreme moves happen more often than a normal distribution predicts. A common stand-in is the Student t distribution with few degrees of freedom. We scale it to have the same standard deviation as the normal, so the two models agree on everyday volatility and differ only in the tails. For t with ν degrees of freedom the variance is ν/(ν − 2), so we divide by √(ν/(ν − 2)).

Python Normal vs fat-tailed VaR and expected shortfall

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Both distributions have the same standard deviation. At 95% their VaRs are similar (the t can even be lower), but deep in the tail (99.9%) the t model shows markedly larger VaR and expected shortfall. This is why risk managers worry about tails: a risk number computed with the wrong distribution can be dangerously small.

Practical issues

  • Historical vs model-based. Instead of a parametric model, you can resample real past returns (a bootstrap), which keeps fat tails and correlations without assuming a distribution.
  • Time horizon. A multi-day VaR needs a multi-day simulation, or a scaling rule that is only exact in special cases.
  • Nonlinear positions. For portfolios of options, loss is a nonlinear function of the asset moves, and simulation (full revaluation) is the reliable method.
  • Estimation error in the tail. The 99.9% quantile is determined by only 0.1% of samples; use many draws and consider importance sampling.
  • VaR is not coherent. It can fail the diversification property that combining portfolios should not increase risk; expected shortfall does satisfy it.

VaR numbers are only as good as the model and data behind them. Treat them as one input among several, together with stress tests of extreme scenarios.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. The 99% one-day VaR is a loss level that is exceeded:

    VaR at 99% is the 99th percentile of the loss distribution, exceeded with probability 1%.
  2. 2. Expected shortfall is:

    ES averages the tail beyond VaR, so it is at least as large as VaR.
  3. 3. Why use the Cholesky factor when simulating two assets?

    If Sigma = L L^T, then L Z has covariance Sigma when Z has independent standard normal entries.
  4. 4. A fat-tailed model with the same standard deviation as a normal model typically gives:

    Extreme losses are more probable under fat tails, so deep-tail quantiles are bigger.

Summary

  • VaR is a quantile of the loss distribution; expected shortfall is the mean loss beyond it.
  • Simulate correlated returns with a Cholesky factor of the covariance matrix.
  • Check against the exact normal formula when it applies.
  • Fat tails matter a lot in the extreme tail; use heavy-tailed or bootstrapped returns for realism.

Next: Simulating an Epidemic