Skip to content

Commit

Permalink
Merge pull request #308 from QuantEcon/fix-pandas
Browse files Browse the repository at this point in the history
fix compatibility with pandas v0.2
  • Loading branch information
jstac committed May 12, 2017
2 parents 99e17bb + 6b2321b commit 5fe79e3
Showing 1 changed file with 4 additions and 6 deletions.
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

0 comments on commit 5fe79e3

Please sign in to comment.