Value at Risk - Nanyang Technological University · Chapter 3 Value at Risk 3.1Financial Data with...

14
Chapter 3 Value at Risk This chapter deals with risk measures and financial data, including quantile risk measures and value at risk (VaR). Contents 3.1 Financial Data with R .......................... 43 3.2 Risk Measures ................................. 44 3.3 Quantile Risk Measures ........................ 47 3.4 Value at Risk (VaR) ........................... 49 Exercises ........................................... 54 3.1 Financial Data with R Package quantmod for financial data The R package quantmod can be installed and run via the following com- mand: install.packages("quantmod") library(quantmod) getSymbols("1800.HK",from="2007-01-03",to="2011-12-02",src="yahoo") stock=Ad(1800.HK) chartSeries(stock,up.col="blue",theme="white") stock.rtn=diff(log(Ad(1800.HK))) chartSeries(stock.rtn,up.col="blue",theme="white") n= sum(!is.na(stock.rtn)) "

Transcript of Value at Risk - Nanyang Technological University · Chapter 3 Value at Risk 3.1Financial Data with...

Chapter 3Value at Risk

This chapter deals with risk measures and financial data, including quantilerisk measures and value at risk (VaR).

Contents3.1 Financial Data with R . . . . . . . . . . . . . . . . . . . . . . . . . . 433.2 Risk Measures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443.3 Quantile Risk Measures . . . . . . . . . . . . . . . . . . . . . . . . 473.4 Value at Risk (VaR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

3.1 Financial Data with R

Package quantmod for financial data

The R package quantmod can be installed and run via the following com-mand:

install.packages("quantmod")library(quantmod)getSymbols("1800.HK",from="2007-01-03",to="2011-12-02",src="yahoo")stock=Ad(`1800.HK`)chartSeries(stock,up.col="blue",theme="white")stock.rtn=diff(log(Ad(`1800.HK`)))chartSeries(stock.rtn,up.col="blue",theme="white")n = sum(!is.na(stock.rtn))

"

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

N. Privault

5

10

15

20

stock [2007−01−03/2011−12−02]

Last 5.565

Jan 032007

Jan 022008

Jan 012009

Jan 012010

Jan 032011

Dec 022011

Fig. 3.1: Cumulative stock returns.

−0.2

−0.1

0.0

0.1

0.2

stock.rtn [2007−01−04/2011−12−02]

Last 0.0130224303670248

Jan 042007

Jan 022008

Jan 012009

Jan 012010

Jan 032011

Dec 022011

Fig. 3.2: Stock returns.

3.2 Risk Measures

Types of risk [22] include market risk, liquidity risk, credit risk, counterpartyrisk, model risk, estimation risk. For insurance businesses, a more detailedclassification can be set as follows.

1. Financial risk

a. Investment riski. Credit riskii. Market risk (e.g. depreciation)

b. Liability riski. Catastrophe riskii. Non-catastrophe risk (e.g. claim volatility)

2. Operational risk

a. Business risk (e.g. lower production)b. Event risk (e.g. system failure).

44

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

"

Value at Risk

The potential loss asssociated to any of the above risks will will be modelledvia a random variable X.

Definition 3.1. A risk measure is a mapping that assigns a value VX to agiven random variable X.

For insurance companies, which need to hold a capital in order to meet futureliabilities, the capital CX required to face the risk induced by a potential lossX can be defined as

CX := VX − LX ,

where

a) LX represents the (positive or negative) liabilities of the company, andb) VX stands for a upper “reasonable” estimate of the potential loss associ-

ated to X.

Estimating the liabilities of the company by IE[X], the required capital isgiven by

CX = VX − IE[X].

