Skip to content

GMM default xnames, truncate summary #1465

Closed

Description

@josef-pkt

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()

Activity

  1. josef-pkt commented on Mar 12, 2014

    @josef-pkt
    MemberAuthor

    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
    
  2. josef-pkt commented on Mar 12, 2014

    @josef-pkt
    MemberAuthor

    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']
    
  3. jseabold commented on Mar 12, 2014

    @jseabold
    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.

  4. added this to the 0.9 milestone on May 27, 2017
  5. josef-pkt commented on Apr 5, 2018

    @josef-pkt
    MemberAuthor

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions