import Quandl %matplotlib inline data = Quandl.get('GOOG/HEL_SAMAS') data.Close.plot() import statsmodels.api as sm sm.graphics.tsa.plot_pacf(data.Close.squeeze(), lags=5) arma_mod42 = sm.tsa.ARMA(data.Close.squeeze(), (4,2)).fit() print arma_mod42.params arma_mod42.resid.plot() pred=arma_mod42.predict() pred.plot() axis=data.Close.plot(figsize=(12, 8)) pred.plot(ax=axis, style='r--', label='predicted Close') axis.axis(('2013-1-1', '2013-12-12', 25, 40)) axis.legend()