ComeçarComece de graça

Estimating VaR and ES for option portfolio

Now you are ready to estimate VaR and ES for the investor in the European call option using the historically simulated losses and gains in hslosses.

Once again, you will do this by two methods. First, you will apply a non-parametric method using a sample quantile to estimate VaR and calculate the average of values exceeding the same quantile to estimate ES.

Then, you will compare these estimates with the values obtained when you assume that the hslosses have a normal distribution. Like in the previous exercise, this is a 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

Ver curso

Instruções do exercício

  • Estimate the 99.5% sample percentile of the distribution of hslosses using quantile().
  • Estimate the 99.5% 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 to mu and sigma, respectively.
  • Use qnorm() with the calculated mean and standard deviation to compute the 99.5% quantile of a normal distribution.
  • Use ESnorm() with the calculated mean and standard deviation to compute the 99.5% ES of a normal distribution.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Estimate the 99.5% percentile of the distribution


# Estimate the 99.5% ES
mean(hslosses[hslosses >= quantile(hslosses, 0.995)])

# Estimate the mean and standard deviation of hslosses



# Compute the 99.5% quantile of a normal distribution


# Compute the 99.5% ES of a normal distribution
Editar e executar o código