Parametric VaR
Value at Risk can also be computed parametrically using a method known as variance/co-variance VaR. This method allows you to simulate a range of possibilities based on historical return distribution properties rather than actual return values. You can calculate the parametric VaR(90) using:
# Import norm from scipy.stats
from scipy.stats import norm
# Calculate Parametric VaR
norm.ppf(confidence_level=0.10, mu, vol)
where mu
and vol
are the mean and volatility, respectively.
Returns data is available (in decimals) in the variable StockReturns
.
Diese Übung ist Teil des Kurses
Introduction to Portfolio Risk Management in Python
Anleitung zur Übung
- Import
norm
fromscipy.stats
. - Calculate the mean and volatility of
StockReturns
and assign them tomu
andvol
, respectively. - Set the
confidence_level
for VaR(95). - Calculate VaR(95) using the
norm.ppf()
function, passing in the confidence level as the first parameter, with mu and vol as the second and third parameters.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Import norm from scipy.stats
____
# Estimate the average daily return
mu = ____(StockReturns)
# Estimate the daily volatility
vol = ____(StockReturns)
# Set the VaR confidence level
confidence_level = ____
# Calculate Parametric VaR
var_95 = ____
print('Mean: ', str(mu), '\nVolatility: ', str(vol), '\nVaR(95): ', str(var_95))