getSymbols("^HSI",from="2013-06-01",to="2014-10-01",src="yahoo")returns <- as.vector(diff(log(Ad(`HSI`))))times=index(Ad(`HSI`))m=mean(returns[returns<0],na.rm=TRUE)plot(times,returns,pch=19,cex=0.4,col="blue", ylab="", xlab="", main = '')segments(x0 = times, x1 = times, y0 = 0, y1 = returns,col="blue")abline(h=m,col="red",lwd=3)sum(!is.na(returns))

2014

−0.03

−0.02

−0.01

0.000.01

0.02

Fig. 3.3: Estimating liabilities by the mean for 346 returns.

Example: Guaranteed Maturity Benefits

Variable annuity benefits offered by insurance companies are usually pro-tected via different mechanisms such as Guaranteed Minimum Maturity Ben-

" 45

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

N. Privault

efits (GMMBs) or Guaranteed Minimum Death Benefits (GMDBs). The com-putation of the corresponding risk measures is an important issue for thepractitioner in risk management.

Given a fund value process (Ft)t∈R+ , an insurer is continuously chargingannualized mortality and expense fees at the rate m from the account ofvariable annuities, resulting into a margin offset income Mt given by

Mt := mFt t ∈ R+.

Denoting by τx the future lifetime of a policyholder at the age x, the futurepayment made by the insurer at maturity T is

(G− FT )+1τx>T

where G is the guarantee level expressed as a percentage of the initial fundvalue F0, δ is a roll-up rate according to which the guarantee increases up tothe payment time. In this case, the random variable X is taken equal to

X := e−rT (G− FT )+1τx>T −

w min(T,τx)

0e−rsMsds.

Coherent risk measures

Definition 3.2. A risk measure V is said to be coherent if it satisfies thefollowing four properties, for any two random variables X, Y :

i) Monotonicity:X 6 Y =⇒ VX 6 VY ,

ii) (Positive) homogeneity:

VλX = λVX , λ > 0,

iii) Translation invariance:

VX+µ = µ+ VX , µ > 0,

iv) Subadditivity:VX+Y 6 VX + VY .

Subadditivity means that the combined risk of several portfolios is lower thanthe sum of risks of those portfolios, as should happen in portfolio diversifica-tion..

The expectation of random variables is an example of coherent risk measure(also called pure premium risk measure)

46

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

"

Value at Risk

VX := IE[X],

which is additive. More generally, any risk measure of the form

MX = IE[XfX(X)],

cf. e.g. (4.2) below, where fX is a non-decreasing function satisfying fX(λx) =fX(x), and fX(µ+ x) = fX(x), x ∈ R, λ, µ > 0, will be monotone, homoge-neous, and translation invariant.

3.3 Quantile Risk Measures

The cumulative distribution function of a random variable X is the function

FX : R −→ [0, 1]

defined byFX(x) := P(X 6 x), x ∈ R.

A random variableX with cumulative distribution given in Figure 3.4 satisfies

P(X = 0) = 0.25 > 0.

The cumulative distribution function satisfies the following properties:

i) x −→ FX(x) is non-decreasing,ii) x −→ FX(x) is right-continuous,iii) limx→∞ FX(x) = 1,iv) limx→−∞ FX(x) = 0.

Fig. 3.4: Cumulative distribution function with jumps.∗

Definition 3.3. Given X a random variable with cumulative distributionfunction FX : R −→ [0, 1] and a level p ∈ (0, 1), the p-quantile of X defined∗ Picture taken from http://www.probabilitycourse.com/.

" 47

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

N. Privault

byqpX := infx ∈ R : P(X 6 x) > p.

Performance analytics in R - quantiles of known distributions

The quantiles of various distributions can be obtained in R. For example,

qnorm(.95, mean=.5, sd=1)

shows that the 95%-quantile of a N (0.5, 1) Gaussian random variable is2.144854. On the other hand, the instruction

qt(.90, df=5)

shows the 90%-quantile of a Student t-distributed random variable with 5degrees of freedom is 1.475884.

Performance analytics in R - empirical CDF

The empirical cumulative distribution function can be estimated as

FN (x) := 1N

