I have this problem and I know that it can be carried out in several ways.
Assume that the returns of a security X are distributed according to a normal law with mean m=0 and standard deviation s=5.
- What is the value at risk at 1 percent (i.e., that minimum value below which it will go in 1 percent of the cases)?
I solved it this way but I would like to know if there are other ways
qnorm(0.01,mean=0,sd=5)
pnorm(-11.63174,mean=0,sd=5)
CodePudding user response:
Taking into account Extreme Value Theory and practice the returns of a securities are usually not normally distributed because of long tails. Then it is assumed (with heuristic) e.g. a t distribution with a very small df (around 6), no matter how many observations is there.
(qt(0.01, 6) 0) * 5
# [1] -15.71334
qnorm(0.01, mean = 0, sd = 5)
# [1] -11.63174
From the technical perspective we mostly work with a sample, so empirical data. Then the data is sorted and value extracted or simply quantile taken.
set.seed(1234)
# some random sample
x <- rnorm(10000, mean = 0, sd = 5)
quantile(x, 0.01)
# 1%
# -11.52401
CodePudding user response:
A. Here is the most obvious other way, if you can entertain the notion:
qnorm(0.01)*5 0
B. The other way is to solve the cdf function 1/2[1 erf((x-mu)/(sigma sqrt(2))] = 0.01 for x. The inverse erf can be approximated by a Maclaurin series erf^(-1)(z) = sum_(k=0)^infty ck/(2k 1)(sqrt(pi)/2 z)^(2k 1) where c0 = 1, c1 =1, and ck = sum_(m=0)^(k-1) cm ck-1-m / (m 1)(2m 1). Using k=1000 for a very good approximation, we can solve the cdf function for x to get the quantile.
c=c(1, 1)
K=1000
for (k in 2:K) {
c[k 1]=0
for (m in 0:(k-1)) {
c[k 1]=c[k 1] c[m 1]*c[k-1-m 1]/(m 1)/(2*m 1)
}
}
c
z = 0.01*2-1
e = 0
for (k in 0:K) {
e = e c[k 1]/(2*k 1) * (sqrt(pi) / 2*z)^(2*k 1)
}
e
e*5*sqrt(2) 0
qnorm(0.01, 0, 5)