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.
Deze oefening maakt deel uit van de cursus
Introduction to Portfolio Risk Management in Python
Oefeninstructies
- Import
normfromscipy.stats. - Calculate the mean and volatility of
StockReturnsand assign them tomuandvol, respectively. - Set the
confidence_levelfor 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.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# 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))