20
Apr 20

FN3142 Chapter 14 Risk management and Value-at-Risk: Backtesting

FN3142 Chapter 14 Risk management and Value-at-Risk: Backtesting

Here I added three videos and corresponding pdf files on three topics:

Chapter 14. Part 1. Evaluating VAR forecasts

Chapter 14. Part 2. Conditional coverage tests

Chapter 14. Part 3. Diebold-Mariano test for VaR forecasts

Be sure to watch all of them because sometimes I make errors and correct them in later videos.

All files are here.

Unconditional coverage test

7
Apr 20

FN3142 Chapter 13. Risk management and Value-at-Risk: Models

FN3142 Chapter 13. Risk management and Value-at-Risk: Models

Chapter 13 is divided into 5 parts. For each part, there is a video with the supporting pdf file. Both have been created in Notability using an iPad. All files are here.

Part 1. Distribution function with two examples and generalized inverse function.

Part 2. Value-at-Risk definition

Part 3. Empirical distribution function and its estimation

Part 4. Models based on flexible distributions

Part 5. Semiparametric models, nonparametric estimation of densities and historical simulation.

Besides, in the subchapter named Expected shortfall you can find additional information. It is not in the guide but it was required by one of the past UoL exams.

7
May 19

Question 1 from UoL exam 2016, Zone B, Post 1

Question 1 from UoL exam 2016, Zone B, Post 1

There is a hidden mine in this question, and it is caused by discreteness of the distribution function. We had a lively discussion of this oddity in my class. The answer will be given in two posts.

Question. Two corporations each have a 4% chance of going bankrupt and the event that one of the two companies will go bankrupt is independent of the event that the other company will go bankrupt. Each company has outstanding bonds. A bond from any of the two companies will return R=0% if the corporation does not go bankrupt, and if it goes bankrupt you lose the face value of the investment, i.e., R=-100%. Suppose an investor buys $1000 worth of bonds of the first corporation, which is then called portfolio P_1, and similarly, an investor buys $1000 worth of bonds of the second corporation, which is then called portfolio P_2.

(a) [40 marks] Calculate the VaR at \alpha=5\% critical level for each portfolio and for the joint portfolio P_1+P_2.

(b) [30 marks] Is VaR sub-additive in this example? Explain why the absence of sub-additivity may be a concern for risk managers.

(c) [30 marks] The expected shortfall ES^\alpha at the \alpha =5\% critical level can be defined as ES^\alpha=-E_t[R|R<-VaR_{t+1}^\alpha]. Calculate the expected shortfall for the portfolios P_1, P_2 and P_1+P_2. Is this risk measure sub-additive?

Solution. a) The return on each portfolio is a binary variable described by Table 1:

Table 1. Return on separate portfolios

R_i Prob
0 0.96
-100 0.04

Therefore the distribution function F_{R_i}(x) of the return is a piece-wise constant function equal to 0 for x<-100, to 0.04 for -100\leq x<0 and to 1 for x\geq 0, see Example 3. For instance, if x\geq 0 we can write

F_{R_i}(x)=P(R_i\leq x)=P(R_i<-100)+P(R_i=-100)+P(-100<R_i<0)+P(R_i=0)+P(0<R_i\leq  x)=0.04+0.96=1.

Return distribution function

Diagram 1. Return distribution function

Since this function is not one-to-one, it's usual inverse does not exist and we have to use the quasi-inverse, see Answer 15. As with the distribution function, we need to look at different cases.

If y>1, drawing a horizontal line at y we see that the set \{x:F_{R_i}(x)\geq y\} is empty and the infimum of an empty set is by definition +\infty (can you guess why?)

For any 1\geq y>0.04, we have \{x:F_{R_i}(x)\geq y\}=[0,+\infty ), so F_{R_i}^{-1}(y)=0.

Next, for 0<y\leq 0.04 we have \{x:F_{R_i}(x)\geq y\}=[-100,+\infty ) and F_{R_i}^{-1}(y)=-100.