N∑i=1

1xi6x, x ∈ R.

getSymbols("^STI",from="1990-01-03",to="2015-02-01",src="yahoo")stock.rtn <- as.vector(diff(log(Ad(`STI`))))stock.ecdf=ecdf(as.vector(stock.rtn))plot(stock.ecdf, xlab = 'Sample Quantiles', ylab = '',main = 'Empirical Cumulative Distribution

',col='blue')

−0.3 −0.2 −0.1 0.0 0.1 0.2 0.3

0.00.2

0.40.6

0.81.0

Empirical Cumulative Distribution

Sample Quantiles

Fig. 3.5: Empirical cumulative distribution function.

48

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

"

Value at Risk

Note that the empirical distribution function has a visible discontinuity at 0,whose height 0.03967611 is given by

sum(!is.na(stock.rtn[stock.rtn==0]))/sum(!is.na(stock.rtn))

3.4 Value at Risk (VaR)

The Value at Risk has two objectives:

i) to provide a measure for risk, andii) to determine an adequate level of capital reserves that matches the cur-

rent level of risk.

In other words, managing risk means here determining a level VX of provisionor capital requirement that will not be “too much” exceeded by X.

In this respect, the probability P(X > V ) that X exceeds the level V is ofa capital importance. Setting V such that for example

P(X 6 V ) > 0.95, i.e. P(X > V ) 6 0.05,

means that insolvency will occur with probability less that 5%.

The 95%-quantile risk measure is the smallest value of V such that

P(X 6 V ) > 0.95, i.e. P(X > V ) 6 0.05.

More precisely, we have the following definition.

Definition 3.4. The Value at Risk V pX at the level p ∈ (0, 1) is the p-quantileof X as defined by

V pX := infx ∈ R : P(X 6 x) > p.

Note that V pX may also be negative, in which case it identifies to a potentialprofit rather than to a liability. On the other hand, the Value at Risk V pXdoes not contain any information on how large losses can be beyond V pX .

By definition of V pX , With probability at least p, the value of X is alwayslower than V pX , i.e. we have

FX(V pX) = P(X 6 V pX) > p.

The function p 7−→ V pX is a non-decreasing function of p ∈ [0, 1], and it is thegeneralized inverse of the cumulative distribution function of X, defined as

x 7−→ FX(x) := P(X 6 x), x ∈ R.

" 49

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

N. Privault

Since the cumulative distribution function of X is non-decreasing, its general-ized inverse p 7−→ V pX is nondecreasing, left-continuous, and it admits limitson the right, see e.g. Proposition 2.3-(2) of [18]. In general we have, for allx ∈ R,

V pX 6 x ⇐⇒ P(X 6 x) > p, (3.1)

and, for all x ∈ R such that P(X = x) = 0,

V pX = x ⇐⇒ p = P(X 6 x).

In particular, if P(X = V pX) = 0 then

p = P(X 6 V pX) and 1− p = P(X > V pX). (3.2)

a) Monotonicity. If X 6 Y then

P(Y 6 x) = P(X 6 Y 6 x) 6 P(X 6 x), x ∈ R,

henceP(Y 6 x) > p =⇒ P(X 6 x) > p, x ∈ R,

which shows thatV pX 6 V

pY ,

hence Value at Risk satisfies the monotonicity property of coherent riskmeasures.

b) Positive homogeneity and translation invariance. Value at Risk also sat-isfies the positive homogeneity and translation invariance properties ofcoherent risk measures, in addition to monotonicity. Indeed, for all b > 0and a ∈ R we have

V paX+b = infx ∈ R : P(aX + b 6 x) > p= infx ∈ R : P(X 6 (x− b)/a) > p= infay + b ∈ R : P(X 6 y) > p= b+ a infy ∈ R : P(X 6 y) > p= b+ aV pX .

