Session Ready
Exercise

VaR and risk exposure

Previously you computed the VaR and CVaR when losses were Normally distributed. Here you'll find the VaR using another common loss distribution, the Student's t-distribution (or T) contained in scipy.stats.

You'll compute an array of 99% VaR measures from the T distribution (with 30 - 1 = 29 degrees of freedom), using 30-day rolling windows from investment bank portfolio losses.

First you'll find the mean and standard deviation of each window, creating a list of rolling_parameters. You'll use these to compute the 99% VaR array of measures.

Then you'll use this array to plot the risk exposure for a portfolio initially worth $100,000. Recall that risk exposure is the probability of loss (this is 1%) multiplied by the loss amount (this is the loss given by the 99% VaR).

Instructions
100 XP
  • Import the Student's t-distribution from scipy.stats.
  • Compute the 30-day window mean mu and standard deviation sigma vectors from losses, and place into rolling_parameters.
  • Compute a Numpy array of 99% VaR measures VaR_99 using t.ppf(), from a list of T distributions using the elements of rolling_parameters.
  • Compute and visualize the risk exposure associated with the VaR_99 array.