Finally, if y\leq 0, we get \{x:F_{R_i}(x)\geq  y\}=(-\infty ,+\infty ) and F_{R_i}^{-1}(y)=-\infty .

Generalized inverse example

Generalized inverse example

The resulting function is bad in two ways. Firstly, it takes infinite values. In applications to VaR this should not concern us because the bad values occur in the ranges y>1 and y\leq 0.

Secondly, for practically interesting values of y\in (0,1), the graph of F_{R_i}^{-1} has flat pieces, which may be problematic. By definition, VaR^\alpha is the solution to the equation

P(R_i\leq VaR^\alpha)=\alpha .

This means that we should have VaR^\alpha=F_{R_i}^{-1}(\alpha). When we plug this value in F_{R_i}(x), we are supposed to get \alpha . However, here we don't, in general. For example, VaR^{0.02}=F_{R_i}^{-1}(0.02)=-100, while F_{R_{i}}(-100)=0.04\neq 0.02.

This happens because the usual inverse does not exist. When the usual inverse exists, we have two identities F^{-1}(F(x))=x and F(F^{-1}(y))=y. Here both are violated.

Now the definition of VaR gives VaR_{R_i}^\alpha=F_{R_i}^{-1}(0.05)=0 for each portfolio.

To be continued.

3
May 18

Solution to Question 2 from UoL exam 2016, zone A

Solution to Question 2 from UoL exam 2016, Zone A (FN3142)

This is another difficult question, and I don't think it will appear again in its entirety. However, the ideas applied here and here are worth repeating and will surely be on future UoL exams in some form.

Problem statement

You hold two different corporate bonds (bond A and bond B), each with a face value of $1 mln. The issuing firms have a 2% probability of defaulting on the bonds, and both the default events and the recovery values are independent of each other. Without default, the notional value is repaid, while in case of default, the recovery value is uniformly distributed between 0 and the notional value.
(a1) (20 points) Find the 1% VaR for bond A or bond B and report your calculations. (HINT: you will need the definition and properties of a uniform distribution U[a,b] on [a,b].)
(a2) (60 points) Taking into account the formula for the distribution function of the sum of two independent uniformly distributed random variables on [a,b] explain how you would find the 1% VaR for a portfolio combining the two bonds (A + B). Report your calculations without finding the actual value.
(b) (20 points) The 1% expected shortfall is defined as the expected loss given that the loss exceeds the 1% VaR. Find the 1% expected shortfall for bond A and report your calculations.

I made the statement shorter by referencing my post on the uniform distribution. The formulas for the triangular distribution given in the exam and examiner's comments are both wrong.

Solution

As with previous solutions related to VaR, I emphasize general methods that reduce the amount of guessing to a minimum. Besides, I work with the definition that gives a negative VaR in percents (that is, I work with returns) and then translate that value to positive dollar amounts. Translating the problem statement to returns: without default, the return on each bond is zero, while in case of default the loss is uniformly distributed between -1 and 0 (-1 corresponds to -100%). The recovery value is the notional value minus the dollar loss.

The method consists of two steps. Step 1. Derive the distribution function. Step 2. Use the usual or generalized inverse to find the VaR.

(a1) R_A denotes the return on A, D_A is the event that A defaults and \bar{D}_A is the complement event of no default. Similar notation is employed for B. By the law of total probability for any real x

(1) F_{R_A}(x)=P(R_A\le x)=P(R_A\le x|D_A)P(D_A)+P(R_A\le x|\bar{D}_A)P(\bar{D}_A).

We want to show that for our purposes the second term can be made zero. We know that without default, return is zero. This means that conditionally we deal with a random variable that takes value 0 with probability 1. Hence, conditional on no default, by additivity of conditional probability for x\ge 0

(2) P(R_A\le x|\bar{D}_A)=P(R_A<0|\bar{D}_A)+P(R_A=0|\bar{D}_A)+P(0<R_A\le x|\bar{D}_A)=1

because the middle term on the right is 1 and the other two are zero. It follows that for x\ge 0 the second term in (1) is

(3) P(R_A\le x|\bar{D}_A)P(\bar{D}_A)=1\times 0.98>0.01.

To find the VaR, we need the whole expression in (1) to be 0.01, so we have to consider only x<0, in which case the second term on the right of (1) is zero.

In the first term on the right of (1) P(R_A\le x|D_A) is uniformly distributed on [-1,0], so from its distribution function it's clear that we need to consider only -1<x<0:

F_{R_A}(x)=P(R_A\le x|D_A)P(D_A)=(x+1)0.02.

As this should be equal to 0.01, we obtain x=-0.5. The loss is $1 mln times 50% and the recovery value is half a million.

(a2) Denote R=R_A+R_B. This allows us to use the formula for the convolution of two independent uniform distributions. We should remember that this is not a return on the total portfolio because it takes values between -2 and 0. By the  law of total probability for any real x

(4) F_R(x)=P(R\le x|D_A\cap D_B)P(D_A\cap D_B)+P(R\le x|D_A\cap \bar{D}_B)P(D_A\cap \bar{D}_B)

+P(R\le x|\bar{D}_A\cap D_B)P(\bar{D}_A\cap D_B)+P(R\le x|\bar{D}_A\cap \bar{D}_B)P(\bar{D}_A\cap \bar{D}_B).

As above, we can show that the last term in (4) is large if x\ge 0. Indeed, if no company defaults, the return is zero and, as in (2), for such x

P(R\le x|\bar{D}_A\cap \bar{D}_B)=1.

Therefore, as in (3)

P(R\le x|\bar{D}_A\cap \bar{D}_B)P(\bar{D}_A\cap \bar{D}_B)=1\times 0.98^2=0.9604>0.01.

It follows that we can restrict our attention to x<0, in which case the last term on the right of (4) is zero, the second and third terms are the same and we get

(5) F_R(x)=P(R\le x|D_A\cap D_B)0.02^2+2P(R\le x|D_A\cap \bar{D}_B)0.02\cdot 0.98.

In case of two defaults, R_A,\ R_B are independent and distributed as U[-1,0]. Hence, R has a triangular distribution. Denoting its density f_T, we have

(6) P(R\le x|D_A\cap D_B)0.02^2=0.0004\int_{-2}^xf_T(x)dx,\ -2<x<0.

The integral here is

