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.
Latihan ini adalah bagian dari kursus
Introduction to Portfolio Risk Management in Python
Petunjuk latihan
- 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.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# 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))