Distributions: Exercises


2. Expected shortfall. In the previous problem, you found that the 92% VaR threshold for a portfolio with normally-distributed profits (mean = 3, standard deviation = 7) was -6.84 (or 6.84 if we state it as a loss).

In this exercise, you will compute a numerical approximation of expected shortfall.

Use dnorm() to evaluate the the normal distribution's PDF (mean = 3, standard deviation = 7) at two points below the VaR threshold: -8 and -12. Compute the following approximation of ES, where f() is the PDF:

$$ES \approx \frac{-8*f(8) - 12 *f(12)}{f(8)+f(12)}$$

# Evaluate PDF at -8 and -12. pdf8 <- dnorm(___, mean = 3, sd = ___) pdf12 <- dnorm(-12, mean = ___, sd = 7) # Compute ES. ES <- (-8*___ - ___*pdf12)/(___ + ___) # Print ES. print(ES) # Evaluate PDF at -8 and -12. pdf8 <- dnorm(-8, mean = 3, sd = 7) pdf12 <- dnorm(-12, mean = 3, sd = 7) # Compute ES. ES <- (-8*pdf8 - 12*pdf12)/(pdf8+pdf12) # Print ES. print(ES) test_error() test_object("pdf8", incorrect_msg="Did you use `dnorm()` correctly?") test_object("pdf12", incorrect_msg="Did you use `dnorm()` correctly?") success_msg("Good job. Do you think your numerical approximation of ES was accurate?")
Check that you have entered the arguments to dnorm() correctly.

Previous Exercise Next Exercise