(7) \int_{-2}^xf_T(x)dx=\left\{\begin{array}{ll}x^2/2+2x+2, &-2<x<-1\\1-x^2/2, &-1\le x<0\end{array}\right.

In case of one default, we use the uniform distribution to find

(8) 2P(R\le x|D_A\cap \bar{D}_B)0.02\cdot 0.98=\left\{\begin{array}{ll}0.0392(x+1),&-1\le x<0\\0,&x<-1\end{array}\right..

Plugging (6), (7), (8) in (5) and equating the result to 0.01, we get

(9) 0.0004(x^2/2+2x+2)=0.01, -2<x<-1

and

(10) 0.0004(1-x^2/2)+0.0392(x+1)=0.01, -1\le x<0.

Mathematica gives two solutions for (9), none of which is in the interval (-2,-1). Of the two solutions of (10), the one which belongs to (-1,0) is -0.75. This is 37.5% of -2 and the loss is $750,000 out of $2 mln. The exam question doesn't require you to give numerical values.

(b) From the general definition of expected shortfall

ES^{0.01}=\frac{ER_A1_{R_A\le -0.5}}{P(R_A\le -0.5)}=\frac{\int_{-1}^{-0.5}tdt}{\int_{-1}^{-0.5}dt}=\frac{-3/8}{1/2}=-0.75

which means an expected loss of $750,000.

24
Apr 18

Solution to Question 1 from UoL exam 2016, Zone B

Solution to Question 1 from UoL exam 2016, Zone B

This problem is a good preparation for Question 2 from UoL exam 2015, Zone A (FN3142), which is more difficult.

Problem statement

Two corporations each have a 4% chance of going bankrupt and the event that one of the two companies will go bankrupt is independent of the event that the other company will go bankrupt. Each company has outstanding bonds. A bond from any of the two companies will return R=0% if the corporation does not go bankrupt, and if it does, a bondholder will lose the face value of the investment, i.e., R=-100%. Suppose an investor buys $1000 worth of bonds of the first corporation, which is then called portfolio P_1, and similarly, an investor buys $1000 worth of bonds of the second corporation, which is then called portfolio P_2.
(a) [40 marks] Calculate the VaR at \alpha=5% critical level for each portfolio and for the joint portfolio P=P_1+P_2.
(b) [30 marks] Is VaR sub-additive in this example? Explain why the absence of sub-additivity may be a concern for risk managers.
(c) [30 marks] The expected shortfall ES^\alpha at the \alpha=5% critical level can be defined as ES^\alpha=E_t[R|R\le VaR^\alpha_{t+1}]. Calculate the expected shortfall for the portfolios P_1,\ P_2 and P. Is this risk measure sub-additive?

Solution

There are a couple of general ideas to understand before embarking on calculations. The return on the bond of one company is a binary variable taking values 0% and -100%. All calculations involving it are similar to the ones for the coin. After doing calculations the return figures can be translated to dollar amounts by multiplying by $1000.

While the use of the notions of the distribution function and generalized inverse can be avoided, I prefer to use them to show the general approach.

(a) The return on one bond is described by the table

Table 1. Probability table for return on one bond

Return values Probability
0 0.96
-100 0.04

Therefore its distribution function can be found in the same way as for the coin:

Distribution function for return on one bond

Figure 1. Distribution function for return on one bond

The distribution function is shown in red. It is zero for R<-100, 0.04 for -100\le R<0 and 1 for 0\le R<\infty. The definition of the VaR requires inversion of this function. The graph of this function has flat pieces and its usual inverse does not exist. We have to use the generalized inverse defined by

F^{-1}(y)=\inf\{x:F(x)\ge y\},

see the definition of the infimum here. In our case y=0.05 and the verbal procedure is: 1) find those returns for which F(R)\ge 0.05 (it's the half-axis [0,\infty)) and 2) among them find the least return. The answer is VaR^\alpha=0%. This is the Value at Risk for each of P_1,P_2.

What we do next is very similar to the derivation of the sampling distribution for two coins.

Table 2. Joint probability table for returns on two portfolios

First portfolio
0 -100
Second portfolio 0 0.96^2=0.9216 0.04\times 0.96=0.0384
-100 0.04\times 0.96=0.0384 0.04^2=0.0016

The main body of the table contains probabilities of pairs (R_1,R_2) of the two returns. For the total portfolio the possible return values are 0 (none of the companies goes bankrupt), -50 (one goes bankrupt and the other does not) and -100 (both go bankrupt). The corresponding probabilities follow from Table 2 and we get

Table 3. Probability table for return on the total portfolio

Total return Probabilities
0 0.9216
-50 2\times 0.0384=0.0768
-100 0.0016

This table results in the following distribution function:

Distribution function for return on two bonds

Figure 2. Distribution function for return on two bonds

Since 0.0784>0.05, the Value at Risk is -50% (use the generalized inverse).

(b) Translating the percentages to dollars, at 5% the risk for each of the bonds is $0 and for the total portfolio it is $1000 (50% of $2000; I am passing from negative percentages to positive loss figures).

We say that Value at Risk is sub-additive if VaR_P^\alpha\le Var^\alpha_{P_1}+Var^\alpha_{P_2}. Our calculations show that Value at Risk is not sub-additive in case of independent returns. This has an important practical implication. Suppose that a financial institution has several branches and each of them keeps their Value at Risk, say, at zero. Nevertheless, the Value at Risk for the whole institution may well be large and threaten its stability.

(c) Here we have to apply the definition of the conditional expectation: ES^\alpha_{P_i}=\frac{E_t[R1_{\{R\le VaR^\alpha_{t+1}\}}]}{P(R\le VaR^\alpha_{t+1})}. Since P(R\le 0)=0.96+0.04=1, this is the same as

ES^\alpha_{P_i}=E_t[R1_{\{R\le 0\}}]=0\times 0.96+(-100)\times 0.04=-4%, i=1,2.

For the total portfolio we get

ES^\alpha_P=\frac{E_t[R1_{\{R\le -50\}}]}{P(R\le -50)}=\frac{(-50)\times 0.0768+(-100)\times 0.0016}{0.0768+0.0016}=\frac{-3.84-0.16}{0.0784}=-51.02%.

In monetary terms, this translates (again passing to positive values) to $40 for each bond and to $1020.40 for the total portfolio. The conclusion is that expected shortfall is not sub-additive.

 

22
Apr 18

Solution to Question 1 from UoL exam 2016, Zone A

Solution to Question 1 from UoL exam 2016, Zone A  (FN3142)

Frankly, this is a crazy exercise. I deserve full 100 marks for this solution but I wouldn't be able to solve this during an exam. In the problem statement, I took the liberty to change some terminology and notation. In particular, I use the definitions of the Value at Risk and expected shortfall that give negative values. You can go ahead and redo everything with definitions that give positive values.

Problem statement

Assume daily returns that are normally distributed with constant mean (equal to zero) and variance, i.e., they are given by

R_{t+1}=\sigma_{t+1} z_{t+1}, where z_{t+1}\vert\mathcal{F}_t\overset{i.i.d.}{\sim}N(0,1),

where the time increment t+1 is 1-day.

(a) [25 marks] Derive the following formula for the Value-at-Risk at the \alpha% critical level and 1-day horizon

(1) VaR^\alpha_{t+1}=\sigma_{t+1}\Phi^{-1}(\alpha)

where \Phi is the standard normal cumulative density function.

(b) [25 marks] The expected shortfall ES^\alpha_{t+1} at the critical level \alpha% and 1-day horizon can be defined as

ES^\alpha_{t+1}=E_t(R_{t+1}|R_{t+1}\le VaR^\alpha_{t+1}).

Using the VaR formula from part (a) derive the following formula for the 1-day expected shortfall

(2) ES^\alpha_{t+1}=-\frac{\sigma_{t+1}}{\alpha}p_z(\Phi^{-1}(\alpha))

where p_z is the standard normal probability density function.

(c) [50 marks] Prove that the relative difference between the 1-day expected shortfall and 1-day Value-at-Risk, as a proportion of the 1-day Value-at-Risk, converges to zero when \alpha goes to zero, i.e., show that

(3) \lim_{\alpha\rightarrow 0}\frac{ES^\alpha_{t+1}-VaR^\alpha_{t+1}}{VaR^\alpha_{t+1}}=0.

Solution

(a) The answer is contained in this post.

(b) This part has been solved here.

(c) Plug (1) and (2) in (3):

\lambda\equiv\frac{ES^\alpha_{t+1}-VaR^\alpha_{t+1}}{VaR^\alpha_{t+1}}=\frac{-\frac{\sigma_{t+1}}{\alpha}p_z(\Phi^{-1}(\alpha))-\sigma_{t+1}\Phi^{-1}(\alpha)}{\sigma_{t+1}\Phi^{-1}(\alpha)}

(crossing out \sigma_{t+1} and multiplying everything by \alpha)

=\frac{-p_z(\Phi^{-1}(\alpha))-\alpha\Phi^{-1}(\alpha)}{\alpha\Phi^{-1}(\alpha)}.

At this point it helps to replace v=\Phi^{-1}(\alpha) and note that \alpha\rightarrow 0 is equivalent to v\rightarrow -\infty. Then we get

\lambda=\frac{-p_z(v)-\Phi(v)v}{\Phi(v)v}.

This is indeterminacy of type 0/0. In such cases people use the L'Hôpital's Rule. The above expression has the same limit as

\mu=\frac{(-p_z(v)-\Phi(v)v)'}{(\Phi(v)v)'}=\frac{-p'_z(v)-p_z(v)v-\Phi(v)}{p_z(v)v+\Phi(v)} (we know that p'_z(v)=-p_z(v)v)

=-\frac{\Phi(v)}{p_z(v)v+\Phi(v)}.

This is again indeterminacy of type 0/0 and by the L'Hôpital's Rule this expression has the same limit as

\nu=-\frac{\Phi'(v)}{(p_z(v)v+\Phi(v))'}=-\frac{p_z(v)}{p'_z(v)v+p_z(v)+p_z(v)} (replacing the derivative)

=-\frac{p_z(v)}{-v^2p_z(v)+2p_z(v)}=-\frac{1}{-v^2+1}\rightarrow 0.

21
Apr 18

Value at Risk and its calculation for a normal distribution

Value at Risk and its calculation for a normal distribution

Variance is a symmetric measure of risk. Positive and negative values of the measured variable equally influence variance. Value at Risk is an asymmetric measure of risk and is more useful when negative values, like losses of a bank, are of concern. The bank management can ask a question: What is the probability of us losing today 99% of our assets or more? If L is the loss, as percentage of total assets, and it takes negative values, as in accounting books, this question is written as: How much is P(L\le -0.99)? Here the bound for losses is fixed and the probability is sought.

Value at Risk definition

The Value at Risk approach asks an opposite question. It recognizes that bad things happen and attempts to control the size of a loss fixing the probability of a loss. That is, the question is: How much is at risk, given the probability \alpha% of loss? This translates to

(1) P(L\le VaR)=\alpha.

Value at Risk (VaR) is the solution to this equation (it is defined implicitly by this equation). The left side of the equation is recognized as the value of the distribution function of L at point VaR, so the equation becomes

(2) F_L(VaR)=\alpha.

When F_L has an inverse, this equation is equivalent to

(3) VaR=F_L^{-1}(\alpha).

Thus, in this case finding VaR is as simple as inverting a function. Once again, (1), (2) and (3) are different ways to write the same thing. See illustration in Figure 1.

Remark. If L takes negative values with positive probability, then for small \alpha VaR is negative. VaR sometimes is reported as a positive number. In that case people use the definition P(L\le -VaR)=\alpha or, alternatively, VaR=-F_L^{-1}(\alpha).

VaR diagram

Figure 1. VaR diagram

Case of a normally distributed return

Suppose return R on a portfolio is normally distributed, R\sim N(\mu,\sigma^2). Then it can be written as

(4) R=\mu+\sigma z,

where z is standard normal. The conventional notation for the distribution function of the standard normal is \Phi. More precisely,

\Phi(x)=\int_{-\infty}^xp_z(t)dt, where p_z(t)=(2\pi)^{-1/2}\exp(-t^2/2) is the density of standard normal.

To find the Value at Risk VaR^\alpha corresponding to given \alpha we just apply the definition and equation (4):

(5) P(R\le VaR^\alpha)=P(\mu+\sigma z\le VaR^\alpha)=P(z\le \frac{VaR^\alpha-\mu}{\sigma})=\Phi\left(\frac{VaR^\alpha-\mu}{\sigma}\right)=\alpha,

which gives \frac{VaR^\alpha-\mu}{\sigma}=\Phi^{-1}(\alpha)

or

(6) VaR^\alpha=\mu+\sigma\Phi^{-1}(\alpha).

In a time series context, if we have a series of returns, similarly to (4) we can assume that at each point in time

R_{t+1}=\mu_{t+1}+\sigma_{t+1} z_{t+1},

where z_{t+1} is standard normal conditional on the information set \mathcal{F}_t:

z_{t+1}\vert\mathcal{F}_t\sim N(0,1).

The calculation is essentially the same as in (5), just put subscripts everywhere and make the probability conditional on \mathcal{F}_t (that gives the conditional VaR). The solution is obtained from (6) by putting subscripts:

(7) VaR^\alpha_{t+1}=\mu_{t+1}+\sigma_{t+1}\Phi^{-1}(\alpha).