Get startedGet started for free

Parameter estimation: Skewed Normal

In the previous exercise you found that fitting a Normal distribution to the investment bank portfolio data from 2005 - 2010 resulted in a poor fit according to the Anderson-Darling test.

You will test the data using the skewtest() function from scipy.stats. If the test result is statistically different from zero, then the data support a skewed distribution.

Now you'll parametrically estimate the 95% VaR of a loss distribution fit using scipy.stats's skewnorm skewed Normal distribution. This is a more general distribution than the Normal and allows losses to be non-symmetrically distributed. We might expect losses to be skewed during the crisis, when portfolio losses were more likely than gains.

Portfolio losses for the 2007 - 2009 period are available.

This exercise is part of the course

Quantitative Risk Management in Python

View Course

Exercise instructions

  • Import skewnorm and skewtest from scipy.stats.
  • Test for skewness in portfolio losses using skewtest. The test indicates skewness if the result is statistically different from zero.
  • Fit the losses data to the skewed Normal distribution using the .fit() method.
  • Generate and display the 95% VaR estimate from the fitted distribution.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Import the skew-normal distribution and skewness test from scipy.stats
from scipy.stats import skewnorm, skewtest

# Test the data for skewness
print("Skewtest result: ", ____(____))

# Fit the portfolio loss data to the skew-normal distribution
params = ____.____(losses)

# Compute the 95% VaR from the fitted distribution, using parameter estimates
VaR_95 = ____.____(0.95, *params)
print("VaR_95 from skew-normal: ", VaR_95)
Edit and Run Code