In the newey_west
function in pandas.stats.math
, the weight variable is always gonna be 0, since max_lags and lag are both integers and lag < max_lags+1. So the newey-west lag has no effect on the Xeps. Is that right?
Xeps = np.dot(m.T, m)
for lag in range(1, max_lags + 1):
auto_cov = np.dot(m[:-lag].T, m[lag:])
weight = lag / (max_lags + 1)
if nw_overlap:
weight = 0
bb = auto_cov + auto_cov.T
dd = (1 - weight) * bb
Xeps += dd
Xeps *= nobs / (nobs - df)
Comment From: jorisvandenbossche
I am not familiar with the Newey West implementation, but note that both the pandas.stats.plm
as pandas.stats.ols
modules that use pandas.stats.math.newey_west
are deprecated, and we refer to statsmodels for such functionality.
Can you check if you can find all functionality you need in statsmodels?
Comment From: TomAugspurger
@ZZZWENG see here for how to do this. Specifically, you want cov_type='HAC',cov_kwds={'maxlags':1}
when fitting the model.
Comment From: ZZWENG
Thanks!