Skip to content

attach diagnostic tests to result instance #130

Open

Description

@josef-pkt

summary currently has autocorrelation and normality tests, but they are just available in the summary tables. Heteroscedasticity, outlier and (non)linearity diagnostics are missing.

I might also be nice to attach them as methods that cover several tests, .test_acorr, .test_het, .test_xxx? and also to attach the corresponding diagnostic regression plots.

Also doc examples for the whole enchilada, estimate, test, plot, alternative methods in the style of UCLA stats or a chapter in a textbook like Greene would be useful to see what's available and how to run them as user.

Activity

  1. modified the milestones: 0.6, 0.7 on Aug 17, 2014
  2. modified the milestones: 0.10, 0.7 on Sep 5, 2017
  3. josef-pkt commented on Sep 5, 2017

    @josef-pkt
    MemberAuthor

    The API is still not clear to me.

    Do we really want a large collection of methods with test_xxx or should we add a generic method like test_diagnostic or test_specification? Or even something like get_diagnostics in analogy to OLSResults.
    Should we add at least some minimal test_xxx for diagnostics as in some tsa models, and use a generic method for the rest?

    Related question: Where do we put the tests that only apply to one model or a small group of models, i.e. where we don't have a general or generic version? For example testing for dispersion or excess zeros in Poisson.

    Also, we need to avoid circular imports.

  4. josef-pkt commented on Sep 8, 2017

    @josef-pkt
    MemberAuthor

    to get started:

    add method get_diagnostics that returns an instance of a <model>Diagnostics class

    This means I could add experimental versions of CountDiagnostics, PoissonDiagnostics.
    This would also mean that we get a new class hierarchy to delegate to (instead of using Mixins), with some dispatch to the appropriate subclass. If the Diagnostics classes largely delegate to standalone functions, then this classes will mostly specify a convenient API but does not prevent standalone use of specific diagnostics as is now in the OLS diagnostic tests.
    example: Poisson lm_test or score_test of under/overdispersion, zero-inflation or both (e.g. scoretest Poisson versus ZINB?).
    similar score tests: ZIP overdispersion versus ZINB, ...

    possible keywords
    'direction' if we have score_test derived for specific alternative
    alternative is currently restricted to two-sided versus one-sided
    method for alternative versions of the test

    It doesn't rule out that we add a few specific methods like a summary regression plot.

  5. jbrockmendel commented on May 15, 2019

    @jbrockmendel
    Contributor

    Possibly related to #4354

  6. modified the milestones: 0.10, 0.13 on Nov 9, 2020
  7. josef-pkt commented on Nov 9, 2020

    @josef-pkt
    MemberAuthor

    I just had the same idea again as in my last comment for get_specification_tests

    A diagnostic class would allow us to collect all generic and model specific diagnostics and specification tests.
    Outlier-influence diagnostics has a separate get method already (in linear regression models,/OLS, and GLM)

    example count data like poisson

    • test for over dispersion, excess dispersion
    • test for zero-inflation, zero-modification
    • general gof test
    • reset test (is generic)
    • other variance/dispersion tests, e.g. heteroscedasticity

    The actual tests should (mostly) be standalone functions, and the Diagnostics class can just delegate with the appropriate options.
    The methods should return in general a Holder, HolderTuple instance.

    The diagnostics class can include summary for the main results and plot methods.

  8. josef-pkt commented on Nov 18, 2020

    @josef-pkt
    MemberAuthor

    location for diagnostic classes

    stats.diagnostic is already taken with the old OLS diagnostics
    influence_outlier classes are in specific stats module

    in many cases we will need methods that are model/distribution specific with some generic cases like RESET tests

    discrete.diagnostic doesn't exist yet, i.e. no diagnostic modules in model directories
    If PoissonDiagnostic (or DiagnosticPoisson ?) class is in discrete, then we need to import it from there to genmod glm
    similar for other families

    size of modules
    stats.diagnostic is at 1800 lines,
    outlier_influence at 1300
    discrete_diagnostic_count at 300 lines, but dispersion tests are still in generic CMT module

    I guess I start with discrete.diagnostic and a Poisson Diagnostic

    naming:

    • influence classes are XXXInfluence because Skipper had started with OLSInfluence.
    • get_prediction has currently only 2 PredictionResults classes, separately defined in genmod for GLM and in regression for OLS/WLS
    • gee has GEEMargins, GLM doesn't seem to have get_margeff yet (but I thought I had used it for GLM). discrete also has DiscreteMargins
  9. josef-pkt commented on Oct 17, 2022

    @josef-pkt
    MemberAuthor

    Interface/API design issue:

    PoissonDiagnostic has

    • test_dispersion: returns several results, several variants of dispersion tests
    • test_poisson_zero_inflation: has option for two test methods, but returns only the one selected

    Do we return results from several test methods or only from one selected method?

    a compromise would be to have method="all"

    This applies as general issue, e.g.

    • test_nonlinear in OLS or others, which could include generic RESET test

    problems with "all"

    • adding new methods breaks backwards compatibility
    • we possibly need several separate keyword for options in different tests
      But this could also be an advantage, e.g. nonlinear tests that require sorting with respect to one exog.
    • slow tests, not all tests might be fast to compute by default, e.g. if we add bootstrap or similar tests
      we could default to method="fast" that excludes slow methods
    • ...

    If we add a summary method to the Diagnostic classes, then we might want to show only one method for each category of tests.

  10. added
    topic-post_estim
    on Jun 9, 2023
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

    comp-docscomp-regressiondesigntopic-diagnostictopic-post_estimtype-enh

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions