%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import PortfolioAnalytics as PortfolioAnalytics
import PortfolioLoadData as PortfolioLoadData
import PortfolioRisk as PortfolioRisk
import PortfolioStatistics as PortfolioStatistics
%load_ext autoreload
%autoreload 2
hfi = PortfolioLoadData.get_hfi_returns()
hfi.head()
pd.concat([PortfolioStatistics.annualize_rets(hfi,12),PortfolioStatistics.annualize_vol(hfi,12), PortfolioStatistics.annualize_rets(hfi,12)/PortfolioStatistics.annualize_vol(hfi,12) ], axis=1)
After introducing volatility as the standard risk measure, I also provide a discussion of the statistical significance and persistence of non-normality risks, emphasizing an understanding of higher-order moments and how to use them for allocating to assets with non-normal returns.
Intuitively, a negative skew means that you get more negative returns than you would have expected if the returns were distributed like the normal distribution.
Another way of thinking about it is if that returns are normally distributed, the mean and the median would be very close.
However, if they are negatively skewed, the expected value i.e. the mean is less than the median. If they are positively skewed, the expected value (again, the mean) is greater than the median.
PortfolioRisk.skewness(hfi).sort_values()
Intuitively, the kurtosis measures the "fatness" of the tails of the distribution. The normal distribution has a kurtosis of 3 and so if the kurtosis of your returns is less than 3 then it tends to have thinner tails, and if the kurtosis is greater than 3 then the distribution has fatter tails.
Kurtosis is given by:
$$ K(R) = \frac{E[ (R-E(R))^4 ]}{\sigma_R^4} $$This measure is very similar to the skewness.
PortfolioRisk.kurtosis(hfi).sort_values()
Here we test for normality of the time series:
hfi.aggregate(PortfolioRisk.is_normal)