Skip to content

BUG/REF: GenericLikelihoodResults Mixin uses df_model, df_modelwc for aic  #7493

Closed

Description

@josef-pkt

aic in ResultsMxin adds 1 for constant by default to df_model, unless attribute res.hasconst = 0

this should use or check with df_resid which is not a mess like df_model

minimal usage of GenericLikelihoodModel for a new subclass had wrong df_modelwc and consequently wrong aic

It's not really a bug for current models, but very misleading for new or user defined models.

I have not checked if any of the current miscmodels rely on this.

Activity

  1. josef-pkt commented on Jun 8, 2021

    @josef-pkt
    MemberAuthor

    I guess, results.hasconst was a workaround for some models. GenericLikelihoodResults checks model.k_constant

    I guess that some parts of the ResultsMixin are older than the previous changes to df handling in GenericLikelihoodResults

  2. added a commit that references this issue on Jun 11, 2021
  3. josef-pkt commented on Jun 11, 2021

    @josef-pkt
    MemberAuthor

    quick fix in #7488 df_modelwc dhecks now results.k_constant first

    I guess k_constant is a newer version of hasconst. but k_constant is defined in model and copied to results if it is in model.

  4. bashtage commented on Jul 30, 2026

    @bashtage
    Member

    Fixed by PR #7488 / commit df5896f: statsmodels/base/model.py now checks k_constant first, falling back to hasconst. Closing as fixed.

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions