no bse in robust with norm=TrimmedMean #425

Closed
josef-pkt opened this Issue Aug 12, 2012 · 5 comments

Projects

None yet

3 participants

@josef-pkt
Member

I'm trying out different options for RLM.

I don't know what the answer is (non-differentiability ?)

hsalta = RLM(endog, exog, M=robust.norms.TrimmedMean()).fit()

>>> hsalta.bse
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\base\wrapper.py", line 35, in __getattribute__
    obj = getattr(results, attr)
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\tools\decorators.py", line 95, in __get__
    _cachedval = self.fget(obj)
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\robust\robust_linear_model.py", line 467, in bse
    return np.sqrt(np.diag(self.bcov_scaled))
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\tools\decorators.py", line 95, in __get__
    _cachedval = self.fget(obj)
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\robust\robust_linear_model.py", line 425, in bcov_scaled
    m = np.mean(model.M.psi_deriv(self.sresid))
  File "e:\josef\eclipsegworkspace\statsmodels-git\statsmodels-josef_new\statsmodels\robust\norms.py", line 77, in psi_deriv
    raise NotImplementedError
NotImplementedError
@josef-pkt
Member

typos in norms

method derive instead of deriv
subzet instead of subset

I'm not completely sure it's correct, but looks ok after fixing typos

tests coverage?

@jseabold
Member

Did you push the change or should I? There's no test because trimmed mean wasn't in SAS, but it should be correct. The derivative is simple enough here.

@josef-pkt
Member

I have it currently in my branch, working on LTS. To avoid merge conflicts it's easier if I do it. I'm also looking at the adjustments for trimming for the scale estimate in the Doornik paper. scale estimate is too small I guess.

@josef-pkt josef-pkt added a commit to josef-pkt/statsmodels that referenced this issue Aug 14, 2012
@josef-pkt josef-pkt BUG: robust.norms.TrimmedMean fix typos in psi_deriv closes #425 93f8f55
@kdebrab
kdebrab commented Aug 5, 2013

Will this typo bugfix be part of 0.5.0? I hope so...

@jseabold
Member
jseabold commented Aug 5, 2013

Hmm, it doesn't look like this was ever put into master. I'll apply it so it will be in the release. Thanks for the reminder.

@josef-pkt josef-pkt closed this in d66364a Aug 14, 2013
@jseabold jseabold added a commit that referenced this issue Aug 14, 2013
@jseabold jseabold MAINT: Merge branch 'maintenance/0.5.x'. Merge to close issues.
* maintenance/0.5.x:
  BUG: fix warning arguments in GenericLikelihoodModel
  MAINT: Add name to .mailmap.
  ENH: Pandas Series no longer inherits from ndarray. Closes #1036.
  TST: Fixed test for Anaconda on Windows
  TST: Make test compatible with pandas 0.7.x
  BUG: Fail gracefully when not enough obs given for order.
  BUG: Handle non-string names in lag name making.
  TST: Test for issue 1038.
  DOC: fix docstrings so Latex finishes
  REF: add shapes to Transf_gen, small cleanups
  add explicit shapes to TestTransf2: fixes the fail w/scipy PR/2588
  BUG: acorr_breush_godfrey fix nlags choice closes #676
  BUG: return only yfitted if return_sorted is False closes #922
  TST: Add regression test for #1025.
  BUG: Check for 0 variance not unit. Closes #1025.
  BUG: robust.norms.TrimmedMean fix typos in psi_deriv closes #425
  ENH: Bump Python and NumPy versions. Remove 2.5 only code.
72528f4
@PierreBdR PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014
@josef-pkt @jseabold josef-pkt + jseabold BUG: robust.norms.TrimmedMean fix typos in psi_deriv closes #425 32d54a1
@PierreBdR PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014
@jseabold jseabold MAINT: Merge branch 'maintenance/0.5.x'. Merge to close issues.
* maintenance/0.5.x:
  BUG: fix warning arguments in GenericLikelihoodModel
  MAINT: Add name to .mailmap.
  ENH: Pandas Series no longer inherits from ndarray. Closes #1036.
  TST: Fixed test for Anaconda on Windows
  TST: Make test compatible with pandas 0.7.x
  BUG: Fail gracefully when not enough obs given for order.
  BUG: Handle non-string names in lag name making.
  TST: Test for issue 1038.
  DOC: fix docstrings so Latex finishes
  REF: add shapes to Transf_gen, small cleanups
  add explicit shapes to TestTransf2: fixes the fail w/scipy PR/2588
  BUG: acorr_breush_godfrey fix nlags choice closes #676
  BUG: return only yfitted if return_sorted is False closes #922
  TST: Add regression test for #1025.
  BUG: Check for 0 variance not unit. Closes #1025.
  BUG: robust.norms.TrimmedMean fix typos in psi_deriv closes #425
  ENH: Bump Python and NumPy versions. Remove 2.5 only code.
5d36f4f
@yarikoptic yarikoptic added a commit to yarikoptic/statsmodels that referenced this issue Oct 23, 2014
@yarikoptic yarikoptic Merge tag 'v0.5.0' into debian
Version 0.5.0

* tag 'v0.5.0':
  DOC: Update release notes with maint branch changes.
  MAINT: Fix mailmap entry.
  BUG: fix warning arguments in GenericLikelihoodModel
  MAINT: Add name to .mailmap.
  ENH: Pandas Series no longer inherits from ndarray. Closes #1036.
  TST: Fixed test for Anaconda on Windows
  TST: Make test compatible with pandas 0.7.x
  BUG: Fail gracefully when not enough obs given for order.
  BUG: Handle non-string names in lag name making.
  TST: Test for issue 1038.
  DOC: fix docstrings so Latex finishes
  REF: add shapes to Transf_gen, small cleanups
  add explicit shapes to TestTransf2: fixes the fail w/scipy PR/2588
  BUG: acorr_breush_godfrey fix nlags choice closes #676
  BUG: return only yfitted if return_sorted is False closes #922
  TST: Add regression test for #1025.
  BUG: Check for 0 variance not unit. Closes #1025.
  BUG: robust.norms.TrimmedMean fix typos in psi_deriv closes #425
  ENH: Bump Python and NumPy versions. Remove 2.5 only code.
e9c3418
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment