Skip to content

add compare methods to Results #30

Open

Description

@wesm

Original Launchpad bug 677947: https://bugs.launchpad.net/statsmodels/+bug/677947
Reported by: josef-pktd (joep).

see thread starting Oct17 2010, Comparing models

proposal by Thomas Wiecki

http://bazaar.launchpad.net/~josef-pktd/statsmodels/statsmodels-josef-experimental-gsoc/revision/2186

For now I made two methods out of it compare_f_test and
compare_lr_test both attached to regression results
I think, compare_lr_test will go higher up in the class hierarchy so
that it is also available for maximum likelihood models.

I like the more explicit names, but shorter names might be possible

In the simple example, compare_f_test produces exactly the same result
as f_test with the corresponding restriction matrix, as it should for
linear models. Likelihood Ratio test results are close to f_test but I
don't have an exact test for it yet.

Activity

  1. jseabold commented on Sep 18, 2012

    @jseabold
    Member

    Is this still open?

  2. josef-pkt commented on Sep 18, 2012

    @josef-pkt
    Member

    compare_lr_test should move up to LikelihoodModelResults

    looking at it, I think we need an extra argument that allows that lrdf, the number of restriction for the degrees of freedom, can be overwritten. currently relies on the information in df_resid

  3. jseabold commented on Sep 20, 2014

    @jseabold
    Member

    Still relevant?

  4. modified the milestones: 0.7, 0.6 on Sep 20, 2014
  5. josef-pkt commented on Sep 20, 2014

    @josef-pkt
    Member

    moving to 0.7

    still relevant, and there are several other issues open, e.g. #1314

    main problem why it's not just adding the current version to the LikelihoodModel is that in most references they recommend keeping some nuisance parameters like scale or covariance/weighting matrix fixed during the comparison. We have that in the linear model, IIRC, but not generically.

    main underlying refactoring issue is, for example, how to get the loglike given a fixed scale #1776

    RLM, and quasi-likelihood (GLM) will get it's own compare methods of "LR-type"

  6. ispmarin commented on Jul 31, 2015

    @ispmarin

    Any news if this will make into 0.7?

  7. josef-pkt commented on Jul 31, 2015

    @josef-pkt
    Member

    @ispmarin I haven't planned on adding it in 0.7. Saket opened a PR for adding it to the base models #2440, but I'm still not sure whether this works for a wide enough set of subclasses.

    We could add it to specific models, or find a way to warn users when it (most likely) doesn't apply in their case.

    For which models are you interested in the compare method?.

  8. ispmarin commented on Jul 31, 2015

    @ispmarin

    Reading the pull request I got the impression that this should work only for likelihood based models. Is that true? I was wondering about doing the comparison of a more general model comparison, like two ARIMAs with different parameters.

  9. josef-pkt commented on Jul 31, 2015

    @josef-pkt
    Member

    Yes, compare_LR_test is only designed for LikelihoodModels. There are equivalents in a few other model types (RLM, and GLM-Quasi-Likelihood).
    (Related detail: Even for likelihood model it's only correct if the parameters are in the interior of the parameter space. For example, it cannot be directly used to test that a variance is 0.)

    However, ARIMA is a Maximum Likelihood Model, and I'm pretty sure the standard definition as in compare_LR_test should be correct for comparing models with different lags. Note AIC and BIC for ARIMA type models has the same comparison of loglikelihood structure as the LR test.

    Implementation detail: the current method might use degrees of freedom attribute that might not be available in the tsa models.

  10. ispmarin commented on Jul 31, 2015

    @ispmarin

    Thanks for the comments. I asked about the 0.7 milestone because this might be useful for me and it says there on the "Milestone".

    Also, just wondering: what is the policy about issues open for a long time?

  11. josef-pkt commented on Aug 1, 2015

    @josef-pkt
    Member

    Also, just wondering: what is the policy about issues open for a long time?

    They stay open until someone provides a solution. Some of the issues especially those with label design are general reminders about improving the design to generalize or expand to new models and new use cases, and won't have a clear answer.

    For example, adding compare_lr_test would be a "manageable" issue, that doesn't need guessing whether it applies to a large group of models and options.

    All issues with 0.7 milestones that are not prio-high should be 0.8, but I don't have a script yet to relabel them automatically.

  12. modified the milestones: 0.7, Someday on Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions