Skip to content

BUG: not raising error on Newey-West corrections when clustering #8170

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 0 commits into from
Sep 13, 2014
Merged

BUG: not raising error on Newey-West corrections when clustering #8170

merged 0 commits into from
Sep 13, 2014

Conversation

jessefarnham
Copy link
Contributor

closes #5884, OLS does not correctly apply Newey-West corrections when clustering
is being used. Add an assertion to check for this.

if (kwargs.get('cluster') is not None and
kwargs.get('nw_lags') is not None):
raise AssertionError(
'OLS does not work with Newey-West correction '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a ValueError

@jreback
Copy link
Contributor

jreback commented Sep 3, 2014

  • need a test for this as well
  • a release note in v0.15.0 reffing the issue

@jreback jreback changed the title Add assertion for GH5884 BUG: not raising error on Newey-West corrections when clustering Sep 4, 2014
@jreback jreback added this to the 0.15.1 milestone Sep 4, 2014
@jessefarnham
Copy link
Contributor Author

The assertion I added (which I'll change to a ValueError and add a test for, as requested), has caused several other tests that run OLS with clustering and Newey-West adjustments to fail. What's the recommended course of action to get all the tests to pass again? Raise nose.SkipTest() on the problematic tests? Have them test for the ValueError instead of whatever they were originally testing for?

@jreback
Copy link
Contributor

jreback commented Sep 11, 2014

if other tests look for the AssertionError then change them. Generally need to be very careful about changing tests as could indicate an actual problem)

@jessefarnham
Copy link
Contributor Author

Sorry, my comment was unclear. What I meant was that some pre-existing tests, such as pandas.stats.tests.test_ols.TestPanelOLS.testRollingWithNeweyWestAndEntityCluster, fail because they try to run OLS with Newey-West and clustering, so they fail due to the new error check that I'm adding in this pull request. Because my change causes OLS to error anytime Newey-West and clustering are both used, any tests that do this will now fail. This is the issue that I'm unsure how to resolve.

@jreback
Copy link
Contributor

jreback commented Sep 11, 2014

@jessefarnham

are these valid ways of using it? if not then the tests should fail (so change the test to to assertRaises)

@jessefarnham
Copy link
Contributor Author

No, using OLS with clustering and Newey-West does not work properly, per GH5884. I'll change the affected tests to use assertRaises. Thanks for the help!

@jessefarnham
Copy link
Contributor Author

Changed the AssertionError to a ValueError, and changed the two broken tests to assert that the ValueError is raised when OLS is called with Newey-West and clustering.

@jreback
Copy link
Contributor

jreback commented Sep 12, 2014

excellent!

pls add a release note in v0.15.0.txt (you can put it in Bug Fixes)
pls squash to a single commit

ping when green

@jreback jreback modified the milestones: 0.15.0, 0.15.1 Sep 12, 2014
@jorisvandenbossche jorisvandenbossche merged commit 2ca6fd8 into pandas-dev:master Sep 13, 2014
@jessefarnham
Copy link
Contributor Author

Unfortunately, I was away for a week and removed my changes from this pull request, planning to sync to head and then reapply when I got back. As a result, when this pull request was closed and merged, it appears that my changes did not actually make it into the codebase. I'll start another pull request; since I'm familiar with the procedure this time, I'll make sure all the changes are in one commit and all the tests pass, so it should be a simple, quick merge this time. Sorry for the trouble; this was my first attempt at a pull request on Github.

@jreback
Copy link
Contributor

jreback commented Sep 22, 2014

@jessefarnham hmm, this is very odd. Looks like an old github bug that does this. Ok pls resubmit and then will get it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

newey-west adjustment not working properly in OLS
3 participants