hypothesis testing and why we need robust version - score_test edition

17 views
Skip to first unread message

josef...@gmail.com

unread,
Jun 6, 2018, 8:39:28 PM6/6/18
to pystatsmodels
I'm pretty happy I'm finally getting to score_tests that have similar robustness properties
as the Wald tests with robust cov_type.

AFAIK, statsmodels will be the only package that has a generic HC robust score_test. I didn't see in in R or Stata, nor anywhere else. 
There exist some special cases, for example GEE has had cluster robust score test already for a long time.


example notebook with reset type or link test in both Wald and score test version
https://gist.github.com/josef-pkt/f20abdbd360c2e549f73e98844f5d2c4

---
If we interpret the reset test as a test for correctly specified link function, then the nonrobust tests would lead us to the wrong conclusion. The violation of the Poisson variance assumption distorts the nonrobust versions of both Wald and score tests, and the test indicate that the Poisson with exponential link function is violated but does not point to the correct assumption.

The HC robust tests separate the non-linearity test from the heteroscedasticity assumption, but it could still be confounded by other deviations from the basic Poisson assumption, for example there could be correlation across observations.


Below, the nonrobust test (line 10) rejects the "link test" because of excess dispersion,
the robust score test (line 11) does not reject the correctly specified link assumption.



res = GLM(y, x, family=families.Poisson()).fit()
fitted = res.fittedvalues


In [10]:
exog_extra = np.column_stack((fitted**2, fitted**3))

res.score_test(exog_extra)
Out[10]:
(array([ 14.66795728]), array([ 0.00065297]), 2)

In [11]:
res.score_test(exog_extra, cov_type='HC0')
Out[11]:
(1.0305715671979283, 0.59732986314521364, 2)


Josef



Reply all
Reply to author
Forward
0 new messages