Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix compatibility with pandas v0.2 #308

Merged
merged 4 commits into from
May 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions quantecon/estspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down Expand Up @@ -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)
Expand Down