Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GMM default xnames, truncate summary #1465

Closed
josef-pkt opened this issue Mar 12, 2014 · 5 comments
Closed

GMM default xnames, truncate summary #1465

josef-pkt opened this issue Mar 12, 2014 · 5 comments

Comments

@josef-pkt
Copy link
Member

In an example with an extra parameter, additional to exog.shape[1], the extra parameter is not added to the params table in summary().

The default way that model.data.xnames is set, only looks at exog.
In GenericLikelihoodModel, there are additional adjustments to add names so exog_names matches params (same length).

GMM doesn't have anything similar. How do users define parameter names? except explicitely in summary call.

workaround:

mod = RobustGMM(endog, exog, instrument=None)
res = mod.fit(start_params=start_params, inv_weights=np.eye(len(start_params)))
mod.data.xnames.append('scale')
print res.summary()
@josef-pkt
Copy link
Member Author

Good, from what I remembered it wasn't settable. Correction: it can be changed but not assigned ?

>>> mod.exog_names = ['scale']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: can't set attribute

I still need to find a way where to add the default adjustment. For GenericLikelihoodModel, I put it into the __init__ of the --Results-- Model class.

There I used (which I didn't remember):

        if extra_params_names is not None:
            if self.exog is not None:
                self.exog_names.extend(extra_params_names)
            else:
                self.data.xnames = extra_params_names

@josef-pkt
Copy link
Member Author

BTW this works, but I don't know if it's not only because I already have the attribute in my example

>>> mod.exog_names[:] = ['scale']
>>> mod.exog_names
['scale']

@jseabold
Copy link
Member

You can either overwrite exog_names property or assign to self.data.xnames. We're setting it in ARMA, but maybe because it hasn't been called yet? I'm not sure. I thought I explicitly used getter and setter somewhere.

@josef-pkt
Copy link
Member Author

GMM case fixed in #4428, includes a set_param_names method in GMM

Aside: both solutions assigning to data.xname and modifying model.exog_names are now used by many models with extra params and by generic models.

#4426 new issue for more general param_names/xnames/exog_names inconsistencies

@josef-pkt josef-pkt moved this from bugs to DONE in 0.9 Apr 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
0.9
DONE
Development

No branches or pull requests

2 participants