Statistical Moments for Time Series

In [19]:
%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
The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload
In [20]:
hfi = PortfolioLoadData.get_hfi_returns()
hfi.head()
Out[20]:
Convertible Arbitrage CTA Global Distressed Securities Emerging Markets Equity Market Neutral Event Driven Fixed Income Arbitrage Global Macro Long/Short Equity Merger Arbitrage Relative Value Short Selling Funds Of Funds
date
1997-01 0.0119 0.0393 0.0178 0.0791 0.0189 0.0213 0.0191 0.0573 0.0281 0.0150 0.0180 -0.0166 0.0317
1997-02 0.0123 0.0298 0.0122 0.0525 0.0101 0.0084 0.0122 0.0175 -0.0006 0.0034 0.0118 0.0426 0.0106
1997-03 0.0078 -0.0021 -0.0012 -0.0120 0.0016 -0.0023 0.0109 -0.0119 -0.0084 0.0060 0.0010 0.0778 -0.0077
1997-04 0.0086 -0.0170 0.0030 0.0119 0.0119 -0.0005 0.0130 0.0172 0.0084 -0.0001 0.0122 -0.0129 0.0009
1997-05 0.0156 -0.0015 0.0233 0.0315 0.0189 0.0346 0.0118 0.0108 0.0394 0.0197 0.0173 -0.0737 0.0275
In [21]:
pd.concat([PortfolioStatistics.annualize_rets(hfi,12),PortfolioStatistics.annualize_vol(hfi,12), PortfolioStatistics.annualize_rets(hfi,12)/PortfolioStatistics.annualize_vol(hfi,12) ], axis=1)
Out[21]:
0 1 2
Convertible Arbitrage 0.066352 0.057391 1.156137
CTA Global 0.046618 0.080833 0.576715
Distressed Securities 0.084723 0.059034 1.435159
Emerging Markets 0.070756 0.112713 0.627750
Equity Market Neutral 0.054915 0.028164 1.949811
Event Driven 0.077034 0.058001 1.328142
Fixed Income Arbitrage 0.052799 0.039972 1.320883
Global Macro 0.065444 0.050999 1.283255
Long/Short Equity 0.076129 0.069056 1.102419
Merger Arbitrage 0.065610 0.033320 1.969059
Relative Value 0.070915 0.039781 1.782618
Short Selling -0.033285 0.165396 -0.201246
Funds Of Funds 0.050848 0.053921 0.942993

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.

Skewness

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.

$$ S(R) = \frac{E[ (R-E()R))^3 ]}{\sigma_R^3} $$
In [22]:
PortfolioRisk.skewness(hfi).sort_values()
Out[22]:
Fixed Income Arbitrage   -3.940320
Convertible Arbitrage    -2.639592
Equity Market Neutral    -2.124435
Relative Value           -1.815470
Event Driven             -1.409154
Merger Arbitrage         -1.320083
Distressed Securities    -1.300842
Emerging Markets         -1.167067
Long/Short Equity        -0.390227
Funds Of Funds           -0.361783
CTA Global                0.173699
Short Selling             0.767975
Global Macro              0.982922
dtype: float64

Kurtosis

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.

In [23]:
PortfolioRisk.kurtosis(hfi).sort_values()
Out[23]:
CTA Global                 2.952960
Long/Short Equity          4.523893
Global Macro               5.741679
Short Selling              6.117772
Funds Of Funds             7.070153
Distressed Securities      7.889983
Event Driven               8.035828
Merger Arbitrage           8.738950
Emerging Markets           9.250788
Relative Value            12.121208
Equity Market Neutral     17.218555
Convertible Arbitrage     23.280834
Fixed Income Arbitrage    29.842199
dtype: float64

Normality test

Here we test for normality of the time series:

In [24]:
hfi.aggregate(PortfolioRisk.is_normal)
Out[24]:
Convertible Arbitrage     False
CTA Global                 True
Distressed Securities     False
Emerging Markets          False
Equity Market Neutral     False
Event Driven              False
Fixed Income Arbitrage    False
Global Macro              False
Long/Short Equity         False
Merger Arbitrage          False
Relative Value            False
Short Selling             False
Funds Of Funds            False
dtype: bool
In [ ]: