Estimating VaR and ES
Now you are ready to estimate VaR and ES for the international equity investor using the historically simulated losses and gains in hslosses
.
You will do this by two methods. First, you will apply a simple non-parametric method using a sample quantile to estimate VaR and the average of values exceeding the sample quantile to estimate ES.
Then, you will compare these estimates with the values obtained when you assume that the hslosses
have a normal distribution. Obviously, this is a very bad assumption and you should compare the two sets of estimates to see which are more conservative.
This exercise is part of the course
Quantitative Risk Management in R
Exercise instructions
- Use
quantile()
to estimate the 99th sample percentile of the distribution ofhslosses
. - Estimate the 99% ES by computing the mean of the
hslosses
that are at least as large as the VaR estimate (this has been done for you). - Use the appropriate functions to estimate the mean and standard deviation of
hslosses
and assign tomu
andsigma
, respectively. - Use
qnorm()
with the calculated mean and standard deviation values to compute the 99% quantile of a normal distribution. - Use
ESnorm()
with the calculated mean and standard deviation values to compute the 99% ES of a normal distribution.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Estimate the 99th sample percentile of the distribution of hslosses
# Estimate the 99% ES
mean(hslosses[hslosses >= quantile(hslosses, 0.99)])
# Estimate the mean and standard deviation of hslosses
# Compute the 99% quantile of a normal distribution
# Compute the 99% ES of a normal distribution