Figure 11-9. Quantile-quantile plot for S&P 500 log returns
The same conclusions can be drawn from Figure 11-10, presenting the data for the
Microsoft Inc. stock. There also seems to be strong evidence for a fat-tailed distribution:
In [ 31 ]: sm.qqplot(log_returns[‘MSFT’].dropna(), line=‘s’)
plt.grid(True)
plt.xlabel(‘theoretical quantiles’)
plt.ylabel(‘sample quantiles’)
Figure 11-10. Quantile-quantile plot for Microsoft log returns
All this leads us finally to the formal normality tests:
In [ 32 ]: for sym in symbols:
print “\nResults for symbol %s” % sym
print 32 * “-”
log_data = np.array(log_returns[sym].dropna())
normality_tests(log_data)
Out[32]: Results for symbol ^GDAXI
––––––––––—
Skew of data set 0.026
Skew test p-value 0.623
Kurt of data set 6.525
Kurt test p-value 0.000
Norm test p-value 0.000
Results for symbol ^GSPC
––––––––––—
Skew of data set -0.320
Skew test p-value 0.000
Kurt of data set 10.054
Kurt test p-value 0.000
Norm test p-value 0.000
Results for symbol YHOO