Value-at-Risk – Quant Finance
20 October 2021In finance, the Value-at-Risk (VaR) is a statistic used to quantify the risk of potential losses of an investment over a fixed time horizon, given a certain confidence level.
It is a metric that is most commonly used by investment/commercial banks and general financial institutions (e.g., Clearing Houses) to estimate the probabilities of potential losses and to control the level or risk exposure of the portfolios the manage.
Definition of VaR
Consider a confidence level of $99\%$. Here, the confidence level is a number between $0$ and $1$.
When can say, for example, that a portfolio (of financial assets), has a $99\%$ monthly VaR of $\$1000$, meaning that $\$1000$ is the minimum worst possibile loss over a month after excluding the $1\%$ of extreme worst losses.
In other words, we are looking at the minimum loss incurred by the portfolio with $99\%$ of probability over one month. Note that $\$1000$ is the minimum loss, in the sense that there is a $1\%$ probability of loosing more money.
Suppose we are given the following set of monthly returns: $$ R = (-4\%, +5\%, +2\%, -7\%, +1\%, +0.5\%, -2.5\%, -1\%, -2\%, +5.5\%). $$ What is the $90\%$ monthly VaR?
What we have to do is 1) to exclude the $10\%$ worst returns from $R$ and 2) looking at the worst return amongst the remaining ones.
Since we have a total of $10$ returns, the $10\%$ worse returns is just $1$ return, and this is $-7\%$. If we exclude it, the worse return of the remaing ones is $-4\%$. That is, $90\%-\text{VaR} = 4\%$. Note that although the value was $-4\%$ we say that the VaR is $4\%$ since this is tipically expressed as a positive number.
Therefore, given these returns, we estimate that over a period of one month, there is a $10\%$ probability of loosing at least $4\%$ (we can loose more).
A more formal (mathematical) definition of the VaR involves the quantiles of a distribution. Before defining further the VaR, we take advantage of this post to talk about the Gaussian distribution and we first give the definition of the quantiles.
Gaussian distribution and quantiles
Let $X$ be a Gaussian (or Normal) random variable with mean $\mu$ and variance $\sigma^2$. We write $X\sim N(\mu,\sigma^2$). Here, we expect to be known what a random variable is, so for its mean and variance.
The corresponding Probability Density Function (PDF) is defined as $$ f(x) = f(x; \mu, \sigma^2) = := \frac{1}{\sqrt{2\pi\sigma^2}}\exp\left(\frac{-(x-\mu)^2}{2\sigma^2}\right). $$ The plot of this function is the typical bell-shape curve everyone have seen at least once in their life. The associated Cumulative Distribution Function (CDF) is then given by $$ \Phi(x) := \mathbb{P}(X\leq x) = \int_{-\infty}^x f(t)dt = \frac{1}{\sqrt{2\pi\sigma^2}} \int_{-\infty}^x \exp\left(\frac{-(t-\mu)^2}{2\sigma^2}\right) dt. $$ When $\mu=0$, and $\sigma^2=1$, we say that $X$ is standard Gaussian random variable, i.e., $X\sim N(0,1)$.
Due to the simmetry of the shape of the density, there holds the following property: $$ \Phi(x) = 1-\Phi(-x). $$ Furthermore, since $\exp(-x^2/2)$ is a symmetric (even) function, we have that if $X\sim N(0,1)$, then also $-X\sim N(0,1)$: $$ \mathbb{P}(-X\leq x) = \mathbb{P}(X\geq -x) = 1-\mathbb{P}(X\leq -x) = 1-\Phi(-x) = \Phi(x) = \mathbb{P}(X\leq x). $$
Let us now define the quantiles. Let $X$ be a random variable and let $\alpha\in(0,1)$.
The $\alpha$-quantile of the distribution of $X$ is that real number $\phi_\alpha\in$ such that $\mathbb{P}(X\leq \phi_\alpha) = \alpha$.
If $X\sim N(0,1)$, let $\phi_\alpha$ be the corresponding $\alpha$-quantile of the standard Gaussian distribution. There holds: \begin{equation} \begin{split} \Phi(-\phi_\alpha) = \mathbb{P}(X\leq - \phi_\alpha) = \mathbb{P}(-X\leq - \phi_\alpha) = \mathbb{P}(X\geq \phi_\alpha) &= 1 - \mathbb{P}(X\leq \phi_\alpha) \\ &= 1 - \Phi(\phi_\alpha) \\ &= 1 - \alpha \\ &= \mathbb{P}(X\leq \phi_{1-\alpha}) = \Phi(\phi_{1-\alpha}), \end{split} \end{equation} from which we get $-\phi_\alpha = \phi_{1-\alpha}$. This is an important property of quantiles of normal standard distributions.
What is the $90\%$-quantile of the normal distribution? That is, what is that number $\phi_{0.9}$ such that $\Phi(\phi_{0.90}) = \mathbb{P}(X \leq \phi_{0.90}) = 0.90$? We are basically looking for $$ \phi_{0.90} = \Phi^{-1}(0.90). $$ To invert the function $\Phi$, in python, we can use for example the norm.ppf() from scipy.stats. Otherwise, we can use a Z-score table. It turns out to be about $\phi_{0.90} = \Phi^{-1}(0.90) = 1.282$.
A formal definition of VaR
Let us go back to the Value-at-Risk.
Mathematically, the VaR is defined as follow. For a given confidence level $\alpha\in(0,1)$, the $\alpha$-VaR is: $$ \text{$\alpha$-VaR} := - \text{inf}\{r \;:\; \mathbb{P}(R \leq r) \geq 1-\alpha \} = - \text{inf}\left\{r \;:\; \mathbb{P}(R \geq r) \leq \alpha\right\}. $$ That is, the $\alpha$-VaR is the $(1-\alpha)$-quantile of the return distribution.
In fact, we are looking for the smaller number $\text{$\alpha$-VaR}$ such that $$ \mathbb{P}( R \leq -\;\text{$\alpha$-VaR}) = 1-\alpha. $$ In turn, it means that there is a $(1-\alpha)\%$ probability of having a (negative) return greater or equal to $-\,\text{$\alpha$-VaR}$.
With reference to the previous example with a set of ten returns, where $90\%$ monthly $\text{VaR} = -4\%$, we have: $$ -4\% = \text{$90\%$-VaR} = -\text{inf}\{r \;:\; \mathbb{P}(R \leq r) \geq 10\% \}, $$ i.e., there is a $10\%$ probability of loosing more than $4\%$ of our money.
Expected Shortfall
We have seen how the VaR is a metric to measure the risk of the left tail of a return distribution. We say left tail since we are worried about negative returns (that is why VaR figures are negative, even if the sign is then changed when speaking about it).
Since the VaR is nothing but that a quantile, it does not say anything about what is left behind it. That is, we do not know in principle how much loss (negative returns) can one occur in although with a very small probability.
If we have a $90\%$ monthly VaR of $4\%$, it may happen that a worst loss is $-5\%$ but also $-15\%$. Of course, it depends on the the historical return distribution we are working with. The point is, if there is some very large negative return (outlier), due to which the left tail is very fat, the simple VaR figure may not be an appropriate measure of risk.
In order to take into account the entire left tail of our return distribution we need to look at what is left beyond the VaR. For example, we can consider the the average of the distribution 'beyond' the VaR, i.e., the expected loss in case we are unlucky and got a return worst than VaR.
The name of this meausure is the Expected Shortfall (ES) (or also Conditional VaR): $$ \text{ES} := -\mathbb{E}( R\; |\; R\leq -\text{VaR}) = - \frac{\int_{-\infty}^{-\text{VaR}} r f(r)dr }{ \mathbb{P}(R \leq -\text{Var}) }, $$ where $f$ is the returns's PDF and $\mathbb{P}(R \leq -\text{Var})$ in the denominator is the returns's CDF. Here, $\text{VaR}$ denotes the $\text{$\alpha$-VaR}$ for some confidence level $\alpha$.
For example, we are given the following set of monthly returns: $$ R = (-4\%, +5\%, +2\%, -7\%, +1\%, +0.5\%, -2\%, -1\%, -2\%, +5\%). $$ What is the $80\%$ monthly ES?
What we have to do is computing the $\text{$80\%$-VaR}$ in first place. That is, 1) excluding the $20\%$ worst returns and 2) looking at the worst return of the remaining ones. Then, 3) we average those returns less than $\text{$80\%$-VaR}$.
Since we have 10 returns, the $20\%$ worst returns are 2 returns, $-7\%$ and $-4\%$. The worst return amongst the remaining ones is $-2\%$. That is, $\text{$80\%$-VaR} = 2\%$. (Recall that we change the sign just for the sake of having a positive number. However, the VaR is a negative return!) Now, we see that the returns less than $-2\%$ are only $-7\%$ and $-4\%$. Their average gives $\text{$80\%$-ES} = - (-7\%-4\%)/2 = 5.5\%$.
By definition, it is clear that the ES is always greater than or equal to the VaR. Here, for example, by using the simple VaR, we expected to loose at least $2\%$ (but we don't really know how much) with $20\%$ probability over a month. However, the ES gives us more information about the tail since it tells us that with the same $20\%$ probability we expect to loose $5.5\%$ on average.
Just imagine what if the return of $-7\%$ was $-20\%$. Well, the $\text{$80\%$-VaR}$ would still be $2\%$ and this would clearly underestimate the left tail risk. On the other hand, the $\text{$80\%$-ES}$ would now be $- (-15\%-4\%)/2 = 9.5\%$. You probably better trust the ES as a risk measure for the left tail!