I'm having trouble creating a derived model from an existing OLS model using _init_keys (needed for implementing a generic elastic_net).
The issue seems to be that OLS.__init__ calls the parent GLS.__init__, which has a 'weights' keyword argument. "weights" then gets added to _init_keys. But OLS.__init__ has no "weights" and no kwargs either, so when I do something like model.__class__(endog, new_exog, **model._init_keys) on an existing OLS instance, I get a type error about the unrecognized weights argument.
model.__class__(endog, new_exog, **model._init_keys)
It may be a simple matter of adding **kwargs to OLS.__init__ and GLS.__init__.
I think it's better to clean up the _init_keys to reflect the correct keywords for OLS
In OLS.__init__ after the super call, we can add
which should remove weights if it's there, and wouldn't cause an exception if it's not there
_init_keys is a list and not a dictionary, see usage of remove instead of pop in #1959
Merge branch 'OLS_init_keys_1959'
BUG: remove extra weights in _init_keys, closes #1957
@kshedden merged directly into master. You can delete this branch