$35
Homework 1
Heyu Zhang
MFE409 Financial Risk Management
Valentin Haddad
Question 1
1. According to VaR defination: prob(w < W0 − V aR1) = 1 − c
prob(w < W0 − V aR1) = F(W0 − V aR1) = 1 − e−λ(W0−VaR1)
Since
E[x] = = W0
We have
1
λ = W0
Hence:
(W0−VaR )
1 − c = F(W0 − V aR1) = 1 − e− W0 1
V aR1 = W0 + W0ln(c)
Apply with W0 = 100 and c = 99
VaR1=100+100*log(0.99)
VaR1
## [1] 98.99497 Value at Risk is 98.99
2. Defination:
prob(w W0 + V aR2) = 1 − c
prob(w W0 + V aR2) = 1 − F(W0 + V aR2) = 1 − (1 − e−(W0+WVaR0 2)) = 1 − c
Hence
V aR2 = −W0 − W0ln(1 − c)
Apply with W0 = 100 and c = 99
VaR2=-100-100*log(1-0.99)
VaR2
## [1] 360.517
Value at Risk of shorting is 360.517.
3. Since the exponential distribution is not as symmetric as normal distribution, we can find that the value at risk of longing and shorting is not the same.
Question 2
1. W0=$1billion From partner’s view,
VaR1=-1*qnorm((1-0.99), mean=0.07, sd=0.1)
VaR1
## [1] 0.1626348
VaR is $0.1626348 billion.
From my view,
VaR2=-1*qnorm((1-0.99), mean=0.07, sd=0.15)
VaR2
## [1] 0.2789522
VaR is $0.2789522 billion.
Common view: Combining the two distribution
q
σ? = π2σ12 + (1 − π)2σ22 + 2π(1 − π)σ1σ2 = πσ1 + (1 − π)σ2
sd3=0.6*0.1+0.4*0.15 VaR3=-1*qnorm((1-0.99), mean=0.07, sd=sd3)
VaR3
## [1] 0.2091617
VaR is $0.2091617 billion. From common view, we have a new distribution to derive VaR. The new value of VaR is between both my view and my partner’s view.
2.
pi= seq(0,1,0.01) sd_pi=(pi*0.1)+(1-pi)*0.15
VaR_pi=-1*qnorm((1-0.99), mean=0.07, sd=sd_pi) plot(pi, VaR_pi)
pi
There is a linear relationship between pi and weighted VaR. As pi increases, VaR is decreasing.
3. The function VaR_gamma below is to calculate VaR based on the sigma following Gamma(alpha, beta) distribution. First, I generate 10000 sigma values from Gamma(alpha, beta) distribution.
Second, for each sigmai, I generate 10000 return values from N(mu,sigmai) distribution.
Third, I sort these 100,000,000 return values in a accending order. Forth, I find the 1-c quantile value of return to calculate VaR.
VaR_gamma<-function(w0,alpha, beta, c, mu){ sigma=rgamma(10000,alpha,beta) return=c() for (i in 1:10000){ return=c(return,rnorm(10000,mean=mu,sd=sigma[i]))
}
return<-sort(return, decreasing = FALSE)
VaR_gamma=-w0*return[(1-c)*length(return)]
}