a = ax.plot(lags, corr, **kwargs)
    else:
        kwargs.setdefault("marker", "o")
        kwargs.setdefault("linestyle", "None")
        a, = ax.plot(lags, corr, **kwargs)
        b = c = None
    return a, b, c


arrvs = ar_generator()
arma = ARIMA()
res = arma.fit(arrvs[0], 4, 0)
print res[0]

acf1 = acf(arrvs[0])
acovf1b = acovf(arrvs[0], unbiased=False)
acf2 = autocorr(arrvs[0])
acf2m = autocorr(arrvs[0] - arrvs[0].mean())
print acf1[:10]
print acovf1b[:10]
print acf2[:10]
print acf2m[:10]


x = arma_generate_sample([1.0, -0.8], [1.0], 500)
print acf(x)[:20]
import scikits.statsmodels as sm

print sm.regression.yule_walker(x, 10)

import matplotlib.pyplot as plt
if rescale:
    plt.plot(wm,sdm/sdm[0], '-', wm[maxind], sdm[maxind]/sdm[0], 'o')
else:
    plt.plot(wm, sdm, '-', wm[maxind], sdm[maxind], 'o')
plt.title('matplotlib')

sdp, wp = stbs.periodogram(x)
plt.subplot(2,3,3)

if rescale:
    plt.plot(wp,sdp/sdp[0])
else:
    plt.plot(wp, sdp)
plt.title('stbs.periodogram')

xacov = tsa.acovf(x, unbiased=False)
plt.subplot(2,3,4)
plt.plot(xacov)
plt.title('autocovariance')

nr = len(x)#*2/3
#xacovfft = np.fft.fft(xacov[:nr], 2*nr-1)
xacovfft = np.fft.fft(np.correlate(x,x,'full'))
plt.subplot(2,3,5)
if rescale:
    plt.plot(xacovfft[:nr]/xacovfft[0])
else:
    plt.plot(xacovfft[:nr])

plt.title('fft')