Skip to content
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

BUG: GEE score #1839

Merged
merged 4 commits into from Jul 20, 2014
Merged

BUG: GEE score #1839

merged 4 commits into from Jul 20, 2014

Conversation

kshedden
Copy link
Contributor

Fixes a bug in GEE score test that crept in somewhere during refactoring. There was previously no test coverage for GEE score testing. I added a simple regression test here.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling a4a7e36 on kshedden:gee_score into b2c1259 on statsmodels:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling a4a7e36 on kshedden:gee_score into b2c1259 on statsmodels:master.

cov_struct=va, constraint=(L, R))
rslt1 = mod1.fit()
assert_almost_equal(mod1.score_test_results["statistic"],
1.08126334)
Copy link
Member

Choose a reason for hiding this comment

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

add assert also for p-values?

Are these close to a Wald test, so we can have a coarse cross-check?

@kshedden
Copy link
Contributor Author

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) when pulling cfef60e on kshedden:gee_score into b2c1259 on statsmodels:master.

wald_z = np.dot(f, rslt0.params) / se
wald_p = 2*norm.cdf(-np.abs(wald_z))
score_p = mod1.score_test_results["p-value"]
assert(np.abs(wald_p - score_p) < 0.02)
Copy link
Member

Choose a reason for hiding this comment

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

same but better is assert_allclose(wald_p, score_p, atol=0.02)
(more informative failure message, and assert get optimized away in byte compiling python code with option -o)

@josef-pkt
Copy link
Member

notebook looks very good.

merging in spite of assert

josef-pkt added a commit that referenced this pull request Jul 20, 2014
@josef-pkt josef-pkt merged commit 3f49c10 into statsmodels:master Jul 20, 2014
@josef-pkt josef-pkt added the PR label Aug 11, 2014
@josef-pkt josef-pkt added this to the 0.6 milestone Aug 24, 2014
PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this pull request Sep 2, 2014
@kshedden kshedden deleted the gee_score branch September 27, 2014 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants