Skip to content

newey-west adjustment not working properly in OLS #5884

Closed
@syduan

Description

@syduan

It looks newey-west adjustment is not working properly in OLS when 'cluster' is set to 'time' or 'entity'. Specifically, pandas.stats.plm.py lines 791-794 don't have any effect. Should that be replaced with: xox = math.newey_west(m, nw_lags, nobs, df, nw_overlap)?

Here is some code to reproduce the issue.

import numpy
from pylab import *
from pandas import *

T = 100
panel_size = 3
data_dimensions = [T, panel_size]

xs_per_y = WidePanel({
'predictor a' : numpy.random.normal(size=data_dimensions),
'predictor b' : numpy.random.normal(size=data_dimensions)
})

y = B_a + B_b + noise

ys = xs_per_y['predictor a'] + xs_per_y['predictor b'] + numpy.random.normal(size=data_dimensions)

print ols(y=ys, x=xs_per_y, pool=True, cluster = 'time')

we expect the following t-stats to be smaller, but they are the same as the previous OLS

print ols(y=ys, x=xs_per_y, pool=True, cluster = 'time', nw_lags=10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Error ReportingIncorrect or improved errors from pandas

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions