Skip to content

FIX Bootstrapping GenericLikelihoodModel with no exog - #4676

Closed
ghost wants to merge 87 commits into
masterfrom
unknown repository
Closed

ghost wants to merge 87 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented May 21, 2018 •

Copy link
Copy Markdown

See #944

EDIT: I think I should add some tests...

@ghost

ghost commented Jun 4, 2018

Copy link
Copy Markdown
Author

[Pardon me, I was very occupied the last days.]

I tried applying a simple patch to use the init_kwds instead of cloneargs like

--- a/statsmodels/base/model.py
+++ b/statsmodels/base/model.py
@@ -739,7 +739,7 @@ class GenericLikelihoodModel(LikelihoodModel):
         # self.df_model = 9999
         # somewhere: CacheWriteWarning: 'df_model' cannot be overwritten
         super(GenericLikelihoodModel, self).__init__(endog, exog,
-                                                     missing=missing)
+    

but this leads to breakage in

statsmodels/base/model.py:64: in __init__
   **kwargs)
statsmodels/base/model.py:87: in _handle_data
   data = handle_data(endog, exog, missing, hasconst, **kwargs)
statsmodels/base/data.py:633: in handle_data
   **kwargs)
statsmodels/base/data.py:65: in __init__
   **kwargs)
>               if value_array is None or value_array.ndim == 0:
E               AttributeError: 'int' object has no attribute 'ndim'

I tried fixing that error by just adding a test for scalars to that line, but this leads to test failures e.g. in statsmodels/miscmodels/tmodel; At this point it feels like this PR is getting a bit out of scope / I'm not familiar with it and am not sure what would be the expected behavior .

How is this be addressed? Just keep using the cloneattr for now and refactor this elsewhere?

@josef-pkt

Copy link
Copy Markdown
Member

How is this be addressed? Just keep using the cloneattr for now and refactor this elsewhere?

Yes, fixing directly the problem within the current setting will have minimal side effects.

I opened #4679 for more general refactoring. But refactoring in base is not easy, and usually it takes me a while just to figure out where all the pieces connect and where possible side effects might occur.
And then it's still necessary to take backwards compatibility and our deprecation policy into account.
I didn't want to get far into #4679 because currently I'm refactoring or enhancing other parts which also require keeping track of many moving parts.
(The advantages and disadvantages of writing and maintaining generic code.)

@josef-pkt

Copy link
Copy Markdown
Member

This pull request introduces 1 alert and fixes 3 when merging 0f94dc0 into 6611e87 - view on LGTM.com

new alerts:

  • 1 for Unreachable code

fixed alerts:

  • 2 for Variable defined multiple times
  • 1 for Unreachable code

Comment posted by LGTM.com

@josef-pkt

Copy link
Copy Markdown
Member

It looks like this needs some heavier git surgery to extract the commits of this PR.
I'm trying to do an interactive rebase

@josef-pkt

Copy link
Copy Markdown
Member

I opened PR #5143 with an interactively rebased version.
I didn't check yet whether everything is fine with it.

@bashtage

bashtage commented May 2, 2019

Copy link
Copy Markdown
Member

closed by #5143

@bashtage bashtage closed this May 2, 2019
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.

6 participants