statsmodels package has many statistical tests. We will see an example of such a test—the
Anderson-Darling test for normality (http://en.wikipedia.org/wiki/Anderson%E2%80%93Darling_test).
We will download price data as in the previous recipe, but this time for a single stock. Again, we will calculate the log returns of the close price of this stock, and use that as an input for the normality test function.
This function returns a tuple containing a second element—a p-value between 0 and 1. The complete code for this tutorial is as follows:
from __future__ import print_function import datetime import numpy as np from matplotlib import finance from statsmodels.stats.adnorm import normal_ad ...