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
.
This is a part of the course
“Introduction to Portfolio Risk Management in Python”
Exercise instructions
- 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.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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))
This exercise is part of the course
Introduction to Portfolio Risk Management in Python
Evaluate portfolio risk and returns, construct market-cap weighted equity portfolios and learn how to forecast and hedge market risk via scenario generation.
In this chapter, you will learn two different methods to estimate the probability of sustaining losses and the expected values of those losses for a given asset or portfolio of assets.
Exercise 1: Estimating tail riskExercise 2: Historical drawdownExercise 3: Historical value at riskExercise 4: Historical expected shortfallExercise 5: VaR extensionsExercise 6: Changing VaR and CVaR quantilesExercise 7: Parametric VaRExercise 8: Scaling risk estimatesExercise 9: Random walksExercise 10: A random walk simulationExercise 11: Monte Carlo simulationsExercise 12: Monte Carlo VaRExercise 13: Understanding riskWhat is DataCamp?
Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.