Skip to content

design: API for methods for diagnostic tests #5564

Open

Description

@josef-pkt

I'm looking at a RESET article and they use Davidson/MacKinnon auxiliary regression similar to the LM tests in specification tests for OLS.
I was recently focusing more on score_tests for variable addition.

We have at least 3 ways to compute a variable addition based score test:

  • lm test based on auxiliary OLS/WLS regression (which I guess is just a conditional moment test in general)
  • score_test: without auxiliary regression
  • estimate full model with added artificial variables and use Wald test there.

and maybe

  • LR type tests comparing the augmented with the original model

We need a method argument to choose among those.
In some cases, the results will be identical (up to computational precision) and not just asymptotically equivalent. But this will not be the case in general.
In nonlinear models like GLM, we will have the differences in at which parameters auxiliary statistics are evaluated and/or whether we use a one-step Fisher or Newton-Raphson approximation.

Separate choice and possible option is which cov_type is used for Wald or score tests.

For functions that implement general versions of these tests we need also an option for the alternative hypothesis or the direction in which we want to check for model misspecification.

for example the mess with Poisson excess or overdispersion tests where I have 6 to 8 versions some of which depend on which variance function is assumed as alternative, all are implemented as CMT. AFAIR.

Activity

  1. josef-pkt commented on Apr 10, 2019

    @josef-pkt
    MemberAuthor

    RESET test uses powers, but I think we should use splines by default.

  2. josef-pkt commented on May 13, 2019

    @josef-pkt
    MemberAuthor

    In terms of implementation, I think now a specific function for the score_test version of reset type test will be useful.
    score_test and conditional moment tests, only need a current, restricted model, so we avoid creating a new model. using #5711 #4716 the score_test version of the reset test is trivial.

    Wald and LR-type tests will need to create an augmented model which still requires model specific code.

    Common to all version would be the selection and creation of the basis function for the added variable test.

    • power
    • numpy polynomials (skip in first round, I don't think we have examples yet, except some of my ancient ones)
    • splines
    • group indicator functions, piecewise linear

    still open: what names and structure should be used for attaching diagnostic tests to results classes
    score_test_reset(self, basis='...', **kwds, data_variable=None)

    data_variable is ugly, but it will be fittedvalues by default and could be any other 1-dim exog or endog-dependent variable.
    kwds we need some keywords to specify properties the basis functions, e.g. for power, splines or group indicator functions. (maybe a few explicit kwds is enough, like order, spacing/bin_type, ...)

    confusing: order in splines refers to local polynomial order and not number of knots or basis functions
    we could use df for degrees of freedom, similar to patsy's splines as generic term.

    If we allow to use a user provided series, then we might not be able to assume that linear term is included in the restricted model, but it will be simpler to require that, i.e. basis functions for the added variable test do not include the linear term. or we just take the orthogonal complement (as I did in the GAM tests)

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