diff --git a/quantecon/estspec.py b/quantecon/estspec.py index 59f11ed2e..5ad129155 100644 --- a/quantecon/estspec.py +++ b/quantecon/estspec.py @@ -10,7 +10,7 @@ from __future__ import division, print_function import numpy as np from numpy.fft import fft -from pandas import ols, Series +from statsmodels.api import tsa def smooth(x, window_len=7, window='hanning'): @@ -140,11 +140,9 @@ def ar_periodogram(x, window='hanning', window_len=7): """ # === run regression === # - x_current, x_lagged = x[1:], x[:-1] # x_t and x_{t-1} - x_current, x_lagged = Series(x_current), Series(x_lagged) # pandas series - results = ols(y=x_current, x=x_lagged, intercept=True, nw_lags=1) - e_hat = results.resid.values - phi = results.beta['x'] + results = tsa.AR(x).fit(maxlag=1, cov_type='HAC', cov_kwds={'maxlags':1}) + e_hat = results.resid + phi = results.params[1] # === compute periodogram on residuals === # w, I_w = periodogram(e_hat, window=window, window_len=window_len)