c) Subadditivity and coherence. Although Value at Risk satisfies monotonic-ity, positive homogeneity and translation invariance, it is not subadditivein general. Namely, the Value at Risk V pX+Y of X +Y may be larger thanthe sum V pX +V pY . Therefore, Value at Risk is not a coherent risk measure.Proof. We show that Value at Risk is not subadditive by considering twoindependent Bernoulli random variables X,Y ∈ 0, 1 with the distribu-tion P(X = 1) = P(Y = 1) = 2%,

P(X = 0) = P(Y = 0) = 98%.

50

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

"

Value at Risk

hence V 0.975X = V 0.975

Y = 0. On the other hand, we haveP(X + Y = 2) = (0.02)2 = 0.04%,

P(X + Y = 1) = 2× 0.02× 0.98 = 3.92%,

P(X + Y = 0) = (0.98)2 = 96.04%,

henceV 0.975X+Y = 1 > V 0.975

X + V 0.975Y = 0.

Nevertheless, Value at Risk is sub-additive (and hence coherent) on (notnecessarily independent) Gaussian random variables. Indeed, by (3.5), forany two random variables X and Y we have

σ2X+Y = Var[X + Y ]= IE[(X + Y )2]− (IE[X + Y ])2

= IE[X2] + IE[Y 2] + 2 IE[XY ]− IE[X]2 − IE[Y ]2 − IE[X] IE[Y ]= Var[X] + Var[Y ] + 2(IE[XY ]− IE[X] IE[Y ])= Var[X] + Var[Y ] + 2(IE[(X − IE[X])(Y − IE[Y ])] (3.3)6 Var[X] + Var[Y ] + 2

√IE[(X − IE[X])2]

√IE[(Y − IE[Y ])2] (3.4)

=(√

Var[X] +√

Var[Y ])2,

where from (3.3) to (3.4) we applied the Cauchy-Schwarz inequality.

Hence in particular when X and Y are Gaussian, by (3.5) we get

V pX+Y = µX+Y + σX+Y qpZ

= µX + µY + σX+Y qpZ

6 µX + µY + (σX + σY )qpZ= V pX + V pY .

Examples

i) Discrete distribution.

Consider X ∈ 10, 100, 110 with the distribution

P(X = 10) = 90%, P(X = 100) = 9.5%, P(X = 110) = 0.5%.

Compute V 99%X .

" 51

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

N. Privault

ii) Gaussian distribution.

Consider X ' N (µ, σ2) written as

X = µ+ σZ

where Z ' N (0, 1) is a standard normal random variable. We have

V pX = µ+ σqpZ = µ+ σV pZ (3.5)

where the normal quantile qpZ at level p satisfies P(Z > qpZ) = p.

iii) Exponential distribution.

For example, if X has an exponential distribution with parameter λ > 0and mean 1/λ, we have

P(X 6 x) = 1− e−λx, x > 0,

and we find

V pX := infx ∈ R : P(X 6 x) > p

= − 1

λlog(1− p) = IE[X] log 1

1− p .

When p = 95% this yields

V pX ' 2.996 IE[X].

Estimating the liabilities of the company by IE[X], we check that therequired capital CX satisfies

CX = V pX − IE[X] = IE[X] log 11− p − IE[X],

i.e.CX = V 95%

X − IE[X] ' 1.996 IE[X],

which means doubling the estimated amount of liabilities.

iv) Estimating risk probabilities from moments.

We note that in general, by the Chebyshev inequality, for every r > 0we have

xrP(X > x) = xr IE[1X>x

]6 IE

[Xr

1X>x]

6 IE [Xr] ,

52

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

"

Value at Risk

henceP(X 6 x) > 1− 1

xrIE[Xr], x > 0,

and

V pX = infx ∈ R : P(X 6 x) > p

6 inf

x ∈ R : 1− 1

xrIE[Xr] > p

= inf

x ∈ R : xr >

11− p IE[Xr]

=(IE[Xr]1− p

)1/r

=‖X‖Lr(Ω)

