Repository navigation
Conversation
|
forgot one change: Huber should use center=mu in mad if mu is given (found while looking at #55) |
|
also: I think adding a Warning in some of the scale==0 cases will be appropriate, mainly when we set weights to be 0 or 1. |
Hampel revert typo abs, fix continuity for rho
TukeyBiweight: add constant, so that rho(0)==0
Hampel psi: wrong sign (this should have caused mistakes)
(based on SAS definitions)
|
good, the pickle test fails, which means it's working need to register the new (nobs,) array |
|
see #1459 for results when we have perfect prediction with OLS |
| y3 = 4 + np.array([ 0, 0, 0, 0, 0, 0, -1.5, 1]) | ||
| y4 = 4. + np.zeros(10) | ||
|
|
||
| endogs = [y1 - 27 + 4, 4 + y2, y3, y4]#[:-1] |
There was a problem hiding this comment.
commented-out code should either be removed or explained
| try: | ||
| rlm = RLM(y, np.ones(len(y)), M=norm()) | ||
| res = rlm.fit(scale_est=scale) | ||
| #print res.params, res.bse, res.scale |
| success.append([norm, scale, res.params, res.bse, res.scale]) | ||
| except Exception as e: | ||
| fail.append([y, norm, scale, res.params, res.bse, res.scale]) | ||
| print ' using ', norm, scale |
| from results.results_rlm import BiSquare | ||
| self.res2 = BiSquare() | ||
|
|
||
| def test_other(self): |
There was a problem hiding this comment.
split into tests each testing one thing
| @@ -0,0 +1,129 @@ | |||
| # -*- coding: utf-8 -*- | |||
There was a problem hiding this comment.
Is this redundant with check_rlm_perfect_prediction?
|
@jbrockmendel Thanks for reviewing. The main problem with this PR is that I couldn't make up my mind when scale=0 with perfect prediction is a bug and when it is a feature. Another problem is that it combines debatable bug fixes with trivial bug-fixes which get blocked because we cannot merge the good with the (possibly) bad. (Since then, I have read large parts of 4 or 5 text books and of 50 to 100 articles in the robust estimation neighborhood. Maybe I could make up my mind now.) |
|
Is there a status update on this? |
Ensure RLM doesn't crash if perfect fit Clean norms so that they don't crash either Avoid calculations the load to nan Improve testing of RLM Replace fabs with abs closes statsmodels#5585 closes statsmodels#1341 closes statsmodels#5878 closes statsmodels#5356 closes statsmodels#3319 xref statsmodels#55
Ensure RLM doesn't crash if perfect fit Clean norms so that they don't crash either Avoid calculations the load to nan Improve testing of RLM Replace fabs with abs closes statsmodels#5585 closes statsmodels#1341 closes statsmodels#5878 closes statsmodels#5356 closes statsmodels#3319 xref statsmodels#55
Ensure RLM doesn't crash if perfect fit Clean norms so that they don't crash either Avoid calculations the load to nan Improve testing of RLM Replace fabs with abs closes statsmodels#5585 closes statsmodels#1341 closes statsmodels#5878 closes statsmodels#5356 closes statsmodels#3319 xref statsmodels#55
|
Hello @josef-pkt! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
|
This PR uses greek, e.g. aside on aic: |
|
an alternative to current behavior in main I guess we still want options for scale if mad == 0 |
|
most likely we cannot rebase this. need more unit test, e.g. for norms, to check that bugs there are fixed. |
|
This has essentially 3 parts AFAICS
looks like many merge conflicts. Maybe split out bugfix and Results enhancements. |
|
The norm bug fixes for hampel and biweight have been manually copied to #8801 and merged |
|
Eviews manual for version 10 p. 425 |
see #55
This makes the code more robust for the cases where we have almost perfect prediction, or where mad of the sample or residual is zero.
There are also small fixes to missing asarray and integer division in robust/scale
The code adds some extra calculation
if scale == 0:Explicit, verifying test for
HuberScaleare still missing. I get the same results with an independent new implementation.New unit tests include a "sanity" check for all norm, scale combinations:
no exceptions, params is reasonably (no nan, close to median) estimated in RLM in all examples
a few nans in bse, and in standalone scale estimates for some corner cases
update
This now includes also some other fixes and enhancements:
signerror(this should have caused problems in existing code, for some values in the negative range)
for scale
TODO
needs another check and new regression numbers.
Maronna, Martin and Yohai 2006 p.106 use empirical cdf for chi2_factor
problem
MMY don't divide by df
(only test case against SAS has df=1, so we cannot verify)
Hampel et all 2005 (1986?) p.346 divide by df and by nobs