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.
Este exercício faz parte do curso
Quantitative Risk Management in R
Instruções do exercício
- 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.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# 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