(1− p)1/r .

For example, with p = 95% and r = 1 we get

V 95%X 6

11− p IE[X] = 20 IE[X].

To summarize, a smaller Lr-norm of X tends to make the value at riskVX smaller.

Performance analytics in R - Value at Risk

We are using the PerformanceAnalytics R package, which can be installedvia the commands

install.packages("PerformanceAnalytics")library(PerformanceAnalytics)chart.CumReturns(stock.rtn,main="Cumulative Returns")chartSeries(stock,up.col="blue",theme="white")VaR(stock.rtn, p=.95, method="historical")

The historical 95%-Value at Risk over N samples (xi)i=1,...,N can be es-timated using by inverting the empirical cumulative distribution functionFN (x), x ∈ R. It is found equal to V 95%

X = −0.05121668.

VaR(stock.rtn, p=.95, method="gaussian")

The Gaussian 95%-Value at Risk is estimated from (3.5) by

V 95%X = µ+ σqpZ ,

" 53

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

N. Privault

where µ = IE[X] and σ2 = Var[X], and is found equal to V 95%X =

−0.05222171. It can be recovered up to approximation as

m=mean(stock.rtn,na.rm=TRUE)s=sd(stock.rtn,na.rm=TRUE)q=qnorm(.95, mean=0, sd=1)m-s*q

which yields −0.05224278.

The next lemma is useful for random simulation purposes, and it will also beused in the proof of Proposition 4.4 below.

Lemma 3.5. Any random variable X can be represented as X = V UX whereU is uniformly distributed on [0, 1].

Proof. It suffices to note that by (3.1) we have

P(V UX 6 x) = P(U 6 P(X 6 x)) = P(X 6 x) = FX(x), x ∈ R.

Exercises

Exercise 3.1 Consider a random variable X having the Pareto distributionwith probability density function

fX(x) = γθγ

(θ + x)γ+1 , x ∈ R+.

a) Compute the cumulative distribution function

FX(x) :=w x

0fX(y)dy, x ∈ R+.

b) Compute the value at risk V pX at the level p for any θ and γ, and then forp = 99%, θ = 40 and γ = 2.

Exercise 3.2 Consider two independent random variables X and Y withsame distribution given by

P(X = 0) = P(Y = 0) = 90% and P(X = 100) = P(Y = 100) = 10%.

a) Plot the cumulative distribution function of X on the following graph:

54

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

"

Value at Risk

0.88

0.90

0.92

0.94

0.96

0.98

1.00

1.02

0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210−10−20x

FX(x)

Fig. 3.6: Cumulative distribution function of X.

b) Plot the cumulative distribution function of X+Y on the following graph:

0.82

0.84

0.86

0.88

0.90

0.92

0.94

0.96

0.98

1.00

1.02

1.04

0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210−10−20x

FX+Y (x)

Fig. 3.7: Cumulative distribution function of X + Y .

c) Give the values at risk V 99%X+Y , V 95%

X+Y , V 90%X+Y .

d) Compute the Tail Value at Risk

η90%X := 1

1− pw 1

pV qXdq

at the level p = 90%.e) Compute the Tail Value at Risk

ηpX+Y := 11− p

w 1

pV qX+Y dq

at the levels p = 90% and p = 80%.

Exercise 3.3 Consider a random variable X with the cumulative distributionfunction

" 55

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

N. Privault

0.96

0.97

0.98

0.99

1.00

0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160−10−20x

FX(x)

Fig. 3.8: Cumulative distribution function of X.

a) Give the value of P(X = 100).b) Give the value of V qX for all q in the interval [0.97, 0.99].c) Compute the value of V qX for all q in the interval [0.99, 1].

Hint: We have

FX(x) = P(X 6 x) = 0.99 + 0.01× (x− 100)/50, x ∈ [100, 150].

56

This version: May 26, 2018http://www.ntu.edu.sg/home/nprivault/indext.html

"