CVaR and risk exposure
Recall that CVaR is the expected value of loss given a minimum loss threshold. So CVaR is already in the form of a risk exposure--it is the sum (or integral) of the probability of loss in the distribution tail multiplied, by the loss amount.
To derive the 99% CVaR you'll first fit a T distribution to available crisis_losses
portfolio data from 2008 - 2009, using the t.fit()
method. This returns the T distribution parameters p
used to find the VaR with the .ppf()
method.
Next you'll compute the 99% VaR, since it's used to find the CVaR.
Finally you'll compute the 99% CVaR measure using the t.expect()
method, which is the same method you used to compute CVaR for the Normal distribution in an earlier exercise.
The t
distribution from scipy.stats
is also available.
Diese Übung ist Teil des Kurses
Quantitative Risk Management in Python
Anleitung zur Übung
- Find the distribution parameters
p
using the.fit()
method applied tocrisis_losses
. - Compute
VaR_99
using the fitted parametersp
and the percent point function oft
. - Compute
CVaR_99
using thet.expect()
method and the fitted parametersp
, and display the result.
Interaktive Übung zum Anfassen
Probieren Sie diese Übung aus, indem Sie diesen Beispielcode ausführen.
# Fit the Student's t distribution to crisis losses
p = t.____(crisis_losses)
# Compute the VaR_99 for the fitted distribution
VaR_99 = t.____(____, *p)
# Use the fitted parameters and VaR_99 to compute CVaR_99
tail_loss = t.expect(____ y: y, args = (p[0],), loc = p[1], scale = p[2], lb = VaR_99 )
CVaR_99 = (1 / (1 - ____)) * tail_loss
print(CVaR_99)