Chapter 3
Chapter 3
Abridged version
3
Risk Measures and Extreme Values
CONTENTS
3.1 Value at Risk (V@R) and Expected Shortfall (ES) . . . . . . . . . . . . . 113
3.2 Basel Accord and Properties of Risk Measures . . . . . . . . . . . . . . . . . . 116
3.3 Historical Simulation (Non-parametric Bootstrapping)
Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
3.4 Model Building Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
3.5 Approach via Extreme Value Theory (EVT) . . . . . . . . . . . . . . . . . . . . 126
3.6 Back Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
3.7 Estimation of Expected Shortfall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
113
114Financial Data Analytics: with Machine Learning, Optimization and Statistics
100 × (1 − x)%
Loss µ Profit
-V@R
Figure 3.1
√
Note that N -day V@R(x), denoted by V@R(N, x) = N V@R(x) assuming
that the daily changes are iid over the N -day period; besides, we implicitly
assume here that E(∆Q) = 0. Usually we work with the loss distribution of
Q (i.e. the positive amount of loss = −∆Q) so that the left tail becomes the
right tail.
Example 3.1.1. Assume that the daily loss distribution of a portfolio is nor-
mal with mean 0 and standard deviation $20 million. Find the 10-day 95%
V@R and 252-day 99% V@R.
V@R asks how bad the loss will be while Expected Shortfall (ES) asks: if
things do get bad, what is the expected loss?
100 × (1 − x)%
Loss Profit
-V@R
Figure 3.2
ES is also known as Conditional V@R (CV@R) for this reason; for the con-
tinuous underlying distribution, it is equivalent to the tail conditional expec-
tation, i.e., with the equality in the conditional event.
Example 3.1.2. Consider a $10 million 1-year loan which has a 1.25% chance
of defaulting. If the loan default, the recovery of the loan principal is equally
likely from 0% to 100%. Find the 1-year 99% V@R and the 1-year 99% ES
respectively.
$0
1 25
0.0
1−
Q
0.0
12 5 u ∼ U (0, 1)
D −$10M × u Profit
-10 -V@R 0
If the loan is defaulted (with the probability of 0.0125), let x be the per-
centage of loan principal recovered. Then (0.0125)(x) = 0.01 or x = 0.8.
That is, 80% of $10m = $8m will be recovered with probability 0.01; or
V@R(0.99) = $10m − $8m = $2m. In other words, the probability of loss
greater than $2m is 80% of 1.25% = 1%.
Besides, the 1-year 99% ES is the expected loss given that the loss is greater
than $2m. Since the loss is uniformly distributed between $2m to $10m, the
mean is $6m. Note that an uniform distribution of X conditional on an event
of X > x is still another uniform distribution.
Example 3.1.3. Consider a portfolio consisting of two $10 million 1-year
loan as in Example 3.1.2. For simplicity, we further assume that if one loan
defaults then it is certain the other loans will not default. If the loan does not
default, a profit of $0.2 million is made. Find the 1-year 99% V@R and 1-year
99% ES of this portfolio.
5 $0.4M
.012
2 ×0
1−
Q
2×
0.01
25 u ∼ U (0, 1)
D −$10M × u + $0.2M Profit
-9.8 -V@R 0.2
Each loan defaults with probability 1.25% and they never default together.
Therefore a default occurs with probability 2.5%. Let x be the percentage of
loan principal recovered. Then (0.025)(x) = 0.01 or x = 0.4. That is, 40% of
116Financial Data Analytics: with Machine Learning, Optimization and Statistics
Moreover, the 1-year 99% ES of this portfolio is the expected loss given that
the loss is greater than $5.8. Since the loss is uniformly distributed between
$5.8m to $9.8m, the mean is $7.8m.
4. Subadditivity: The risk measure of two portfolios after they have been
Risk Measures and Extreme Values 117
merged should not be greater than the sum of their individual risk mea-
sures before they were merged. [ρ(RA + RB ) ≤ ρ(RA ) + ρ(RB )].
The first three conditions are straightforward while the fourth condition means
diversification helps to reduce the inherent risks. Risk measures satisfying all
these four conditions are said to be coherent. Let us recall the V@R and ES
in Examples 3.1.2 and 3.1.3, the 1-year 99% V@R of the two loans separately
is $2m + $2m = $4m which is less than $5.8m, the V@R of the portfolio. This
implies that V@R does not satisfy the subadditivity condition in general; yet
it still remains subadditive among elliptical distributions2 .
The 1-year 99% ES of the two loans separately is $6m + $6m = $12m which
is greater than $7.8m, the ES of the portfolio; indeed, ES generally fulfills the
subadditivity condition [5].
Theorem 3.2.1 (Subadditivity of ES). Let X and Y be two random vari-
ables, and let ESX (p) (resp. ESY (p)) denote the expected shortfall of X (resp.
Y ) at the lower (1 − p)-quantile. Then, for any p ∈ (0, 1),
2 An elliptical distribution is any member of a broad family that generalizes the multivari-
ate normal distribution. For example, this family includes the multivariate t-distribution.
118Financial Data Analytics: with Machine Learning, Optimization and Statistics
the 1-day V@R of this portfolio using historical simulation, see Figures 3.4
and 3.5 for 1999-2002 and 2014-2018, respectively.
Figure 3.4
120Financial Data Analytics: with Machine Learning, Optimization and Statistics
d<-[Link]("stock_new.csv")
d_new=d[,2:4]
rownames(d_new)=d$Date
x_new<-[Link](d_new)
n_new<-nrow(x_new)
xn_new<-[Link](x_new[n_new,])
w<-c(40000,30000,30000)
p0_new<-sum(w)
ws_new<-w/xn_new
ns_new<-n_new-1
hsim_new<-NULL
for (i in 1:ns_new) {
t_new<-xn_new*(x_new[i+1,]/x_new[i,])
hsim_new<-rbind(hsim_new,t_new)
}
hsim_new<-[Link](hsim_new)
ws_new<-[Link](ws_new)
ps_new<-[Link](hsim_old%*%ws_old)
loss_new<-p0_new-ps_new
(VaRs_new<-quantile(loss_new,0.99))
> 2181.303
Figure 3.5
Risk Measures and Extreme Values 121
Note that the cost of the portfolio is $100,000 based on the closing price on
31/12/2002 (resp. 31/8/2018). Then we compute the stock prices of these n
scenarios and save them in hsim. Further, we compute the portfolio value of
ps and the losses of these n scenarios, and finally the 1-day 99% V@R is ob-
tained from the 99th percentile, V@R = $3535.733 (resp. 2181.303).
The above historical simulation method puts equal weight to each historical
data. This method can be modified by putting different weight depending
on the ratio of the (n + 1)-th and i-th volatilities. To this end, we assume
v −v
that σ1i i vi−1i−1 follows a common distribution for all i = 1, 2, . . . , n, e.g.
N (0, 1) or t(ν), the value of vn+1 can be estimated by the i − th scenario as
1 v̂n+1 (i) − vn = 1 vi − vi−1 which gives:
σn+1 vn σi vi−1
vi−1 + (vi − vi−1 )σn+1 /σi
v̂n+1 (i) = vn × vi−1 for i = 1, . . . , n,
library(tseries)
for(i in 3:ns_old){
vol.i_old <- vol_old$[Link][,1][i]
r_old <- xn_old*(t_old[i-1]+(t_old[i]-t_old[i-1])*
sqrt(var.n_old)/vol.i_old)/t_old[i-1]
hsim_old <- rbind(hsim_old,r_old)
}
d_new<-[Link]("stock_new.csv")
t_new<-[Link](d_new$HSBC) # change to matrix
xn_new <- t_new[length(t_new)]
n_new<-nrow(x_new) # no. of obs
u_new <- (lag(t_new)-t_new)/t_new # stock returns
for(i in 3:ns_new){
vol.i_new <- vol_new$[Link][,1][i]
r_new <- xn_new*(t_new[i-1]+(t_new[i]-t_new[i-1])
*sqrt(var.n_new)/vol.i_new)/t_new[i-1]
hsim_new <- rbind(hsim_new,r_new)
}
Figure 3.8
Risk Measures and Extreme Values 125
t1_new<-[Link](d_new$HSBC)
t2_new<-[Link](d_new$CLP)
t3_new<-[Link](d_new$CK)
u1_new<-(lag(t1_new)-t1_new)/t1_new
u2_new<-(lag(t2_new)-t2_new)/t2_new
u3_new<-(lag(t3_new)-t3_new)/t3_new
u_new<-cbind(u1_new,u2_new,u3_new)
S_new<-var(u_new)
dp_new<-[Link](u_new*w)
sdp_new<-sd(dp_new)
(VaRn_new<-qnorm(0.99)*sdp_new)
1990.264
Figure 3.9
Note that in the above R codes, we directly√ compute the sample standard
deviation of ∆P which is the same as w> Sw. The 1-day 99% V@R using
normal model is V aRn = $3062.165 which is less than V aRs = $3535.733.
The normality assumption may not be valid since most returns have a fatter
tail than that of the normal distribution. Hence the V aRn under the nor-
mality assumption is over-optimistic. Recall that we can model the return by
a student’s t-distribution in Section 1.7. Let us compute the sample excess
kurtosis of ∆P , ζˆ2 , and estimate the degrees of freedom by (6/ζˆ2 + 4) rounded
to the nearest integer. Refer to Figure 3.10 (resp. 3.11).
ku_old<-sum((dp_old/sdp_old)^4)/length(dp_old)-3
v_old<-round(6/ku_old+4)
# 1-day 99% V@R
VaRt_old<-qt(0.99,v_old)*sdp_old*sqrt((v_old-2)/v_old)
VaRt_old
3377.59
ku_new<-sum((dp_new/sdp_new)^4)/length(dp_new)-3
v_new<-round(6/ku_new+4)
VaRt_new<-qt(0.99,v_new)*sdp_new*sqrt((v_new-2)/v_new)
VaRt_new
2195.275
Note that if we take u = β/ξ, then P(X > x) ≈ (nu /n)(ξ/β)−1/ξ x−1/ξ , which
Risk Measures and Extreme Values 127
satisfies the Power Law. From the above equation, we can calculate 1-day
(100(1 − ε)) % V@Rε :
nu V@Rε − u − ξ1 β h n · ε −ξ i
1−ε=1− 1+ξ ⇒ V@Rε = u + −1 .
n β ξ nu
Since the density of the generalized Pareto distribution is
We can find the MLEs ξˆ and β̂ by maximizing the log-likelihood function and
then calculating the 1-day (100(1 − ε)) % V@R by:
β̂
ˆ u )−ξ̂ − 1 .
V @Rε = u + (n · ξ/n
ξˆ
The only question remains is how to choose the threshold value u. In practice,
we should first apply the standardized transformation zi = (xi − x̄)/s, set u
to be close to the lower 0.95-quantile of the empirical distribution of zi 3 and
find the V @Rε of z. Finally the V @Rε of x will be x̄ + sV @Rε .
Let us illustrate this by the previous example. Note that we use the R built-in
function optim() to minimize the negative of the log-likelihood function (See
help(optim) for details).
# EVT
u<-3.2 # threshold value
m<-mean(loss) # mean loss
s<-sd(loss) # sd loss
z<-(loss-m)/s # standardize loss
zx<-z[z>u] # select z>u
nu<-length(zx) # no. of zx
Figure 3.12
log_lik<-function(p,dat) { # p=(xi,beta)
length(dat)*log(p[2])+(1/p[1]+1)*sum(log((1+p[1]*dat/p[2])))
}
p0<-c(0.2,0.01) # initial p0
res_old<-optim(p0,log_lik,dat=(zx_old-u)) # min -log_lik
(p_old<-res_old$par) # MLE p=(xi,beta)
[1] 0.6755755 0.3117039
-res_old$value # max value
[1] -3.058536
q<-0.99
(VaR_old<-u+(p_old[2]/p_old[1])*((length(z_old)*
(1-q)/nu_old)^(-p_old[1])-1))
[1] 3.056386
(VaRe_old<-m_old+VaR_old*s_old) # 1day 99% V@R by EVT
[1] 4000.848
Now the 1-day 99% V@R using normal-model is V aRn = $3062.165 (resp.
$1990.264); that using t-model is V aRt = $3377.59 (resp. $2195.275); and
that using extreme value theory is V aRe = $4000.848. A natural question is
which V@R is more suitable? In general, the Extreme Value Theory (EVT) is
theoretically the most rigorous, and should be preferred if there is abundant
data, as EVT uses only data at the tail of the loss distribution. For small
datasets, the t-model is preferred over the normal-model as loss distributions
are more likely to have fat tails. We can actually test these V@R using the
previous data to see which one is more reasonable. This is called back-testing
and will be introduced in the next section.
> m<-0:10
> round(1-pbinom(m,250,0.01),4)
0.9189 0.7142 0.4568 0.2419 0.1078 0.0412 0.0137
0.0040 0.0011 0.0003 0.0001
Figure 3.14
It is clear that P0 > 0.05 if m < 5. The 1986 BIS Amendment requires V@R
models to be back tested. Banks should look at the number of exceptions m
during the previous 250 days. If m < 5, then the riskiness of the portfolio
is considered in the green zone, and the regulatory multiplier is set at its
minimum value (k = 3). If m is 5, 6, 7, 8, or 9, the riskiness of the portfolio
is considered in the yellow zone, and k is set at 3.4, 3.5, 3.65, 3.75 and 3.85,
respectively. Finally, if m ≥ 10, k will be set to 4 and the riskiness of the
portfolio is considered in the red zone [1]. Figure 3.16 shows that k possesses
a linear relationship with m in the yellow zone, and the other values of k in
this zone can be calculated by linear interpolation from the values of k for m
in the range of 4 to 10.
Now let us continue with the [Link] and back test the 1-day 99% V@R
using historical simulation and normal model. From the output in Figures 3.17
and 3.18 we found that the numbers of exceptions in the past 250 days for
all approach are less than 5; except that for the historical simulation, there
were 10 days resulting in exceptions. According to 1986 BIS, if the exceptions
found in the past 250 days less than 5, the regulatory multiplier should be
set to 3 for all, except setting to 4 by using V@Rs over the period of 2014 to
2018.
130Financial Data Analytics: with Machine Learning, Optimization and Statistics
n_new<-nrow(d_new)-1
n1_new<-n_new-250+1
x_new<-[Link](d_new[n1_new:n_new,2:4])
ps_new<-[Link](x_new*ws_new)
ps_new<-c(ps_new,sum(w))
loss_new<-ps_new[1:250]-ps_new[2:251]
sum(loss_new>VaRs_new)
2
sum(loss_new>VaRn_new)
2
sum(loss_new>VaRt_new)
1
1. If L ∼ N (µ, σ 2 ), then
2
σ q σ
ESL (ε) = √ exp − ε + µ = φ(qε ) + µ, (3.1)
ε 2π 2 ε
where φ(·) is the standard normal density function. To see this formula,
for simplicity, we first assume that Z ∼ N (0, 1). The conditional density of
Z given Z > qε is √1 exp(−x2 /2) for qε < x < ∞. Then the expected
ε 2π
shortfall of Z is
Z ∞ Z ∞
x2 x2
1 1
ESZ (ε) = √ x exp(− )dx = √ d − exp(− )
qε ε 2π 2 ε 2π qε 2
∞
1 x2 1 q2 1
= − √ exp(− ) = √ exp(− ε ) + 0 = φ(qε ).
ε 2π 2 ε 2π 2 ε
qε
Hence,
Z ∞
E [X|X > u] = xgξ,β (x)dx
u
∞
Z ∞
= x[Gξ,β (x) − 1] − (Gξ,β (x) − 1) dx
u u
" −1/ξ 1−1/ξ #∞
ξ β ξ
= −x 1 + (x − u) − 1 + (x − u)
β 1−ξ β
u
" 1−1/ξ #u
ξ βx β
= 1 + (x − u) + ,
β β + ξ(x − u) 1 − ξ
∞
hξ i1−1/ξ
note that if ξ < 1, which is generally the case, lim 1+ (x−u) =0
x→∞ β
and hence
β
E[X|X > u] = u + .
1−ξ
Setting the threshold u = V@Rε at the level of (100(1 − ε)) %, we get the
expected shortfall
β
ESX = E [X|X > V@Rε ] = V@Rε + .
1−ξ
Given a plenty amount of data with losses greater than VaRε , the param-
eters ξ and β can be accurately estimated.
3. If we do not want to impose any distributional assumption on L, we can
estimate ESL (ε) by sorting the losses: L(1) , . . . , L(n) in descending order.
Then,
1 PK−1
K −1 L ,
ESL (ε) = k=1 L(k) + 1 − εn (K)
εn
where K is the smallest integer greater than εn. We note that this formula
simply assigns equal weights in each node, with a continuity correction on
the final term.
Bibliography
[1] Basel Committee on Banking Supervision. (1996). Supervisory framework
for the use of “backtesting” in conjunction with the internal models ap-
proach to market risk capital requirements. Basel: Bank for International
Settlements. Retrieved from [Link]
134Financial Data Analytics: with Machine Learning, Optimization and Statistics
[8] Hull, J. (2012). Risk management and financial institutions,+ Web Site
(Vol. 733). John Wiley & Sons.
[9] J.P. Morgan. (1996). Risk Metrics: technical document. New York, N.Y.
[10] McNeil, A. J., Frey, R., & Embrechts, P. (2005). Quantitative risk man-
agement: concepts, techniques and tools. Princeton university press.
[11] Moreno-Montoya J. Benford´s Law with small sample sizes: A new exact
test useful in health sciences during epidemics. Salud UIS, 2020 52(2),
161-163.